Spaces:
Sleeping
Sleeping
Siyun He commited on
Commit ·
6a6f1d4
1
Parent(s): f7d9130
update plot code
Browse files- classification.py +5 -1
classification.py
CHANGED
|
@@ -257,10 +257,12 @@ if __name__ == '__main__':
|
|
| 257 |
sns.pairplot(train_glcm, hue='class')
|
| 258 |
# save the plot to a file
|
| 259 |
plt.savefig('train_glcm_distribution.png')
|
|
|
|
| 260 |
|
| 261 |
sns.pairplot(train_lbp, hue='class')
|
| 262 |
# save the plot to a file
|
| 263 |
plt.savefig('train_lbp_distribution.png')
|
|
|
|
| 264 |
|
| 265 |
#Use plots to visualize feature distributions and decision boundaries of the classifiers clf_glcm, clf_lbp using t-sne
|
| 266 |
from sklearn.manifold import TSNE
|
|
@@ -275,10 +277,12 @@ if __name__ == '__main__':
|
|
| 275 |
plt.title('GLCM features')
|
| 276 |
# save the plot to a file
|
| 277 |
plt.savefig('train_glcm_tsne.png')
|
|
|
|
| 278 |
|
| 279 |
plt.scatter(X_train_lbp_tsne[y_train_lbp == 'grass', 0], X_train_lbp_tsne[y_train_lbp == 'grass', 1], color='red', label='grass')
|
| 280 |
plt.scatter(X_train_lbp_tsne[y_train_lbp == 'wood', 0], X_train_lbp_tsne[y_train_lbp == 'wood', 1], color='blue', label='wood')
|
| 281 |
plt.legend()
|
| 282 |
plt.title('LBP features')
|
| 283 |
# save the plot to a file
|
| 284 |
-
plt.savefig('train_lbp_tsne.png')
|
|
|
|
|
|
| 257 |
sns.pairplot(train_glcm, hue='class')
|
| 258 |
# save the plot to a file
|
| 259 |
plt.savefig('train_glcm_distribution.png')
|
| 260 |
+
plt.close()
|
| 261 |
|
| 262 |
sns.pairplot(train_lbp, hue='class')
|
| 263 |
# save the plot to a file
|
| 264 |
plt.savefig('train_lbp_distribution.png')
|
| 265 |
+
plt.close()
|
| 266 |
|
| 267 |
#Use plots to visualize feature distributions and decision boundaries of the classifiers clf_glcm, clf_lbp using t-sne
|
| 268 |
from sklearn.manifold import TSNE
|
|
|
|
| 277 |
plt.title('GLCM features')
|
| 278 |
# save the plot to a file
|
| 279 |
plt.savefig('train_glcm_tsne.png')
|
| 280 |
+
plt.close()
|
| 281 |
|
| 282 |
plt.scatter(X_train_lbp_tsne[y_train_lbp == 'grass', 0], X_train_lbp_tsne[y_train_lbp == 'grass', 1], color='red', label='grass')
|
| 283 |
plt.scatter(X_train_lbp_tsne[y_train_lbp == 'wood', 0], X_train_lbp_tsne[y_train_lbp == 'wood', 1], color='blue', label='wood')
|
| 284 |
plt.legend()
|
| 285 |
plt.title('LBP features')
|
| 286 |
# save the plot to a file
|
| 287 |
+
plt.savefig('train_lbp_tsne.png')
|
| 288 |
+
plt.close()
|