Confusion Matrix | ML | AI | Accuracy | Error Rate | Type 1 Error | Type 2 Error | Sklearn - P3

Опубликовано: 11 Октябрь 2024
на канале: technologyCult
3,462
37

Confusion Matrix | ML | AI | Accuracy | Error Rate | Type 1 Error | Type 2 Error | Sklearn - P3

#technologycult #MachineLearningwithPython

Confusion Matrix

Part 3 - Accuracy and Error Rate

All the playlist of this youtube channel
========================================

1. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learnin...  

2. Confusion Matrix in Machine Learning, ML, AI
   • Confusion Matrix in Machine Learning,...  

3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
   • Anaconda | Python Installation | Spyd...  

4. Cross Validation, Sampling, train test split in Machine Learning
   • Cross Validation | Sampling | train t...  

5. Drop and Delete Operations in Python Pandas
   • Drop and Delete Operations in Python ...  

6. Matrices and Vectors with python
   • Matrices and Vectors with python  

7. Detect Outliers in Machine Learning
   • Detect Outliers in Machine Learning  

8. TimeSeries preprocessing in Machine Learning
   • TimeSeries preprocessing in Machine L...  

9. Handling Missing Values in Machine Learning
   • Handling Missing Values in Machine Le...  

10. Dummy Encoding Encoding in Machine Learning
   • Label Encoding, One hot Encoding, Dum...  

11. Data Visualisation with Python, Seaborn, Matplotlib
   • Data Visualisation with Python, Matpl...  

12. Feature Scaling in Machine Learning
   • Feature Scaling in Machine Learning  

13. Python 3 basics for Beginner
   • Python | Python 3 Basics | Python for...  

14. Statistics with Python
   • Statistics with Python  

15. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learnin...  

16. Sklearn Scikit Learn Machine Learning
   • Sklearn Scikit Learn Machine Learning  

17. Linear Regression, Supervised Machine Learning
   • Linear Regression | Supervised Machin...  

Code Starts Here
==============

from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification

Generate predictors and target vector

X, y = make_classification(n_samples=100,
no of features = 10
n_features=10,
features that actually predict the output class
n_informative=5,
features that are random and unrelated to the output class
n_redundant=5,
output classes
n_classes=10,
n_clusters_per_class=2,
random_state=1)

logit = LogisticRegression()

logit.fit(X,y)

y_pred = logit.predict(X)

from sklearn.metrics import confusion_matrix

conf = confusion_matrix(y,y_pred)

from sklearn.metrics import accuracy_score

accuracy = accuracy_score(y,y_pred)

Error_rate = 1 - accuracy

Accuracy1 = conf.diagonal().sum()/sum(sum(conf))

ErrorRate1 = (sum(sum(conf)) - conf.diagonal().sum())/sum(sum(conf))