Spaces:
Build error
Build error
Updated description and use slider as input
Browse files39 unmodified lines40414243444546474849505152535439 unmodified linestoc_bwd = time()selected_features = feature_names[sfs_backward.get_support()]execution_time = toc_bwd - tic_bwdreturn f"Selected the following features: {selected_features} in {execution_time:.3f} seconds"title = "Selecting features with Sequential Feature Selection"with gr.Blocks(title=title) as demo:gr.Markdown(f"## {title}")gr.Markdown("This app demonstrates feature selection techniques using model based selection and sequential feature selection. The app uses the diabetes dataset from sklearn. This app is developed based on [scikit-learn example](https://scikit-learn.org/stable/auto_examples/feature_selection/plot_select_from_model_diabetes.html#sphx-glr-auto-examples-feature-selection-plot-select-from-model-diabetes-py)")method = gr.Radio(["model", "sfs-forward", "sfs-backward"], label="Method")num_features = gr.Textbox(label="Number of features")output = gr.Textbox(label="Output Box")select_btn = gr.Button("Select")select_btn.click(fn=select_features, inputs=[method,num_features], outputs=output)39 unmodified lines4041424344454647484950515253545556575859606162636465666768697071727339 unmodified linestoc_bwd = time()selected_features = feature_names[sfs_backward.get_support()]execution_time = toc_bwd - tic_bwdreturn f"Selected the following features: {' '.join(selected_features)} in {execution_time:.3f} seconds"title = "Selecting features with Sequential Feature Selection"with gr.Blocks(title=title) as demo:gr.Markdown(f"## {title}")gr.Markdown("""This app demonstrates feature selection techniques using model based selection and sequential feature selection.\nModel based selection is based on feature importance. Each feature is assigned a score on how much influence theyhave on the model output.The feature with highest score is considered the most important feature.\nSequential feature selection is based on greedy approach. In greedy approach, the feature is added or removedto the selected features at each iteration based on the model performance score.\nThis app uses Ridge estimator and the diabetes dataset from sklearn. Diabetes dataset consist ofquantitative measure of diabetes progression and 10 following variables obtained from 442 diabetes patients:\n1. Age\n2. Sex\n3. Body mass index\n4. Average blood pressure\n5. Total serum cholesterol\n6. Low-density lipoproteins\n7. High-density lipoproteins\n8. Total cholesterol / HDL\n9. Possibly log of serum triglycerides level\n10. Blood sugar level\nThis app is developed based on [scikit-learn example](https://scikit-learn.org/stable/auto_examples/feature_selection/plot_select_from_model_diabetes.html#sphx-glr-auto-examples-feature-selection-plot-select-from-model-diabetes-py)""")method = gr.Radio(["model", "sfs-forward", "sfs-backward"], label="Method")num_features = gr.Slider(minimum=2, maximum=10, step=1, label = "Number of features")output = gr.Textbox(label="Output Box")select_btn = gr.Button("Select")select_btn.click(fn=select_features, inputs=[method,num_features], outputs=output)
app.py+22-3