Skip to content

Fix perceptron interactive learning rate to use scatter - #727

Open
renzaoren666 wants to merge 1 commit into
microsoft:mainfrom
renzaoren666:fix/perceptron-scatter
Open

Fix perceptron interactive learning rate to use scatter#727
renzaoren666 wants to merge 1 commit into
microsoft:mainfrom
renzaoren666:fix/perceptron-scatter

Conversation

@renzaoren666

Copy link
Copy Markdown

Fix interactive learning rate code in Perceptron notebook

Fixes #726

Problem

In lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb, the interactive
learning rate experiment uses ax1.plot(...) with an s=100 argument:

ax1.plot(pos_examples[:, 0], pos_examples[:, 1], 'bo', label='Positive', s=100, alpha=0.6)
ax1.plot(neg_examples[:, 0], neg_examples[:, 1], 'ro', label='Negative', s=100, alpha=0.6)

matplotlib.pyplot.plot does not accept the s (marker size) parameter, which
belongs to scatter. This causes the interactive experiment to fail.

Fix

Replaced the plot calls with scatter, which properly supports s and draws
the positive/negative samples as a scatter plot:

ax1.scatter(pos_examples[:, 0], pos_examples[:, 1], color='blue', marker='o', s=100, alpha=0.6, label='Positive')
ax1.scatter(neg_examples[:, 0], neg_examples[:, 1], color='red', marker='o', s=100, alpha=0.6, label='Negative')

Files changed

  • lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Correction]: 感知机交互式学习率部分代码存在错误There are errors in the code for the interactive learning rate of the perceptron

1 participant