Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Classification Project

This project trains and evaluates classification models on four related datasets, automatically choosing an appropriate pipeline for high‑dimensional and low‑dimensional feature spaces.

Project Structure

  • 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.txtTrainData4.txt – training features.
    • TestData1.txtTestData4.txt – test features.
    • TrainLabel1.txtTrainLabel4.txt – training labels.
  • Output files (created by the script):
    • <LastName>Classification1.txt<LastName>Classification4.txt – predicted labels, one per line.

Data & Preprocessing

  • Input format
    • All .txt files are whitespace‑separated, with no header.
    • Each TrainData*.txt / TestData*.txt row is a feature vector for one sample.
    • Each TrainLabel*.txt row is the class label for the corresponding training sample.
  • Missing values
    • Very large values (greater than 1e98) are treated as missing.
    • Missing values are imputed using the median of each feature.

Model Pipelines

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:

  1. Load training and test data plus labels.
  2. Clean and preprocess features.
  3. Fit the appropriate pipeline.
  4. Predict labels for the test set.
  5. Save predictions to <LastName>Classification{dataset_id}.txt.

Requirements

  • Python 3.8+

Install dependencies with pip (from this directory):

pip install -r requirements.txt

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages