Spaces:
Runtime error
Runtime error
include ccp_alpha hyper-parameter in advance features (#1)
Browse files- include ccp_alpha hyper-parameter in advance features (6573d9d346b0612fb6321b19d700f1ead92de09d)
Co-authored-by: Gourav Sharma <[email protected]>
app.py
CHANGED
@@ -105,6 +105,14 @@ if toggle:
|
|
105 |
min_value=0.0,
|
106 |
help="""A node will be split if this split induces a decrease of the
|
107 |
impurity greater than or equal to this value.""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
train = st.sidebar.button("Train Model", type="primary")
|
109 |
if st.sidebar.button("Reset"):
|
110 |
st.experimental_rerun()
|
@@ -120,7 +128,8 @@ if train:
|
|
120 |
max_features=max_features,
|
121 |
random_state=random_state,
|
122 |
max_leaf_nodes=max_leaf_nodes,
|
123 |
-
min_impurity_decrease=min_impurity_decrease
|
|
|
124 |
clf.fit(x_train[:, :2], y_train)
|
125 |
x_pred = clf.predict(x_train[:,:2])
|
126 |
y_pred = clf.predict(x_test[:, :2])
|
|
|
105 |
min_value=0.0,
|
106 |
help="""A node will be split if this split induces a decrease of the
|
107 |
impurity greater than or equal to this value.""")
|
108 |
+
ccp_alpha = st.sidebar.number_input("ccp_alpha",
|
109 |
+
min_value=0,
|
110 |
+
max_value=30,
|
111 |
+
step=0.1,
|
112 |
+
value=0,
|
113 |
+
help="""Complexity parameter used for Minimal Cost-Complexity Pruning.
|
114 |
+
The subtree with the largest cost complexity that is smaller than ccp_alpha will be chosen.
|
115 |
+
By default, no pruning is performed.""")
|
116 |
train = st.sidebar.button("Train Model", type="primary")
|
117 |
if st.sidebar.button("Reset"):
|
118 |
st.experimental_rerun()
|
|
|
128 |
max_features=max_features,
|
129 |
random_state=random_state,
|
130 |
max_leaf_nodes=max_leaf_nodes,
|
131 |
+
min_impurity_decrease=min_impurity_decrease,
|
132 |
+
ccp_alpha = ccp_alpha)
|
133 |
clf.fit(x_train[:, :2], y_train)
|
134 |
x_pred = clf.predict(x_train[:,:2])
|
135 |
y_pred = clf.predict(x_test[:, :2])
|