Optimize functions

class regrank.optimize.SpringRank(method='legacy')[source]

Bases: BaseModel

fit(data, alpha=1, **kwargs)[source]
class regrank.optimize.SpringRankLegacy(alpha=0)[source]

Bases: object

compute_sr(A, alpha=0)[source]

Solve the SpringRank system. If alpha = 0, solves a Lagrange multiplier problem. Otherwise, performs L2 regularization to make full rank.

Arguments:

A: Directed network (np.ndarray, scipy.sparse.csr.csr_matrix) alpha: regularization term. Defaults to 0.

Output:

ranks: Solution to SpringRank

static csr_SpringRank(A)[source]

Main routine to calculate SpringRank by solving linear system Default parameters are initialized as in the standard SpringRank model

Arguments:

A: Directed network (np.ndarray, scipy.sparse.csr.csr_matrix)

Output:

rank: N-dim array, indeces represent the nodes’ indices used in ordering the matrix A

eqs39(beta, s, A)[source]
fit(data)[source]
fit_scaled(data, scale=0.75)[source]
get_inverse_temperature(A, ranks)[source]

given an adjacency matrix and the ranks for that matrix, calculates the temperature of those ranks

get_ranks(A)[source]

params: - A: a (square) np.ndarray

returns: - ranks, np.array

TODO: - support passing in other formats (eg a sparse matrix)

static scale_ranks(ranks, scaling_factor)[source]