Nightmare Classification
A machine learning pipeline that predicts whether a dream journal entry is a nightmare, on a dataset where only about 4% of dreams are actually labeled that way.
- Python
- Pandas
- Scikit-learn
- Jupyter
Overview
A CPSC 483 (Machine Learning) group project with Uzair Salema and Ahmad Zaidan: take a raw export of dream journal entries and predict whether each one describes a nightmare.
What was built
A full pipeline over 52,753 dream reports pulled from a public dream-search database: missing-value cleanup, text-derived features (word, character, and sentence counts), question-category encoding, correlation analysis, feature scaling, and PCA. Then four classifiers, Random Forest, Logistic Regression, KNN, and an RBF-kernel SVM, trained side by side on the same features to predict `Is_Nightmare`.
Results
Only 4.3% of the 39,690 labeled dreams are actually nightmares, so a model that guesses "no" every time already scores 95.7% accuracy, meaningless here. All four models trained with `class_weight='balanced'` and got scored on nightmare-class F1 instead of raw accuracy. Random Forest won, with a nightmare F1 of 0.60 (59% precision, 61% recall); the RBF-kernel SVM caught 100% of real nightmares but at the cost of near-random precision (8.6%).