pavuluriashwitha/Machine_Learning
0
1import streamlit as st2st.title("Machine Learning Classification Performance Metrics")3 4 5# Multi-select options for classification metrics6metrics = st.multiselect(7 "Select Performance Metrics",8 options=["Accuracy", "Precision", "Recall", "F1-Score", "Confusion Matrix", "Log-Loss"],9 default=["Accuracy", "Precision"]10)11 12# Display selected metrics13#st.write(f"Metrics selected: {', '.join(metrics)}")14 15# Show explanation based on selected metrics16if "Accuracy" in metrics:17 st.subheader("Accuracy")18 st.write("""19 - Accuracy is the ratio of the total number of correctly classified points to the total number of points in the test dataset (Dtest)..20 - Accuracy should be used when the dataset is balanced if the dataset is imbalanced then we can't prefer this.21 - This can not give probablity score.22 """)23 st.image("https://docs.clarifai.com/img/tutorial/how-to-evaluate-an-image-classification-model/accuracy_formula.webp")24 25if "Precision" in metrics:26 st.subheader("Precision")27 st.write("""28 - Precision is the ratio of true positive predictions to all positive predictions (i.e., true positives + false positives). 29 """)30 st.image("https://cdn-images-1.medium.com/v2/resize:fit:1600/1*HGd3_eAJ3-PlDQvn-xDRdg.png")31 32if "Recall" in metrics:33 st.subheader("Recall")34 st.write("""35 - Recall is the ratio of true positive predictions to all actual positives (i.e., true positives + false negatives).36 """)37 st.image("https://intellipaat.com/blog/wp-content/uploads/2020/06/Recall.png")38 39if "F1-Score" in metrics:40 st.subheader("F1-Score")41 st.write("""42 - F1-Score is the harmonic mean of Precision and Recall.43 """)44 st.image("https://images.prismic.io/encord/0ef9c82f-2857-446e-918d-5f654b9d9133_Screenshot+(49).png?auto=compress,format")45 46if "Confusion Matrix" in metrics:47 st.subheader("Confusion Matrix")48 st.write("""49 - The confusion matrix is a table used to evaluate the performance of a classification model by comparing the predicted and actual values.50 - In Matrix the diagonal values should be high when compared to non diagonal values.51 """)52 st.image("https://2.bp.blogspot.com/-EvSXDotTOwc/XMfeOGZ-CVI/AAAAAAAAEiE/oePFfvhfOQM11dgRn9FkPxlegCXbgOF4QCLcBGAs/s1600/confusionMatrxiUpdated.jpg")53 54if "Log-Loss" in metrics:55 st.subheader("Log-Loss")56 st.write("""57 - Log-Loss uses Probability Score.58 - It can be used for both Binaryy classification and Multi-Class classification59 - Log-Loss for binary class is Binary Cross Entropy and for multi-Class is called Categorical Cross Entropy.60 """)61 st.image("https://miro.medium.com/v2/resize:fit:1096/1*rdBw0E-My8Gu3f_BOB6GMA.png")62 63 64 