A simple project to train and evaluate two multilayer perceptron models on the Sonar data using TensorFlow, SciKeras, and Scikit-Learn — one without data standardization and another with standardized input data.
- Clone the repo
git clone https://github.com/yourusername/mlp-iris-classifier.git
cd mlp-sonar- Create a Conda enviornment
It is included an environment.yml for Conda users:
conda env create -f environment.yml
conda activate mlp-sonar- Verify the dataset
The Sonar Dataset from the UCI Machine Learning Repository is already included under data/sonar.csv.
- Adjust settings
Open config.yamland tweak any values you like (seed, test_size, units, etc.)
- Run the full pipeline
python run_all.pyThis will:
- Train de MLP without data standardization and with standardized input data
- Save the two mlp models to
modelsfolder - Evaluate and print train/test accuracy and sample predictions
mlp-iris-classifier/
│
├── config.yaml # Experiment settings
├── environment.yml # Conda environment spec
│
├── data/
│ └── sonar.csv # Sonar Dataset
│
├── models/ # (Auto-created) Trained model & params
│
├── src/
│ ├── config.py # Loads config.yaml
│ ├── data_loader.py # Reads & splits data
│ ├── model_builder.py # Defines the Keras MLP
│ ├── train.py # Hyperparameter search & model saving
│ └── evaluate.py # Loads model & prints metrics
│
└── run_all.py # Runs train.py then evaluate.py
- Python 3.7+
- numpy, scikt-learn, tensorflow, scikeras, joblib, PyYAML
With Conda:
conda env create -f environment.yml
conda activate mlp-sonar