added create-dataset.sh

This commit is contained in:
s464962 2024-03-26 22:22:08 +01:00
parent b3728245af
commit 877ee10827

29
create-dataset.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
pip install kaggle
kaggle datasets download -d syedanwarafridi/vehicle-sales-data
unzip -o vehicle-sales-data.zip
# Tasowanie
shuf car_prices.csv -o car_prices_shuf.csv
# Podział danych na podzbiory
total_rows=$(wc -l < car_prices_shuf.csv)
test_dev_rows=$(( $1 * 2 ))
head -n $1 car_prices_shuf.csv > car_prices_test.csv
head -n $test_dev_rows car_prices_shuf.csv | tail -n +$(( $1 + 1 )) > car_prices_dev.csv
tail -n +$(( $test_dev_rows + 1 )) car_prices_shuf.csv > car_prices_train.csv
test_size=$(wc -l < car_prices_test.csv)
dev_size=$(wc -l < car_prices_dev.csv)
train_size=$(wc -l < car_prices_train.csv)
echo "Rozmiar zbioru testowego: $test_size"
echo "Rozmiar zbioru deweloperskiego: $dev_size"
echo "Rozmiar zbioru treningowego: $train_size"
# Zapis artefaktów
mkdir -p data
mv car_prices.csv car_prices_shuf.csv car_prices_test.csv car_prices_dev.csv car_prices_train.csv data/