Three machine-learning problems — classification, regression and unsupervised — each solved in Python with scikit-learn and cross-validated against an equivalent run in WEKA (point 4 of the assignment). Different algorithm families are used for classification and regression, as required (point 5).
| # | Problem | Dataset | Algorithms | Notebook |
|---|---|---|---|---|
| 1 | Classification | Acoustic Emotion (speech → mood, 10 classes) | LogReg, Naïve Bayes, KNN, Decision Tree, MLP | 01_classification_emotion.ipynb |
| 2 | Regression | California Housing (median house value) | Linear regression (SGD), KNN, Decision Tree | 02_regression_california_housing.ipynb |
| 3 | Unsupervised | (coming) | Clustering / PCA | 03_unsupervised_*.ipynb |
.
├── datasets/
│ ├── mood_detection_data_realistic.csv # classification source
│ └── california_housing.csv # regression source
├── notebooks/
│ ├── 01_classification_emotion.ipynb
│ └── 02_regression_california_housing.ipynb
├── weka-files/
│ ├── dataset_esame.arff # generated by notebook 1
│ ├── california_housing.arff # generated by notebook 2
│ ├── run_weka.sh # classification, 5 models
│ └── run_weka_regression.sh # regression, 3 models
├── requirements.txt
├── LICENSE
└── README.md
Sources: classification — Acoustic-Emotion-Vocal-Signature;
regression — California Housing (1990 US Census, public domain, via sklearn.datasets).
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
jupyter notebookRun a notebook top-to-bottom (Restart & Run All); the final cells regenerate the .arff file
used for the WEKA comparison.
Predict a speaker's emotional state (Mood, 10 balanced classes) from acoustic voice features
(pitch, jitter, shimmer, speech rate, MFCCs). MFCCs are parsed into 13 columns; features are
selected by mutual information. Five classifiers run in a pipeline
(undersampling → standardization → model) on a stratified 80/20 holdout. Metrics: Accuracy,
weighted F1, weighted ROC AUC.
Mood encoding (alphabetical): 0 Angry · 1 Bored · 2 Calm · 3 Confused · 4 Excited · 5 Fearful ·
6 Happy · 7 Neutral · 8 Sad · 9 Surprised.
Predict the median house value (MedHouseVal) from 8 numeric district features. Features are
selected by mutual information; three regressors run in a pipeline (MinMaxScaler → model) on
an 80/20 holdout. Metrics: R², MAE, RMSE.
SGDRegressor= linear regression by gradient descent (not the closed-form OLS).MinMaxScaler(not standardization): California has extreme outliers that make the SGD gradient diverge; bounding features to [0, 1] keeps it stable — and matches WEKA's internal SGD scaling.- The target is right-censored at 5.0 ($500k); kept as-is (standard use of this dataset).
Reproduce in WEKA the same protocol as each notebook (80/20 holdout, seed 1, feature scaling) and compare the metrics. Install WEKA from https://www.cs.waikato.ac.nz/ml/weka/ (needs Java).
The CLI scripts are reproducible (no GUI clicking) and auto-detect weka.jar:
weka-files/run_weka.sh # classification (5 models)
weka-files/run_weka_regression.sh # regression (3 models)
# or: WEKA_JAR=/path/to/weka.jar weka-files/run_weka.shEach script wraps the model in FilteredClassifier with a scaling filter (so the filter is fit on
the training split only — no leakage, like a scikit-learn Pipeline), runs an 80/20 split, and
prints the metrics. Paste the values into the weka_results dictionary in the matching notebook to
build the comparison table and charts.
Classification — filter unsupervised.attribute.Standardize (z-score, like StandardScaler —
not supervised.attribute.Discretize). Model mapping:
| scikit-learn | WEKA |
|---|---|
| LogisticRegression | functions.Logistic |
| NaïveBayes | bayes.NaiveBayes |
| KNN | lazy.IBk -K 5 |
| DecisionTree | trees.J48 (C4.5 ≈ CART) |
| MLP | functions.MultilayerPerceptron |
Metrics: Accuracy = Correctly Classified Instances % ÷ 100 · F1 = Weighted Avg. F-Measure · ROC AUC = Weighted Avg. ROC Area.
Regression — filter unsupervised.attribute.Normalize ([0,1], like MinMaxScaler). Model
mapping: functions.SGD -F 2 (linear, squared loss), lazy.IBk -K 5, trees.REPTree. Metrics:
R² = (Correlation coefficient)² · MAE = Mean absolute error · RMSE = Root mean squared error.
functions.LinearRegressionis avoided on the CLI: it needs the MTJ matrix package, not on the bare classpath.functions.SGDis the gradient-descent linear model and matchesSGDRegressor.
See LICENSE.