A faster horse on a safer trail: generalized inference for the efficient reconstruction of weighted networks