-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09dbc7f
commit 4614d57
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# DBScan | ||
|
||
We will implement DBScan together in class | ||
|
||
In addition to the requirements.txt, you need to install the `cs506` python package from [02-library](../02-library/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import sklearn.datasets as datasets | ||
from sklearn.preprocessing import StandardScaler | ||
|
||
from cs506 import dbscan | ||
|
||
centers = [[1, 1], [-1, -1], [1, -1]] | ||
X, _ = datasets.make_blobs(n_samples=750, centers=centers, cluster_std=0.4, | ||
random_state=0) | ||
plt.scatter(X[:,0],X[:,1],s=10, alpha=0.8) | ||
plt.show() | ||
|
||
clustering = dbscan.DBC(X, 3, .2).dbscan() | ||
colors = np.array([x for x in 'bgrcmykbgrcmykbgrcmykbgrcmyk']) | ||
colors = np.hstack([colors] * 20) | ||
plt.scatter(X[:, 0], X[:, 1], color=colors[clustering].tolist(), s=10, alpha=0.8) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cycler==0.10.0 | ||
joblib==0.14.0 | ||
kiwisolver==1.1.0 | ||
matplotlib==3.1.1 | ||
numpy==1.17.4 | ||
pyparsing==2.4.5 | ||
python-dateutil==2.8.1 | ||
scikit-learn==0.21.3 | ||
scipy==1.3.2 | ||
six==1.13.0 | ||
sklearn==0.0 |