lucasomac commited on
Commit
238fea5
·
verified ·
1 Parent(s): dd41678

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md CHANGED
@@ -1,3 +1,83 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ library_name: keras
4
+ pipeline_tag: tabular-classification
5
+ tags:
6
+ - tabular-classification
7
+ - binary-classification
8
+ - keras
9
+ - tensorflow
10
+ - scikit-learn
11
+ - mlp
12
+ - missing-values
13
+ - education
14
+ metrics:
15
+ - accuracy
16
+ - f1
17
+ model-index:
18
+ - name: mlp-tabular-binary-classifier
19
+ results:
20
+ - task:
21
+ type: tabular-classification
22
+ dataset:
23
+ name: base_classificacao_binaria (held-out test split)
24
+ type: custom
25
+ metrics:
26
+ - type: accuracy
27
+ value: 0.816
28
  ---
29
+
30
+ # MLP tabular binary classifier (Keras)
31
+
32
+ A small Multilayer Perceptron (16-8-1) for binary classification of noisy tabular sensor data, trained with a leakage-safe preprocessing pipeline (per-column imputation + scaling fitted on the training split only). Built as part of an Artificial Intelligence course at UDESC (Brazil).
33
+
34
+ - **Code, notebooks and full write-up:** https://github.com/lucasomac0/ann-classification-machine-learning
35
+ - **Paper (SBC format, Portuguese):** `docs/relatorio.pdf` in the GitHub repository
36
+
37
+ ## Model description
38
+
39
+ | | |
40
+ |---|---|
41
+ | Architecture | Dense(16, ReLU, L2 0.001) → Dense(8, ReLU, L2 0.001) → Dense(1, sigmoid) |
42
+ | Loss / optimizer | Binary cross-entropy / Adam |
43
+ | Training | batch size 64, up to 100 epochs, early stopping on `val_loss` (patience 15, best weights restored), 20% of the training set held out for validation |
44
+ | Preprocessing | `ColumnTransformer`: mean / median / KNN (k=5) / mode imputation chosen per column, then `StandardScaler`; the categorical `environment` column is ordinal-encoded (cold=0, mild=1, hot=2) |
45
+ | Output | probability of the positive class; predicted class = probability ≥ 0.5 |
46
+
47
+ ## Intended use and limitations
48
+
49
+ This is an **educational / portfolio** model. It is not intended for real decisions.
50
+
51
+ - The dataset has 10,000 samples, 10 numeric features, 1 categorical feature, 4%–15% missing values per column and outliers. Feature-target linear correlations are weak (about 0.2–0.3 in absolute value).
52
+ - Accuracy is around 81% and did not improve with more capacity or different preprocessing (see below). The paper discusses this as consistent with an information limit in the features, but that is a hypothesis, not a proof.
53
+ - Each variant was trained once and evaluated on one test split, so differences of about 1 percentage point are within sampling noise.
54
+
55
+ ## How to use
56
+
57
+ The repository expects two files: the trained network (`model.keras`) and the fitted preprocessor (`preprocessor.joblib`). New data must have the same columns as the training data, with `environment` already ordinal-encoded.
58
+
59
+ ```python
60
+ import joblib
61
+ import keras
62
+ import pandas as pd
63
+ from huggingface_hub import hf_hub_download
64
+
65
+ repo = "lucasomac/mlp-tabular-binary-classifier"
66
+ model = keras.saving.load_model(hf_hub_download(repo, "model.keras"))
67
+ preprocessor = joblib.load(hf_hub_download(repo, "preprocessor.joblib"))
68
+
69
+ X_new = pd.DataFrame(...) # same columns as the training features
70
+ proba = model.predict(preprocessor.transform(X_new)).ravel()
71
+ pred = (proba >= 0.5).astype(int)
72
+ ```
73
+
74
+ ## Evaluation
75
+
76
+ Held-out test set: 2,000 samples (991 class 0, 1,009 class 1), stratified split, test set used only once for the final evaluation. Version 1.2 is the model published here.
77
+
78
+ | Version | Change | Accuracy (95% Wilson CI) | Sensitivity | Specificity | F1 |
79
+ |---|---|---|---|---|---|
80
+ | 1.1 | 16-8-1, L2, StandardScaler, ordinal encoding | 81.60% (79.8–83.2) | 81.67% | 81.53% | 81.75% |
81
+ | **1.2** | one-hot encoding of `environment` | **81.00%** (79.2–82.7) | 82.56% | 79.41% | 81.43% |
82
+ | 1.3 | RobustScaler | 80.55% (78.8–82.2) | 81.17% | 79.92% | 80.81% |
83
+ | 1.4 | 64-32-16, BatchNorm, Dropout 0.2, swish (no L2) | 81.30% (79.5–82.9) | 80.77% | 81.84% | 81.34% |