Commit
Β·
669cedb
1
Parent(s):
6c5daeb
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,15 +47,12 @@ def visualize_input_data():
|
|
| 47 |
plt.axis("square")
|
| 48 |
plt.legend(handles=handles, labels=["outliers", "inliers"], title="true class")
|
| 49 |
plt.title("Gaussian inliers with \nuniformly distributed outliers")
|
| 50 |
-
# plt.show()
|
| 51 |
-
# plt.clear()
|
| 52 |
return fig
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
-
|
| 59 |
title = " An example using IsolationForest for anomaly detection."
|
| 60 |
description1 = "The isolation forest is an Ensemble of Isolation trees and it isolates the datapoints using recursive random partitioning."
|
| 61 |
description2 = "In case of outliers the number of splits required is greater than those required for inliers."
|
|
@@ -64,22 +61,26 @@ description3 = "We will use the toy dataset as given in the scikit-learn page fo
|
|
| 64 |
with gr.Blocks(title=title) as demo:
|
| 65 |
|
| 66 |
gr.Markdown(f"# {title}")
|
| 67 |
-
gr.Markdown(
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
gr.Markdown(" **https://scikit-learn.org/stable/auto_examples/ensemble/plot_isolation_forest.html#sphx-glr-auto-examples-ensemble-plot-isolation-forest-py**")
|
| 72 |
|
| 73 |
loaded_model = load_hf_model_hub()
|
| 74 |
|
| 75 |
-
with gr.Tab("Visualize Input dataset"):
|
| 76 |
btn = gr.Button(value="Visualize input dataset")
|
| 77 |
btn.click(visualize_input_data, outputs= gr.Plot(label='Visualizing input dataset') )
|
| 78 |
|
| 79 |
-
with gr.Tab("Plot Decision Boundary"):
|
| 80 |
image_decision = gr.Image('./downloaded-model/decision_boundary.png')
|
| 81 |
|
| 82 |
-
with gr.Tab("Plot Path"):
|
| 83 |
image_path = gr.Image('./downloaded-model/plot_path.png')
|
| 84 |
|
| 85 |
|
|
|
|
| 47 |
plt.axis("square")
|
| 48 |
plt.legend(handles=handles, labels=["outliers", "inliers"], title="true class")
|
| 49 |
plt.title("Gaussian inliers with \nuniformly distributed outliers")
|
|
|
|
|
|
|
| 50 |
return fig
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 56 |
title = " An example using IsolationForest for anomaly detection."
|
| 57 |
description1 = "The isolation forest is an Ensemble of Isolation trees and it isolates the datapoints using recursive random partitioning."
|
| 58 |
description2 = "In case of outliers the number of splits required is greater than those required for inliers."
|
|
|
|
| 61 |
with gr.Blocks(title=title) as demo:
|
| 62 |
|
| 63 |
gr.Markdown(f"# {title}")
|
| 64 |
+
gr.Markdown(
|
| 65 |
+
"""
|
| 66 |
+
The isolation forest is an Ensemble of Isolation trees and it isolates the data points using recursive random partitioning.
|
| 67 |
+
In case of outliers the number of splits required is greater than those required for inliers.
|
| 68 |
+
We will use the toy dataset for our educational demo as given in the scikit-learn page for Isolation Forest.
|
| 69 |
+
|
| 70 |
+
""")
|
| 71 |
|
| 72 |
gr.Markdown(" **https://scikit-learn.org/stable/auto_examples/ensemble/plot_isolation_forest.html#sphx-glr-auto-examples-ensemble-plot-isolation-forest-py**")
|
| 73 |
|
| 74 |
loaded_model = load_hf_model_hub()
|
| 75 |
|
| 76 |
+
with gr.Tab("# Visualize Input dataset"):
|
| 77 |
btn = gr.Button(value="Visualize input dataset")
|
| 78 |
btn.click(visualize_input_data, outputs= gr.Plot(label='Visualizing input dataset') )
|
| 79 |
|
| 80 |
+
with gr.Tab("# Plot Decision Boundary"):
|
| 81 |
image_decision = gr.Image('./downloaded-model/decision_boundary.png')
|
| 82 |
|
| 83 |
+
with gr.Tab("# Plot Path"):
|
| 84 |
image_path = gr.Image('./downloaded-model/plot_path.png')
|
| 85 |
|
| 86 |
|