Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Prinkey, David (S&T-Student)
Homework 2
Commits
d444ae56
Commit
d444ae56
authored
Jun 29, 2022
by
Prinkey, David (S&T-Student)
Browse files
Update train_test.py
parent
2c910f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
train_test.py
View file @
d444ae56
...
...
@@ -9,10 +9,10 @@ from sklearn.linear_model import LinearRegression
from
sklearn.model_selection
import
train_test_split
import
matplotlib.pyplot
as
plt
d
f
=
pd
.
read_csv
(
"forestfires.csv"
)
d
ata
=
pd
.
read_csv
(
"forestfires.csv"
)
x
=
d
f
.
drop
(
columns
=
[
'rain'
])
y
=
d
f
[[
'rain'
]]
x
=
d
ata
.
drop
(
columns
=
[
'rain'
])
y
=
d
ata
[[
'rain'
]]
x_train
,
x_test
,
y_train
,
y_test
,
=
train_test_split
(
x
,
y
,
test_size
=
0.5
,
random_state
=
0
)
...
...
@@ -30,8 +30,8 @@ plt.xlabel("rain")
plt
.
ylabel
(
"Freq"
)
plt
.
show
()
x
=
d
f
.
drop
(
columns
=
[
'DC'
])
y
=
d
f
[[
'DC'
]]
x
=
d
ata
.
drop
(
columns
=
[
'DC'
])
y
=
d
ata
[[
'DC'
]]
x_train
,
x_test
,
y_train
,
y_test
,
=
train_test_split
(
x
,
y
,
test_size
=
0.5
,
random_state
=
0
)
...
...
@@ -49,8 +49,8 @@ plt.xlabel("DC")
plt
.
ylabel
(
"Freq"
)
plt
.
show
()
x
=
d
f
.
drop
(
columns
=
[
'month'
])
y
=
d
f
[[
'month'
]]
x
=
d
ata
.
drop
(
columns
=
[
'month'
])
y
=
d
ata
[[
'month'
]]
x_train
,
x_test
,
y_train
,
y_test
,
=
train_test_split
(
x
,
y
,
test_size
=
0.5
,
random_state
=
0
)
...
...
@@ -67,18 +67,3 @@ plt.title("Month Test")
plt
.
xlabel
(
"Month"
)
plt
.
ylabel
(
"Freq"
)
plt
.
show
()
# In[ ]:
# In[ ]:
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment