File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 55 text_representation :
66 extension : .md
77 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
1010 kernelspec :
1111 display_name : Python 3
1212 language : python
@@ -142,13 +142,15 @@ df.loc[samples.index, 'species'] = samples.values
142142# Define the inputs and outputs
143143X = df.drop(columns = [' species' , ' species_id' ])
144144y = df[' species' ]
145- y_onehot = pd.get_dummies(y, columns = model.classes_)
146145
147146# Fit the model
148147model = LogisticRegression(max_iter = 200 )
149148model.fit(X, y)
150149y_scores = model.predict_proba(X)
151150
151+ # One hot encode the labels in order to plot them
152+ y_onehot = pd.get_dummies(y, columns = model.classes_)
153+
152154# Create an empty figure, and iteratively add new lines
153155# every time we compute a new class
154156fig = go.Figure()
@@ -272,4 +274,4 @@ fig.show()
272274Learn more about ` px ` , ` px.area ` , ` px.hist ` :
273275* https://plot.ly/python/histograms/
274276* 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