marik0 commited on
Commit
2beae27
·
1 Parent(s): aa2f7bf

Add details to description and plot

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -54,6 +54,9 @@ def train_plot(multi_class, num_samples):
54
  for i, color in zip(clf.classes_, colors):
55
  plot_hyperplane(i, color)
56
 
 
 
 
57
  return fig, clf.score(X, y)
58
 
59
  def plot_both(num_samples):
@@ -62,8 +65,21 @@ def plot_both(num_samples):
62
 
63
  return fig1, fig2, score1, score2
64
 
65
- title = "Plot multinomial and One-vs-Rest Logistic Regression "
66
- description = "Plot decision surface of multinomial and One-vs-Rest Logistic Regression. The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers are represented by the dashed lines."
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  with gr.Blocks() as demo:
68
  gr.Markdown(f"## {title}")
69
  gr.Markdown(description)
 
54
  for i, color in zip(clf.classes_, colors):
55
  plot_hyperplane(i, color)
56
 
57
+ plt.xlabel("x")
58
+ plt.ylabel("y")
59
+
60
  return fig, clf.score(X, y)
61
 
62
  def plot_both(num_samples):
 
65
 
66
  return fig1, fig2, score1, score2
67
 
68
+ title = "Plot multinomial and One-vs-Rest Logistic Regression"
69
+ description = """
70
+ The demo shows the difference between multinomial and One-vs-Rest Logistic Regression in a \
71
+ two-dimensional synthetic dataset.
72
+
73
+ The dataset is generated around three cluster centers to simulate three different classes. \
74
+ Two different types of logistic regression models are fit to the synthetic data: a multinomial \
75
+ and a one-vs-rest logistic regression. The figures show scatter plots of the data, the decision \
76
+ boundaries of each logistic regresion model and the decision surfaces in different colors per respective class. \
77
+ The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers are represented by the \
78
+ dashed lines. \
79
+
80
+
81
+ The mean accuracy of the training data and labels for each classifier is given underneath each respective plot.
82
+ """
83
  with gr.Blocks() as demo:
84
  gr.Markdown(f"## {title}")
85
  gr.Markdown(description)