Downloads · 30 days
0
food-ai-nexus/soil-listeria-baseline
soil-listeria-baseline is a tabular classification model from food-ai-nexus. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
A LightGBM binary classifier that predicts Listeria presence in soil samples from geochemical, environmental, and land-use features. This is the official baseline model for the soil-listeria-us-land leaderboard.
Downloads · 30 days
0
Access
Public
Updated Mar 28, 2026
Repo size
334 KB
Likes
0
Public
Click a slice to open those files.
.joblib334 KB · 94%
From the Hugging Face model README
A LightGBM binary classifier that predicts Listeria presence in soil samples from geochemical, environmental, and land-use features. This is the official baseline model for the soil-listeria-us-land leaderboard.
| Property | Value |
|---|---|
| Algorithm | LightGBM (LGBMClassifier) |
| Task | Binary classification — Listeria detected (1) vs. not detected (0) |
| Dataset | food-ai-nexus/soil-listeria-us-land |
| Input features | Soil geochemistry, climate, and land-use variables |
| Engineered features | cn_ratio (total carbon / total nitrogen), temperature_range (max - min temperature) |
| Decision threshold | 0.36 (tuned on out-of-fold predictions) |
The dataset originates from a US-wide soil survey linking soil properties to Listeria isolation. Positive labels correspond to samples where at least one Listeria isolate was recovered.
Feature engineering — Two domain-motivated features are added:
cn_ratio = total_carbon_pct / total_nitrogen_pct (with inf/NaN handling via median imputation)temperature_range = max_temperature_c - min_temperature_cHyperparameter search — RandomizedSearchCV (100 iterations) over both
XGBoost and LightGBM, scored by F1, using 5-fold stratified CV
(random_state=42).
Model selection — The model with the highest mean CV F1 is selected.
Threshold tuning — Out-of-fold predicted probabilities from the best model are used to sweep thresholds from 0.30 to 0.70 (step 0.01), maximizing F1.
Final retraining — The selected model is retrained on the full training set with the best hyperparameters.
| Parameter | Value |
|---|---|
boosting_type | gbdt |
n_estimators | 417 |
max_depth | 6 |
num_leaves | 31 |
learning_rate | 0.0543 |
subsample | 0.9369 |
colsample_bytree | 0.6407 |
min_child_samples | 15 |
reg_alpha | 0.8059 |
reg_lambda | 0.0557 |
| Model | Mean F1 | Std F1 |
|---|---|---|
| LightGBM | 0.8749 | 0.0321 |
| XGBoost | 0.8714 | 0.0109 |
| Metric | Value |
|---|---|
| Threshold | 0.36 |
| F1 (OOF) | 0.8769 |
| Rank | Feature | Importance |
|---|---|---|
| 1 | sodium_mg_kg | 266 |
| 2 | copper_mg_kg | 183 |
| 3 | moisture | 153 |
| 4 | molybdenum_mg_kg | 150 |
| 5 | zinc_mg_kg | 131 |
| 6 | cropland_pct | 122 |
| 7 | magnesium_mg_kg | 118 |
| 8 | phosphorus_mg_kg | 109 |
| 9 | cn_ratio | 100 |
| 10 | manganese_mg_kg | 95 |
# Clone the model repository
git clone https://huggingface.co/food-ai-nexus/soil-listeria-baseline
cd soil-listeria-baseline
# Install dependencies
pip install -r requirements.txt
# Run training (requires the dataset repo as a sibling directory)
python train.py
The training script expects the dataset at
../soil-listeria-us-land/data/{train,test}-00000-of-00001.parquet. You can
obtain it from:
git clone https://huggingface.co/datasets/food-ai-nexus/soil-listeria-us-land
import joblib
import numpy as np
model = joblib.load("model/model.joblib")
THRESHOLD = 0.36
# X_new: pandas DataFrame with the same feature columns as training data
probas = model.predict_proba(X_new)[:, 1]
predictions = (probas >= THRESHOLD).astype(int)
If you use this model or dataset, please cite the original study:
Liao, J., Wiedmann, M., & Bhatt, V. (2021). Nationwide genomic atlas of soil-associated Listeria reveals effects of selection and population ecology on pangenome evolution. Nature Microbiology, 6, 1021--1030.
@article{liao2021nationwide,
title={Nationwide genomic atlas of soil-associated {Listeria} reveals effects
of selection and population ecology on pangenome evolution},
author={Liao, Jingqiu and Wiedmann, Martin and Bhatt, Vipul},
journal={Nature Microbiology},
volume={6},
pages={1021--1030},
year={2021},
publisher={Nature Publishing Group}
}