Rename DecisionBoundaries_LearningCurves_Algorithms.py to DB_LC_Algorithms.py
Browse files
DecisionBoundaries_LearningCurves_Algorithms.py → DB_LC_Algorithms.py
RENAMED
|
@@ -13,7 +13,7 @@ from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_sc
|
|
| 13 |
from mlxtend.plotting import plot_decision_regions
|
| 14 |
|
| 15 |
# Image
|
| 16 |
-
st.image("https://huggingface.co/spaces/varshitha22/
|
| 17 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 18 |
|
| 19 |
# Sidebar for dataset selection
|
|
@@ -25,33 +25,37 @@ noise = st.sidebar.slider("Add Noise:", 0.0, 1.0, 0.2, step=0.05)
|
|
| 25 |
st.sidebar.header("Model Selection")
|
| 26 |
model_name = st.sidebar.radio("Choose a Model:", ["KNN", "Decision Tree", "Naive Bayes", "Logistic Regression", "SVC"])
|
| 27 |
|
| 28 |
-
# Display
|
| 29 |
-
neighbors = None
|
| 30 |
if model_name == "KNN":
|
| 31 |
neighbors = st.sidebar.number_input("Neighbors", min_value=1, max_value=25, value=5, step=1)
|
| 32 |
knn_weights = st.sidebar.radio("KNN Weights:", ["uniform", "distance"])
|
| 33 |
|
| 34 |
-
# KNN Algorithm
|
| 35 |
-
st.sidebar.subheader("KNN Algorithm")
|
| 36 |
-
algorithms_selected = []
|
| 37 |
-
if st.sidebar.checkbox("auto", value=True):
|
| 38 |
-
|
| 39 |
-
if st.sidebar.checkbox("ball_tree"):
|
| 40 |
-
|
| 41 |
-
if st.sidebar.checkbox("kd_tree"):
|
| 42 |
-
|
| 43 |
-
if st.sidebar.checkbox("brute"):
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
# KNN Metric
|
| 47 |
-
st.sidebar.subheader("KNN Metric")
|
| 48 |
-
metrics_selected = []
|
| 49 |
-
if st.sidebar.checkbox("euclidean", value=True):
|
| 50 |
-
|
| 51 |
-
if st.sidebar.checkbox("manhattan"):
|
| 52 |
-
|
| 53 |
-
if st.sidebar.checkbox("minkowski"):
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Generate dataset
|
| 57 |
if data_type == "Blobs":
|
|
@@ -123,3 +127,4 @@ ax.set_xlabel("Training Size")
|
|
| 123 |
ax.set_ylabel("Accuracy")
|
| 124 |
ax.legend()
|
| 125 |
st.pyplot(fig)
|
|
|
|
|
|
| 13 |
from mlxtend.plotting import plot_decision_regions
|
| 14 |
|
| 15 |
# Image
|
| 16 |
+
st.image("https://huggingface.co/spaces/varshitha22/KNN/resolve/main/logo.png")
|
| 17 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 18 |
|
| 19 |
# Sidebar for dataset selection
|
|
|
|
| 25 |
st.sidebar.header("Model Selection")
|
| 26 |
model_name = st.sidebar.radio("Choose a Model:", ["KNN", "Decision Tree", "Naive Bayes", "Logistic Regression", "SVC"])
|
| 27 |
|
| 28 |
+
# Display KNN specific settings only if KNN is selected
|
|
|
|
| 29 |
if model_name == "KNN":
|
| 30 |
neighbors = st.sidebar.number_input("Neighbors", min_value=1, max_value=25, value=5, step=1)
|
| 31 |
knn_weights = st.sidebar.radio("KNN Weights:", ["uniform", "distance"])
|
| 32 |
|
| 33 |
+
# KNN Algorithm
|
| 34 |
+
st.sidebar.subheader("KNN Algorithm")
|
| 35 |
+
algorithms_selected = []
|
| 36 |
+
if st.sidebar.checkbox("auto", value=True):
|
| 37 |
+
algorithms_selected.append("auto")
|
| 38 |
+
if st.sidebar.checkbox("ball_tree"):
|
| 39 |
+
algorithms_selected.append("ball_tree")
|
| 40 |
+
if st.sidebar.checkbox("kd_tree"):
|
| 41 |
+
algorithms_selected.append("kd_tree")
|
| 42 |
+
if st.sidebar.checkbox("brute"):
|
| 43 |
+
algorithms_selected.append("brute")
|
| 44 |
+
|
| 45 |
+
# KNN Metric
|
| 46 |
+
st.sidebar.subheader("KNN Metric")
|
| 47 |
+
metrics_selected = []
|
| 48 |
+
if st.sidebar.checkbox("euclidean", value=True):
|
| 49 |
+
metrics_selected.append("euclidean")
|
| 50 |
+
if st.sidebar.checkbox("manhattan"):
|
| 51 |
+
metrics_selected.append("manhattan")
|
| 52 |
+
if st.sidebar.checkbox("minkowski"):
|
| 53 |
+
metrics_selected.append("minkowski")
|
| 54 |
+
else:
|
| 55 |
+
neighbors = None
|
| 56 |
+
knn_weights = None
|
| 57 |
+
algorithms_selected = []
|
| 58 |
+
metrics_selected = []
|
| 59 |
|
| 60 |
# Generate dataset
|
| 61 |
if data_type == "Blobs":
|
|
|
|
| 127 |
ax.set_ylabel("Accuracy")
|
| 128 |
ax.legend()
|
| 129 |
st.pyplot(fig)
|
| 130 |
+
|