Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
comp3217-lab2
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chauhan Chauhan
comp3217-lab2
Commits
136a8399
Commit
136a8399
authored
2 years ago
by
Chauhan Chauhan
Browse files
Options
Downloads
Patches
Plain Diff
Delete 3217-classification-lr-example1.py
parent
6e0645c2
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
3217-classification-lr-example1.py
+0
-43
0 additions, 43 deletions
3217-classification-lr-example1.py
with
0 additions
and
43 deletions
3217-classification-lr-example1.py
deleted
100644 → 0
+
0
−
43
View file @
6e0645c2
#Taken from Scikit
import
matplotlib.pyplot
as
plt
from
sklearn.linear_model
import
LogisticRegression
from
sklearn
import
datasets
from
sklearn.inspection
import
DecisionBoundaryDisplay
# import some data from a predefined datatset
iris
=
datasets
.
load_iris
()
X
=
iris
.
data
[:,
:
2
]
# we only take the first two features.
Y
=
iris
.
target
#print shape of the array for X and Y. Also get value of targets
print
(
X
.
shape
)
print
(
Y
)
print
(
Y
.
shape
)
# Create an instance of Logistic Regression Classifier and fit the data.
logreg
=
LogisticRegression
(
C
=
1
)
logreg
.
fit
(
X
,
Y
)
_
,
ax
=
plt
.
subplots
(
figsize
=
(
4
,
3
))
DecisionBoundaryDisplay
.
from_estimator
(
logreg
,
X
,
cmap
=
plt
.
cm
.
Paired
,
ax
=
ax
,
response_method
=
"
auto
"
,
plot_method
=
"
pcolormesh
"
,
shading
=
"
auto
"
,
xlabel
=
"
Sepal length
"
,
ylabel
=
"
Sepal width
"
,
eps
=
0.5
,
)
# Plot the training points
plt
.
scatter
(
X
[:,
0
],
X
[:,
1
],
c
=
Y
,
edgecolors
=
"
k
"
,
cmap
=
plt
.
cm
.
Paired
)
plt
.
xticks
(())
plt
.
yticks
(())
plt
.
show
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment