ium_464913/download_dataset.sh
2024-03-24 11:31:18 +01:00

25 lines
673 B
Bash

#!/bin/bash
# Install the Kaggle API
pip install kaggle
# Download the dataset from Kaggle
kaggle datasets download -d mlg-ulb/creditcardfraud
# Unzip the dataset
unzip -o creditcardfraud.zip
# Remove the zip file
rm creditcardfraud.zip
# Shuffle the dataset
shuf creditcard.csv > creditcard_shuf.csv
# Remove the original dataset
rm creditcard.csv
# Split the dataset into training and testing
head -n 10000 creditcard_shuf.csv > creditcard_train.csv
tail -n +10001 creditcard_shuf.csv > creditcard_test.csv
# Create a directory for the data
mkdir -p data
# Move the datasets to the data directory
mv creditcard_shuf.csv creditcard_train.csv creditcard_test.csv data/