Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hyunji
/
CapstoneDesign2021-1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Hyunji
2021-06-21 19:03:51 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
35e1c982696edf577da1e26bd4e33c20a86171f2
35e1c982
1 parent
3ea9badb
Split data set to train and test set
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
main/split_to_train_test.py
main/split_to_train_test.py
0 → 100644
View file @
35e1c98
# -*- coding: utf-8 -*-
"""split_to_train_test.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/16Rn0IDJTE6vJMOZtafDAI19AvGD9eK4C
"""
import
pandas
as
pd
from
sklearn.model_selection
import
train_test_split
dataset_url
=
'/content/drive/MyDrive/2d-slice-set-networks-for-brain-age-master/data/IXI0609.csv'
data
=
pd
.
read_csv
(
dataset_url
)
print
(
data
.
head
())
y
=
data
.
age_at_scan
X
=
data
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
test_size
=
0.3
)
print
(
"
\n
X_train:
\n
"
)
print
(
X_train
.
head
())
print
(
X_train
.
shape
)
X_train
.
to_csv
(
'/content/drive/MyDrive/2d-slice-set-networks-for-brain-age-master/data/train0609.csv'
,
index
=
False
)
print
(
"
\n
X_test:
\n
"
)
print
(
X_test
.
head
())
print
(
X_test
.
shape
)
X_test
.
to_csv
(
'/content/drive/MyDrive/2d-slice-set-networks-for-brain-age-master/data/test0609.csv'
,
index
=
False
)
\ No newline at end of file
Please
register
or
login
to post a comment