Spaces:
Sleeping
Sleeping
Update Home.py
Browse files
Home.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
-
import sklearn
|
| 4 |
from sklearn.datasets import load_iris
|
| 5 |
from sklearn.model_selection import train_test_split
|
| 6 |
from sklearn.preprocessing import StandardScaler, OneHotEncoder
|
|
@@ -93,7 +92,7 @@ def main():
|
|
| 93 |
y = iris.target.reshape(-1, 1) # shape (150, 1)
|
| 94 |
|
| 95 |
# One-hot encode target
|
| 96 |
-
encoder = OneHotEncoder(
|
| 97 |
y_encoded = encoder.fit_transform(y) # shape (150, 3)
|
| 98 |
|
| 99 |
# Split data
|
|
@@ -188,5 +187,5 @@ def main():
|
|
| 188 |
st.write(f"#### Test Loss: {loss:.4f}")
|
| 189 |
st.write(f"#### Test Accuracy: {acc:.4f}")
|
| 190 |
|
| 191 |
-
if
|
| 192 |
-
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
|
|
|
| 3 |
from sklearn.datasets import load_iris
|
| 4 |
from sklearn.model_selection import train_test_split
|
| 5 |
from sklearn.preprocessing import StandardScaler, OneHotEncoder
|
|
|
|
| 92 |
y = iris.target.reshape(-1, 1) # shape (150, 1)
|
| 93 |
|
| 94 |
# One-hot encode target
|
| 95 |
+
encoder = OneHotEncoder(sparse_output=False)
|
| 96 |
y_encoded = encoder.fit_transform(y) # shape (150, 3)
|
| 97 |
|
| 98 |
# Split data
|
|
|
|
| 187 |
st.write(f"#### Test Loss: {loss:.4f}")
|
| 188 |
st.write(f"#### Test Accuracy: {acc:.4f}")
|
| 189 |
|
| 190 |
+
if __name__ == "__main__":
|
| 191 |
+
main()
|