This package perform different way to visualize machine learning and deep learning classification results
Project description
Plots of Classifier Performance :- When it comes to machine learning and deep learning task there are many ways to plot the performance of a classifier. There is metrics to compare different estimators like accuracy, precision, recall and f1 score.All of the common classification metrics are calculated from true positive, true negative, false positive and false negative incidents. The most popular plots are definitely ROC curve, PRC and the confusion matrix.
There are four ways to check if the predictions are right or wrong:
1. TN / True Negative: the case was negative and predicted negative
2. TP / True Positive: the case was positive and predicted positive
3. FN / False Negative: the case was positive but predicted negative
4. FP / False Positive: the case was negative but predicted positive
Precision:- Accuracy of positive predictions = TP/(TP + FP)
Recall:- Fraction of positives that were correctly identified = TP/(TP+FN)
F1 Score = 2*(Recall * Precision) / (Recall + Precision)
User installation :
If you already have a working installation of numpy and pandas, the easiest way to install plotly_ml_classification is using pip
pip install plotclassification
This package depend on other packages:
1.numpy
2.pandas
3.sklearn
4.plotly
Usage
# import libraries
import plotclassification
from sklearn import datasets
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
# Load data
iris = datasets.load_iris()
# Create feature matrix
features = iris.data
# Create target vector
target = iris.target
#create list of classname
class_names = iris.target_names
class_names
# Create training and test set
x_train, x_test, y_train, y_test = train_test_split(features,
target,
test_size=0.9,
random_state=1)
# Create logistic regression
classifier = LogisticRegression()
# Train model and make predictions
model = classifier.fit(x_train, y_train)
# create predicted probabilty matrix
y_test__scores = model.predict_proba(x_test)
# initialize parameters value
plot=plotclassification.plot(y=y_test,
y_predict_proba=y_test__scores,
class_name=['Class 1','class 2','class 3'])
plot.class_name
['Class 1', 'class 2', 'class 3']
# classification report plot
plot.plot_classification_report()
# confusion matrix plot
plot.plot_confusion_matrix()
# precision recall curve plot
plot.plot_precision_recall_curve()
# roc plot
plot.plot_roc()
# predicted probability histogram plot
plot_probability_histogram()
Change Log
0.0.1 (06/03/2021)
- First Release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file plotclassification-0.0.4.tar.gz
.
File metadata
- Download URL: plotclassification-0.0.4.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c6b99cff815993bb0c6b8e8e5a8ab17839fa9cdcc40c6b107008ab6bd4c828 |
|
MD5 | 10e895eb6922aded242f52471a5f58e1 |
|
BLAKE2b-256 | 09489772cf3a32a86c5d4543cda5a0c40b70da062b327b4d61f77b7084bf1710 |