lucasomac's picture
Update README.md
6f18cf4 verified
|
Raw History Blame Contribute Delete
3.79 kB
metadata
license: mit
library_name: keras
pipeline_tag: tabular-classification
tags:
  - tabular-classification
  - binary-classification
  - keras
  - tensorflow
  - scikit-learn
  - mlp
  - missing-values
  - education
metrics:
  - accuracy
  - f1
model-index:
  - name: mlp-tabular-binary-classifier
    results:
      - task:
          type: tabular-classification
        dataset:
          name: base_classificacao_binaria (held-out test split)
          type: custom
        metrics:
          - type: accuracy
            value: 0.81

MLP tabular binary classifier (Keras)

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).

Model description

Architecture Dense(16, ReLU, L2 0.001) → Dense(8, ReLU, L2 0.001) → Dense(1, sigmoid)
Loss / optimizer Binary cross-entropy / Adam
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
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)
Output probability of the positive class; predicted class = probability ≥ 0.5

Intended use and limitations

This is an educational / portfolio model. It is not intended for real decisions.

  • 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).
  • 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.
  • Each variant was trained once and evaluated on one test split, so differences of about 1 percentage point are within sampling noise.

How to use

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.

import joblib
import keras
import pandas as pd
from huggingface_hub import hf_hub_download

repo = "lucasomac/mlp-tabular-binary-classifier"
model = keras.saving.load_model(hf_hub_download(repo, "model.keras"))
preprocessor = joblib.load(hf_hub_download(repo, "preprocessor.joblib"))

X_new = pd.DataFrame(...)          # same columns as the training features
proba = model.predict(preprocessor.transform(X_new)).ravel()
pred = (proba >= 0.5).astype(int)

Evaluation

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.

Version Change Accuracy (95% Wilson CI) Sensitivity Specificity F1
1.1 16-8-1, L2, StandardScaler, ordinal encoding 81.60% (79.8–83.2) 81.67% 81.53% 81.75%
1.2 one-hot encoding of environment 81.00% (79.2–82.7) 82.56% 79.41% 81.43%
1.3 RobustScaler 80.55% (78.8–82.2) 81.17% 79.92% 80.81%
1.4 64-32-16, BatchNorm, Dropout 0.2, swish (no L2) 81.30% (79.5–82.9) 80.77% 81.84% 81.34%