Commit
·
a5bbc1e
1
Parent(s):
47fd88d
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def compare_lasso_sparse():
|
|
| 63 |
# compare the regression coefficients
|
| 64 |
coeff_diff = linalg.norm(sparse_lasso.coef_ - dense_lasso.coef_)
|
| 65 |
print(f"Distance between coefficients : {coeff_diff:.2e}")
|
| 66 |
-
return
|
| 67 |
|
| 68 |
|
| 69 |
X,X_sp,y = load_dataset()
|
|
@@ -87,9 +87,8 @@ and run the same comparisons as above. Because the data is now sparse,
|
|
| 87 |
we expect the implementation that uses the sparse data format to be faster.
|
| 88 |
'''
|
| 89 |
|
| 90 |
-
conclusion = '''**
|
| 91 |
-
the same results for dense and sparse data
|
| 92 |
-
and that in the case of sparse data the speed is improved**.
|
| 93 |
'''
|
| 94 |
with gr.Blocks() as demo:
|
| 95 |
gr.Markdown(f"# {title}")
|
|
|
|
| 63 |
# compare the regression coefficients
|
| 64 |
coeff_diff = linalg.norm(sparse_lasso.coef_ - dense_lasso.coef_)
|
| 65 |
print(f"Distance between coefficients : {coeff_diff:.2e}")
|
| 66 |
+
return f"Matrix density : {(Xs_sp.nnz / float(X.size) * 100):.3f}%\t\n"+ f"Sparse Lasso done in {(time() - t0):.3f}s\t\n" + f"Dense Lasso done in {(time() - t0):.3f}s\t\n" + f"Distance between coefficients : {coeff_diff:.2e}\t\n"
|
| 67 |
|
| 68 |
|
| 69 |
X,X_sp,y = load_dataset()
|
|
|
|
| 87 |
we expect the implementation that uses the sparse data format to be faster.
|
| 88 |
'''
|
| 89 |
|
| 90 |
+
conclusion = '''**Conclusion**
|
| 91 |
+
We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved**.
|
|
|
|
| 92 |
'''
|
| 93 |
with gr.Blocks() as demo:
|
| 94 |
gr.Markdown(f"# {title}")
|