Scikit-Learn
24
Transform the data to two-dimensional
X_2D = model.transform(X_iris)
Now, we can plot the result as follows:
iris['PCA1'] = X_2D[:, 0]
iris['PCA2'] = X_2D[:, 1]
sns.lmplot("PCA1", "PCA2", hue='species', data=iris, fit_reg=False);
Output
Complete working/executable example
%matplotlib inline
import matplotlib.pyplot as plt
import
numpy as np
import
seaborn as sns
iris = sns.load_dataset('iris')
Scikit-Learn
26
Scikit-learn’s objects share a uniform basic API that consists of the following three
complementary interfaces:
Dostları ilə paylaş: