test
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def make_plot(n_samples, n_features, n_tasks, n_relevant_features, alpha, progre
|
|
| 25 |
coef_lasso_ = np.array([Lasso(alpha=0.5).fit(X, y).coef_ for y in Y.T])
|
| 26 |
coef_multi_task_lasso_ = MultiTaskLasso(alpha=alpha).fit(X, Y).coef_
|
| 27 |
|
| 28 |
-
fig = plt.figure(figsize=(
|
| 29 |
|
| 30 |
feature_to_plot = 0
|
| 31 |
fig = plt.figure()
|
|
@@ -51,20 +51,21 @@ def make_plot(n_samples, n_features, n_tasks, n_relevant_features, alpha, progre
|
|
| 51 |
|
| 52 |
model_card = f"""
|
| 53 |
## Description
|
| 54 |
-
Multi-task Lasso allows us to jointly fit multiple regression problems by enforcing the selected features to be the same across tasks. This example simulates sequential measurement.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
## Model
|
| 58 |
currentmodule: sklearn.linear_model
|
| 59 |
class:`Lasso` and class: `MultiTaskLasso` are used in this example.
|
| 60 |
Plots represent Lasso, MultiTaskLasso and Ground truth time series
|
| 61 |
"""
|
| 62 |
|
| 63 |
-
|
| 64 |
-
secondary_hue=gr.themes.colors.
|
| 65 |
-
text_size=gr.themes.sizes.text_lg)
|
| 66 |
-
|
| 67 |
-
|
|
|
|
| 68 |
gr.Markdown('''
|
| 69 |
<div>
|
| 70 |
<h1 style='text-align: center'> Joint feature selection with multi-task Lasso </h1>
|
|
|
|
| 25 |
coef_lasso_ = np.array([Lasso(alpha=0.5).fit(X, y).coef_ for y in Y.T])
|
| 26 |
coef_multi_task_lasso_ = MultiTaskLasso(alpha=alpha).fit(X, Y).coef_
|
| 27 |
|
| 28 |
+
fig = plt.figure(figsize=(16, 20))
|
| 29 |
|
| 30 |
feature_to_plot = 0
|
| 31 |
fig = plt.figure()
|
|
|
|
| 51 |
|
| 52 |
model_card = f"""
|
| 53 |
## Description
|
| 54 |
+
Multi-task Lasso allows us to jointly fit multiple regression problems by enforcing the selected features to be the same across tasks. This example simulates sequential measurement. Each task
|
| 55 |
+
is a time instant, and the relevant features, while being the same, vary in amplitude over time. Multi-task lasso imposes that features that are selected at one time point are selected
|
| 56 |
+
for all time points. This makes feature selection more stable than by regular Lasso.
|
| 57 |
## Model
|
| 58 |
currentmodule: sklearn.linear_model
|
| 59 |
class:`Lasso` and class: `MultiTaskLasso` are used in this example.
|
| 60 |
Plots represent Lasso, MultiTaskLasso and Ground truth time series
|
| 61 |
"""
|
| 62 |
|
| 63 |
+
theme = gr.themes.Glass(primary_hue=gr.themes.colors.gray,
|
| 64 |
+
secondary_hue=gr.themes.colors.sky,
|
| 65 |
+
text_size=gr.themes.sizes.text_lg).set(slider_color="#b2dcf3")
|
| 66 |
+
|
| 67 |
+
with gr.Blocks(theme=theme) as demo:
|
| 68 |
+
|
| 69 |
gr.Markdown('''
|
| 70 |
<div>
|
| 71 |
<h1 style='text-align: center'> Joint feature selection with multi-task Lasso </h1>
|