Skip to content

Commit

Permalink
minor modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
kfoynt committed Mar 1, 2019
1 parent 43fa040 commit 2deba04
Show file tree
Hide file tree
Showing 3 changed files with 1,362 additions and 1,377 deletions.
13 changes: 13 additions & 0 deletions localgraphclustering/ncp.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,19 @@ def l1reg(self,
for func in funcs.keys():
self.add_random_node_samples(method=func,methodname=funcs[func],ratio=ratio,nthreads=nthreads,timeout=timeout/len(funcs))
return self

def l1reg_rand(self,
gamma: float = 0.01/0.99,
rholist: List[float] = [1.0e-10,1.0e-8,1.0e-7,1.0e-6,1.0e-5,1.0e-4],
ratio: float = 0.3,
nthreads: int = 4,
timeout: float = 1000):
alpha = 1.0-1.0/(1.0+gamma)
funcs = {partialfunc(spectral_clustering, alpha=alpha,rho=rho,method="l1reg-rand"):'l1reg;rho=%.0e'%(rho)
for rho in rholist}
for func in funcs.keys():
self.add_random_node_samples(method=func,methodname=funcs[func],ratio=ratio,nthreads=nthreads,timeout=timeout/len(funcs))
return self

def crd(self,
U: int = 3,
Expand Down
4 changes: 2 additions & 2 deletions localgraphclustering/spectral_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def spectral_clustering(G, ref_nodes,
method: str
Which method to use for the nodes embedding.
Options: "acl", "l1reg", "nibble", "fiedler", "fiedler_local"
Options: "acl", "l1reg", "l1reg-rand", "nibble", "fiedler", "fiedler_local"
refine:
Expand Down Expand Up @@ -94,7 +94,7 @@ def spectral_clustering(G, ref_nodes,
if G._weighted:
warnings.warn("The weights of the graph will be discarded. Use approximate_PageRank_weighted instead if you want to keep the edge weights.")

if method == "acl" or method == "acl_weighted" or method == "l1reg":
if method == "acl" or method == "acl_weighted" or method == "l1reg" or method == "l1reg-rand":
p = approximate_PageRank(G,ref_nodes,timeout = timeout, iterations = iterations, alpha = alpha,
rho = rho, epsilon = epsilon, method = method, ys = ys)
elif method == "nibble":
Expand Down
Loading

0 comments on commit 2deba04

Please sign in to comment.