File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 5
5
text_representation :
6
6
extension : .md
7
7
format_name : markdown
8
- format_version : ' 1.2 '
9
- jupytext_version : 1.4.2
8
+ format_version : ' 1.1 '
9
+ jupytext_version : 1.1.1
10
10
kernelspec :
11
11
display_name : Python 3
12
12
language : python
@@ -142,13 +142,15 @@ df.loc[samples.index, 'species'] = samples.values
142
142
# Define the inputs and outputs
143
143
X = df.drop(columns = [' species' , ' species_id' ])
144
144
y = df[' species' ]
145
- y_onehot = pd.get_dummies(y, columns = model.classes_)
146
145
147
146
# Fit the model
148
147
model = LogisticRegression(max_iter = 200 )
149
148
model.fit(X, y)
150
149
y_scores = model.predict_proba(X)
151
150
151
+ # One hot encode the labels in order to plot them
152
+ y_onehot = pd.get_dummies(y, columns = model.classes_)
153
+
152
154
# Create an empty figure, and iteratively add new lines
153
155
# every time we compute a new class
154
156
fig = go.Figure()
@@ -272,4 +274,4 @@ fig.show()
272
274
Learn more about ` px ` , ` px.area ` , ` px.hist ` :
273
275
* https://plot.ly/python/histograms/
274
276
* https://plot.ly/python/filled-area-plots/
275
- * https://plot.ly/python/line-charts/
277
+ * https://plot.ly/python/line-charts/
You can’t perform that action at this time.
0 commit comments