DanOPT commited on
Commit ·
bc7a1f8
1
Parent(s): b0b4225
Added link to blog article
Browse files
app.py
CHANGED
|
@@ -127,8 +127,12 @@ def run_perceptron(w0, w1, w2, learning_rate, max_epochs):
|
|
| 127 |
|
| 128 |
# Final summary
|
| 129 |
summary = f"Final weights: {w_final}\nConverged in {epochs} epochs"
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
# Gradio Interface
|
| 134 |
iface = gr.Interface(
|
|
@@ -143,7 +147,8 @@ iface = gr.Interface(
|
|
| 143 |
outputs=[
|
| 144 |
gr.Image(type="filepath", label="Results"),
|
| 145 |
gr.Textbox(label="Summary"),
|
| 146 |
-
gr.Textbox(label="Detailed Weight History", lines=10)
|
|
|
|
| 147 |
],
|
| 148 |
title="Perceptron Learning for OR Operator",
|
| 149 |
description="Adjust the initial weights, learning rate, and maximum epochs to see how the perceptron learns the OR operator. You can download the graph or view it in fullscreen mode."
|
|
|
|
| 127 |
|
| 128 |
# Final summary
|
| 129 |
summary = f"Final weights: {w_final}\nConverged in {epochs} epochs"
|
| 130 |
+
|
| 131 |
+
# Link to article
|
| 132 |
+
link_article = "Read more about how to apply the learning algorithm to a perceptron here: "
|
| 133 |
+
link_article += "https://danopt.substack.com/p/applying-and-visualizing-the-learning"
|
| 134 |
+
|
| 135 |
+
return fig_path, summary, weight_history_str, link_article
|
| 136 |
|
| 137 |
# Gradio Interface
|
| 138 |
iface = gr.Interface(
|
|
|
|
| 147 |
outputs=[
|
| 148 |
gr.Image(type="filepath", label="Results"),
|
| 149 |
gr.Textbox(label="Summary"),
|
| 150 |
+
gr.Textbox(label="Detailed Weight History", lines=10),
|
| 151 |
+
gr.Markdown(label="Info")
|
| 152 |
],
|
| 153 |
title="Perceptron Learning for OR Operator",
|
| 154 |
description="Adjust the initial weights, learning rate, and maximum epochs to see how the perceptron learns the OR operator. You can download the graph or view it in fullscreen mode."
|