π§ Palmer Penguins Species Classifier
A lightweight, high-accuracy Machine Learning pipeline built with Scikit-Learn and deployed to predict the species of Antarctic penguins (AdΓ©lie, Chinstrap, or Gentoo) based on anatomical measurements and island habitat.
π Model Summary
- Model Type: Random Forest Classifier (
n_estimators=100) - Preprocessing: Median Imputation +
StandardScalerfor numeric features; Mode Imputation +OneHotEncoderfor categorical features wrapped inside a Scikit-LearnColumnTransformer&Pipeline. - Dataset: Palmer Archipelago (Antarctica) Penguin Dataset (344 samples).
- Test Accuracy: 100.0%
π― Input Features
| Feature | Type | Description |
|---|---|---|
island |
Categorical | Island where penguin was observed (Torgersen, Biscoe, Dream) |
bill_length_mm |
Float | Culmen length (mm) |
bill_depth_mm |
Float | Culmen depth (mm) |
flipper_length_mm |
Float | Flipper length (mm) |
body_mass_g |
Float | Body mass in grams |
sex |
Categorical | Biological sex (Male, Female) |
π How to Use
You can load and run inference with this model directly using joblib and huggingface_hub:
import joblib
import pandas as pd
from huggingface_hub import hf_hub_download
# Download artifacts from Hugging Face Hub
repo_id = "<YOUR_HF_USERNAME>/Penguins"
model_path = hf_hub_download(repo_id=repo_id, filename="artifacts/model_pipeline.joblib")
labels_path = hf_hub_download(repo_id=repo_id, filename="artifacts/labels.joblib")
# Load pipeline & labels
pipeline = joblib.load(model_path)
classes = joblib.load(labels_path)
# Sample penguin
sample_data = pd.DataFrame([{
"island": "Torgersen",
"bill_length_mm": 39.1,
"bill_depth_mm": 18.7,
"flipper_length_mm": 181.0,
"body_mass_g": 3750.0,
"sex": "Male"
}])
prediction = pipeline.predict(sample_data)[0]
print(f"Predicted Species: {prediction}")
π License
MIT License