Esempio n. 1
0
 def test_RDPG_nparams(self):
     n_verts = 1000
     g = self.graph
     e = RDPGEstimator(n_components=2)
     e.fit(g)
     assert e._n_parameters() == n_verts * 2
     g[100:, 50:] = 1
     e = RDPGEstimator(n_components=2)
     e.fit(g)
     assert e._n_parameters() == n_verts * 4
Esempio n. 2
0
def estimate_rdpg(graph, n_components=None):
    estimator = RDPGEstimator(loops=False, n_components=n_components)
    estimator.fit(graph)
    if n_components is None:
        n_components = estimator.latent_.shape[0]
    # n_params = graph.shape[0] * n_components
    n_params = estimator._n_parameters()
    return estimator, n_params