IUM_s464980/download_dataset.sh

17 lines
540 B
Bash

#!/bin/bash
# download data from kaggle
kaggle datasets download -p "https://www.kaggle.com/datasets/nikhil7280/student-performance-multiple-linear-regression/code" --unzip
# change dataset name to data.csv
mv Student_Performance.csv data.csv
# cut off rows
head -n "$1" 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 )) data.csv > train.csv
tail -n $(( $data_size * ( 1 - $1 ) )) data.csv > test.csv