Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Petra
DM_course
Commits
587976fb
Commit
587976fb
authored
Dec 19, 2019
by
Petra
Browse files
how adding noisy examples changes the decision boundary of KNN
parent
06879e16
Changes
1
Hide whitespace changes
Inline
Side-by-side
3_decision_boundary.py
View file @
587976fb
...
...
@@ -24,9 +24,13 @@ print("Features: ", feature_cols, "\nTarget:", target_var)
print
(
""" --- Train-test split ---"""
)
# 900 examples in test set, 100 examples in train set
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
test_size
=
900
,
random_state
=
2
)
h
=
.
001
# step size in the mesh
# adding one noisy example
#X_train = np.vstack((X_train, [0.25, 0.75]))
#y_train = np.append(y_train, y_train[0])
h
=
.
001
# step size in the mesh
# Create color maps
cmap_light
=
ListedColormap
([
'orange'
,
'cyan'
,
'cornflowerblue'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment