Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,75 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
-
from sklearn.datasets import make_circles,make_moons
|
| 4 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
+
from sklearn.datasets import make_circles,make_moons,make_blobs
|
| 4 |
+
from sklearn.preprocessing import StandardScaler
|
| 5 |
+
from sklearn.model_selection import train_test_split
|
| 6 |
+
from tensorflow import keras
|
| 7 |
+
import matplotlib.pyplot as plt
|
| 8 |
+
import seaborn as sns
|
| 9 |
+
from keras.models import Sequential
|
| 10 |
+
from keras.layers import InputLayer,Dense,Dropout
|
| 11 |
+
from keras.losses import MeanAbsoluteError,MeanSquaredError
|
| 12 |
+
from keras.optimizers import SGD
|
| 13 |
+
from keras.regularizers import l1,l1,l1_l2
|
| 14 |
+
|
| 15 |
+
from mlxtend.plotting import plot_decision_regions
|
| 16 |
+
|
| 17 |
+
st.title("TensorFlow Playground")
|
| 18 |
+
|
| 19 |
+
with st.sidebar:
|
| 20 |
+
st.header("Choose Dataset")
|
| 21 |
+
dataset = st.selectbox("Select Dataset",["Blobs","Circles","Moons"])
|
| 22 |
+
# on = st.toggle("Upload Dataset(.csv file)")
|
| 23 |
+
# if on:
|
| 24 |
+
# st.write("**Note:** Only 2 features are allowed.")
|
| 25 |
+
# up_file = st.file_uploader("Upload Dataset (.csv or .xlsx)", type=["csv"])
|
| 26 |
+
|
| 27 |
+
noise = st.slider("Noise",0.0,1.0,0.1)
|
| 28 |
+
test_size = st.slider("Test Size",0.1,0.5,0.05)
|
| 29 |
+
|
| 30 |
+
st.header("ANN Hyperparameters")
|
| 31 |
+
hl = st.number_input("Hidden Layers",0,10,1,value=2)
|
| 32 |
+
numbers = st.text_input("Neurons for each hidden layer" ,placeholder="provide comma seperated e.g. 8,16,32")
|
| 33 |
+
input_func = lambda x: [int(i.strip()) for i in x.split(",") if i.strip() != ""]
|
| 34 |
+
nn = input_func(numbers)
|
| 35 |
+
epochs=st.number_input("Epochs",1,10000,1,value=10)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
col1, col2 = st.column(2)
|
| 40 |
+
|
| 41 |
+
with col1:
|
| 42 |
+
af = st.selectbox("Activation Function",["Sigmoid","Tanh","Relu"])
|
| 43 |
+
with col2:
|
| 44 |
+
lr = st.selectbox("Learning Rate".[0.1,0.01,0.02,0.2])
|
| 45 |
+
|
| 46 |
+
# col3,col4 = st.column(2)
|
| 47 |
+
|
| 48 |
+
# with col3:
|
| 49 |
+
reg = st.selectbox("Regularizer", ["None", "L1", "L2","ElasticNet"])
|
| 50 |
+
if reg != "None":
|
| 51 |
+
reg_rate = st.slider("Regularization rate", 0.0, 0.1, 0.01, 0.01)
|
| 52 |
+
# with col4:
|
| 53 |
+
es = st.selectbox("Early Stopping",["No","Yes"],index=0)
|
| 54 |
+
if es == "Yes":
|
| 55 |
+
col3, col4 = st.columns(2)
|
| 56 |
+
with col3:
|
| 57 |
+
min_delta = st.number_input(0.001,0.9,0.1,value=0.001)
|
| 58 |
+
)
|
| 59 |
+
with col4:
|
| 60 |
+
patience = min_delta = st.number_input(3,20,0.1,value=3)
|
| 61 |
+
)
|
| 62 |
+
if st.sidebar.button("start trainning"):
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|