File size: 2,157 Bytes
c745dff
 
 
 
 
 
9f92235
 
 
c745dff
 
 
 
 
 
 
90efbc3
 
 
 
 
 
bd5963b
c745dff
 
 
 
 
 
 
90efbc3
 
 
 
 
 
 
 
bd5963b
c745dff
 
 
 
705511a
9f92235
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pathlib import Path

import gradio as gr

BASE_DIR = Path(__file__).resolve().parent

# Expose both interface folders through Gradio's built-in static file route:
# /gradio_api/file=<relative_path>
gr.set_static_paths(paths=[str(BASE_DIR / "linear-regression"), str(BASE_DIR / "logistic-regression")])

with gr.Blocks(title="DDW Machine Learning") as demo:
    with gr.Row():
        gr.HTML(
            """
<div style="border:1px solid #ddd;border-radius:12px;padding:16px;">
  <h3>Linear Regression</h3>
  <p>Week10 interactive pages:</p>
  <ul>
    <li><strong>NumPy Matrix Lab:</strong> matrix operations, shape-aware input fields, generated NumPy code, and output visualization.</li>
    <li><strong>Gradient Descent Studio:</strong> one-feature linear regression optimization with step-level gradients, cost, and trajectory visualization.</li>
    <li><strong>Linear Regression Step Trainer:</strong> hand-calculation practice for gradients and one-step parameter updates with optional normalization.</li>
  </ul>
  <a href="/gradio_api/file=linear-regression/index.html" target="_blank" rel="noopener noreferrer">Open Linear Regression Interface</a>
</div>
"""
        )
        gr.HTML(
            """
<div style="border:1px solid #ddd;border-radius:12px;padding:16px;">
  <h3>Logistic Regression</h3>
  <p>Week11 interactive pages:</p>
  <ul>
    <li><strong>Simple Sigmoid:</strong> basic view of sigmoid output from a single z value.</li>
    <li><strong>Confusion Matrix Practice:</strong> threshold-based classification practice with confusion matrix and metrics.</li>
    <li><strong>Sigmoid Function:</strong> interactive plot for p = 1 / (1 + exp(-(b0 + b1x))) with parameter controls.</li>
    <li><strong>Cost Function Visualization:</strong> compare logistic-model cases and observe gradient-descent behavior on the cost surface.</li>
    <li><strong>Notes:</strong> supporting lecture notes and page context.</li>
  </ul>
  <a href="/gradio_api/file=logistic-regression/index.html" target="_blank" rel="noopener noreferrer">Open Logistic Regression Interface</a>
</div>
"""
        )

if __name__ == "__main__":
    demo.launch()