Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def display_table(row_number):
|
|
19 |
X, y = diabetes.data, diabetes.target
|
20 |
XX = pd.concat([X, y], axis=1)
|
21 |
temp_df = XX[row_number : row_number + 15]
|
22 |
-
Statement = f"
|
23 |
return Statement, temp_df
|
24 |
|
25 |
|
@@ -153,7 +153,7 @@ def Plot_featue_importance(test_split):
|
|
153 |
except:
|
154 |
# return blank figures
|
155 |
fig = go.Figure()
|
156 |
-
fig.update_layout(title="Train
|
157 |
return fig, fig
|
158 |
|
159 |
sorted_idx = np.argsort(feature_importance)
|
@@ -190,12 +190,12 @@ def Plot_featue_importance(test_split):
|
|
190 |
with gr.Blocks() as demo:
|
191 |
gr.Markdown("# Gradient Boosting regression")
|
192 |
gr.Markdown(
|
193 |
-
"
|
194 |
)
|
195 |
|
196 |
with gr.Tab("Data"):
|
197 |
-
gr.Markdown("
|
198 |
-
gr.Markdown("###
|
199 |
gr.Markdown(
|
200 |
"The diabetes dataset consists of ten baseline variables, age, sex, body mass index (BMI), average blood pressure (BP), and six blood serum measurements for 442 diabetes patients. The target variable is a quantitative measure of disease progression one year after baseline."
|
201 |
)
|
@@ -207,12 +207,12 @@ with gr.Blocks() as demo:
|
|
207 |
rows_number.change(
|
208 |
fn=display_table,
|
209 |
inputs=[rows_number],
|
210 |
-
outputs=[gr.Text(label="
|
211 |
)
|
212 |
|
213 |
-
with gr.Tab("
|
214 |
gr.Markdown(
|
215 |
-
"# Play with the parameters to see how the model
|
216 |
)
|
217 |
|
218 |
gr.Markdown(
|
@@ -256,7 +256,7 @@ with gr.Blocks() as demo:
|
|
256 |
|
257 |
model_btn = gr.Button("Train Model")
|
258 |
gr.Markdown(
|
259 |
-
"### Finally, we will visualize the results. To do that we will first compute the test set deviance and then plot it against boosting iterations."
|
260 |
)
|
261 |
model_btn.click(
|
262 |
fn=train_model,
|
|
|
19 |
X, y = diabetes.data, diabetes.target
|
20 |
XX = pd.concat([X, y], axis=1)
|
21 |
temp_df = XX[row_number : row_number + 15]
|
22 |
+
Statement = f"Displaying rows from row {row_number} to {row_number+15}"
|
23 |
return Statement, temp_df
|
24 |
|
25 |
|
|
|
153 |
except:
|
154 |
# return blank figures
|
155 |
fig = go.Figure()
|
156 |
+
fig.update_layout(title="Train a model to see the plots")
|
157 |
return fig, fig
|
158 |
|
159 |
sorted_idx = np.argsort(feature_importance)
|
|
|
190 |
with gr.Blocks() as demo:
|
191 |
gr.Markdown("# Gradient Boosting regression")
|
192 |
gr.Markdown(
|
193 |
+
"This demo is based on [gradient boosting regression example of scikit-learn](https://scikit-learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_regression.html) Example.This example demonstrates gradient goosting to produce a predictive model from an ensemble of weak predictive models. Gradient boosting can be used for regression and classification problems. Here, we will train a model to tackle a diabetes regression task."
|
194 |
)
|
195 |
|
196 |
with gr.Tab("Data"):
|
197 |
+
gr.Markdown("### Below is the diabetes dataset used in this demo 👇 ")
|
198 |
+
gr.Markdown("### You can change the interval of rows to display.")
|
199 |
gr.Markdown(
|
200 |
"The diabetes dataset consists of ten baseline variables, age, sex, body mass index (BMI), average blood pressure (BP), and six blood serum measurements for 442 diabetes patients. The target variable is a quantitative measure of disease progression one year after baseline."
|
201 |
)
|
|
|
207 |
rows_number.change(
|
208 |
fn=display_table,
|
209 |
inputs=[rows_number],
|
210 |
+
outputs=[gr.Text(label="Row"), gr.DataFrame()],
|
211 |
)
|
212 |
|
213 |
+
with gr.Tab("Train the model"):
|
214 |
gr.Markdown(
|
215 |
+
"# Play with the parameters to see how the model performance changes"
|
216 |
)
|
217 |
|
218 |
gr.Markdown(
|
|
|
256 |
|
257 |
model_btn = gr.Button("Train Model")
|
258 |
gr.Markdown(
|
259 |
+
"### Finally, we will visualize the results. To do that, we will first compute the test set deviance and then plot it against boosting iterations."
|
260 |
)
|
261 |
model_btn.click(
|
262 |
fn=train_model,
|