16 lines
508 B
Bash
16 lines
508 B
Bash
#!/bin/bash
|
|
|
|
# download data from kaggle
|
|
kaggle datasets download -d nikhil7280/student-performance-multiple-linear-regression --unzip
|
|
|
|
# change dataset name to data.csv
|
|
mv Student_Performance.csv data.csv
|
|
# cut off rows
|
|
head -n "$2" data.csv > data.csv.tmp && mv data.csv.tmp data.csv
|
|
|
|
# get data size
|
|
data_size=$(wc -l < data.csv)
|
|
|
|
# split data to train and test and save it to csv files
|
|
head -n $(( $data_size * $1/100 )) data.csv > train.csv
|
|
tail -n $(( $data_size * ( 1 - $1/100 ) )) data.csv > test.csv |