Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated render spiral, classification code, added scene info script
- Loading branch information
1 parent
4e03a06
commit ffaabbf
Showing
9 changed files
with
245 additions
and
71 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
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
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
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,35 @@ | ||
import pylab as pl | ||
|
||
from sklearn import datasets | ||
from sklearn.decomposition import PCA | ||
from sklearn.lda import LDA | ||
|
||
iris = datasets.load_iris() | ||
|
||
X = iris.data | ||
y = iris.target | ||
target_names = iris.target_names | ||
|
||
pca = PCA(n_components=2) | ||
X_r = pca.fit(X).transform(X) | ||
|
||
lda = LDA(n_components=2) | ||
X_r2 = lda.fit(X, y).transform(X) | ||
|
||
# Percentage of variance explained for each components | ||
print 'explained variance ratio (first two components):', \ | ||
pca.explained_variance_ratio_ | ||
|
||
pl.figure() | ||
for c, i, target_name in zip("rgb", [0, 1, 2], target_names): | ||
pl.scatter(X_r[y == i, 0], X_r[y == i, 1], c=c, label=target_name) | ||
pl.legend() | ||
pl.title('PCA of IRIS dataset') | ||
|
||
pl.figure() | ||
for c, i, target_name in zip("rgb", [0, 1, 2], target_names): | ||
pl.scatter(X_r2[y == i, 0], X_r2[y == i, 1], c=c, label=target_name) | ||
pl.legend() | ||
pl.title('LDA of IRIS dataset') | ||
|
||
pl.show() |
Binary file not shown.
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
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
Oops, something went wrong.