This project trains and evaluates classification models on four related datasets, automatically choosing an appropriate pipeline for high‑dimensional and low‑dimensional feature spaces.
classification.py– main script:- loads data for each dataset,
- cleans and preprocesses features,
- builds and trains models,
- writes prediction files.
classification/(subdirectory expected by the script):TrainData1.txt…TrainData4.txt– training features.TestData1.txt…TestData4.txt– test features.TrainLabel1.txt…TrainLabel4.txt– training labels.
- Output files (created by the script):
<LastName>Classification1.txt…<LastName>Classification4.txt– predicted labels, one per line.
- Input format
- All
.txtfiles are whitespace‑separated, with no header. - Each
TrainData*.txt/TestData*.txtrow is a feature vector for one sample. - Each
TrainLabel*.txtrow is the class label for the corresponding training sample.
- All
- Missing values
- Very large values (greater than
1e98) are treated as missing. - Missing values are imputed using the median of each feature.
- Very large values (greater than
classification.py defines configurations for four datasets:
- Datasets 1 and 2:
high_dim = True - Datasets 3 and 4:
high_dim = False
Based on high_dim, different pipelines are used:
- High‑dimensional datasets
SimpleImputer(strategy="median")StandardScaler()PCA(n_components=0.95)– reduce dimensionality while preserving ~95% variance.SVC(kernel="linear", random_state=42)– linear Support Vector Classifier.
- Low‑dimensional datasets
SimpleImputer(strategy="median")StandardScaler()RandomForestClassifier(n_estimators=100, random_state=42)
For each dataset:
- Load training and test data plus labels.
- Clean and preprocess features.
- Fit the appropriate pipeline.
- Predict labels for the test set.
- Save predictions to
<LastName>Classification{dataset_id}.txt.
- Python 3.8+
Install dependencies with pip (from this directory):
pip install -r requirements.txt