Skip to content

Commit 74bf46f

Browse files
author
Nicolas Tremblay
committed
changes in Notebooks
1 parent 9c20881 commit 74bf46f

File tree

3 files changed

+117
-51
lines changed

3 files changed

+117
-51
lines changed

mini_test.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"import scipy\n",
2828
"import pygsp\n",
2929
"from matplotlib import pyplot as plt\n",
30-
"import pandas as pd"
30+
"import pandas as pd\n",
31+
"import sklearn\n",
32+
"import networkx as nx"
3133
]
3234
},
3335
{

notebooks/02_spectral.ipynb

Lines changed: 94 additions & 50 deletions
Large diffs are not rendered by default.

notebooks/additional_utils.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,23 @@ def AR_index(c1,c2):
165165

166166

167167
return res
168+
169+
def generate_concentric_circles(N_in, N_out, sigma_in, sigma_out):
170+
'''
171+
Create a simple data set made of two concentric distributions
172+
data, truth = generate_concentric_circles(N_in, N_out, sigma_in, sigma_out)
173+
'''
174+
data = np.empty((N_in+N_out,2)) * np.nan
175+
# first cluster
176+
x = 2*np.random.rand(1,N_out)-1;
177+
y = 2*np.random.rand(1,N_out)-1;
178+
data[:N_out,0] = x / np.sqrt(x**2 + y**2) + sigma_out * np.random.randn(1,N_out)
179+
data[:N_out,1] = y / np.sqrt(x**2 + y**2) + sigma_out * np.random.randn(1,N_out)
180+
181+
# second cluster
182+
data[N_out:,0] = sigma_in * np.random.randn(1, N_in)
183+
data[N_out:,1] = sigma_in * np.random.randn(1, N_in)
184+
185+
truth = np.zeros((N_in+N_out,))
186+
truth[N_out:]=1
187+
return data, truth

0 commit comments

Comments
 (0)