-
-
Notifications
You must be signed in to change notification settings - Fork 559
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
Showing
328 changed files
with
33,237 additions
and
2,430 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,23 +1,36 @@ | ||
from sklearn.datasets import load_digits | ||
from sklearn.datasets import load_digits, load_iris | ||
from sklearn.linear_model import LogisticRegression | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.model_selection import train_test_split as tts | ||
|
||
from yellowbrick.classifier import ConfusionMatrix | ||
|
||
|
||
if __name__ == '__main__': | ||
# Load the regression data set | ||
digits = load_digits() | ||
X = digits.data | ||
y = digits.target | ||
|
||
X_train, X_test, y_train, y_test = train_test_split(X,y, test_size =0.2, random_state=11) | ||
|
||
digit_X = digits.data | ||
digit_y = digits.target | ||
d_X_train, d_X_test, d_y_train, d_y_test = tts( | ||
digit_X, digit_y, test_size=0.2 | ||
) | ||
model = LogisticRegression() | ||
digit_cm = ConfusionMatrix(model, classes=[0,1,2,3,4,5,6,7,8,9]) | ||
digit_cm.fit(d_X_train, d_y_train) | ||
digit_cm.score(d_X_test, d_y_test) | ||
d = digit_cm.poof(outpath="images/confusion_matrix_digits.png") | ||
|
||
#The ConfusionMatrix visualizer taxes a model | ||
cm = ConfusionMatrix(model, classes=[0,1,2,3,4,5,6,7,8,9]) | ||
|
||
cm.fit(X_train, y_train) # Fit the training data to the visualizer | ||
cm.score(X_test, y_test) # Evaluate the model on the test data | ||
g = cm.poof(outpath="images/confusion_matrix.png") # Draw/show/poof the data | ||
iris = load_iris() | ||
iris_X = iris.data | ||
iris_y = iris.target | ||
iris_classes = iris.target_names | ||
i_X_train, i_X_test, i_y_train, i_y_test = tts( | ||
iris_X, iris_y, test_size=0.2 | ||
) | ||
model = LogisticRegression() | ||
iris_cm = ConfusionMatrix( | ||
model, classes=iris_classes, | ||
label_encoder={0: 'setosa', 1: 'versicolor', 2: 'virginica'} | ||
) | ||
iris_cm.fit(i_X_train, i_y_train) | ||
iris_cm.score(i_X_test, i_y_test) | ||
i = iris_cm.poof(outpath="images/confusion_matrix_iris.png") |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.