Machine Learning Notebook
PassGuard Password Strength Classifier
A notebook-based machine learning project that classifies passwords into weak, medium, and strong classes using character-level TF-IDF features and model comparison.
Overview
Password text patterns as ML features
The notebook reads a two-column password dataset, cleans one missing password value, tokenizes each password into characters, and trains classifiers on TF-IDF vectors.
The project compares Logistic Regression, AdaBoost, and XGBoost using holdout evaluation plus 10-split cross-validation strategies.
Read `data.csv` with malformed lines skipped.
Represent passwords with character TF-IDF.
Evaluate three supervised classifiers.
Accuracy, precision, recall, F1, and CV stability.
Dataset
Two columns, three strength labels
The notebook reports `669,640` loaded rows, with `669,639` non-null password values and an integer `strength` target column.
After dropping the single null password, the dataset has no duplicate rows. The password length summary from the clean data has a mean of `9.99`, median of `9`, and max length of `220`.
Features
Character-level TF-IDF representation
The tokenizer in the notebook loops through each password and returns its characters. `TfidfVectorizer` then turns those character tokens into weighted sparse vectors.
A notebook sample prints `kino3434`, with non-zero TF-IDF weights for its character positions. The quick verification script reproduced the pipeline with `87` TF-IDF features on a stratified 50k-row sample.
def word(inputs):
a = []
for i in inputs:
a.append(i)
return a
Models
Three classifiers compared in the notebook
The notebook trains each model on the TF-IDF feature matrix after an 80/20 train/test split.
`max_iter=200` for cross-validation and `max_iter=1000` for final multinomial evaluation.
Evaluated in the notebook with cross-validation and final holdout metrics.
The strongest recorded model across holdout accuracy, precision, recall, and F1.
Validation
Cross-validation from the notebook
The notebook records both `ShuffleSplit(n_splits=10, test_size=0.2, random_state=42)` and `StratifiedKFold(n_splits=10, shuffle=True, random_state=42)`.
Results
Recorded final holdout performance
XGBoost is the strongest recorded model in the notebook, with holdout accuracy and weighted F1 both around 98%.
Contribution
Course project context
This project was completed as part of the Machine Learning course at UNICA, Università degli Studi di Cagliari.
The repository includes the notebook workflow, dataset, reproducibility setup, and static project showcase.
UNICA · Università degli Studi di Cagliari