Instructions to use gusdelact/pastelerias-linear-regression with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use gusdelact/pastelerias-linear-regression with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("gusdelact/pastelerias-linear-regression", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Modelo LinearRegression v0.1.0
Browse files- README.md +84 -0
- metrics.json +11 -0
- model.joblib +3 -0
- model_info.json +30 -0
- train_metadata.json +23 -0
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: sklearn
|
| 4 |
+
pipeline_tag: tabular-regression
|
| 5 |
+
tags:
|
| 6 |
+
- linear-regression
|
| 7 |
+
- tabular
|
| 8 |
+
- regression
|
| 9 |
+
- pastelerias
|
| 10 |
+
- ventas
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# pastelerias-sales-predictor
|
| 14 |
+
|
| 15 |
+
## Información del Modelo
|
| 16 |
+
- **Tipo**: Regresión Lineal Múltiple (OLS)
|
| 17 |
+
- **Framework**: scikit-learn
|
| 18 |
+
- **Autor**: gusdelact
|
| 19 |
+
- **Fecha de entrenamiento**: 2026-06-24T22:00:39.750756
|
| 20 |
+
- **Formato**: joblib
|
| 21 |
+
|
| 22 |
+
## Uso Previsto
|
| 23 |
+
- **Tarea**: Regresión — predecir ventas mensuales de pastelerías
|
| 24 |
+
- **Variable target**: `Monthly sales`
|
| 25 |
+
- **Contexto**: Planificación de expansión de negocio de pastelerías
|
| 26 |
+
|
| 27 |
+
## Datos de Entrenamiento
|
| 28 |
+
- **Fuente**: [gusdelact/pasteleria](https://huggingface.co/datasets/gusdelact/pasteleria)
|
| 29 |
+
- **Dataset curado**: [gusdelact/pastelerias-curated](https://huggingface.co/datasets/gusdelact/pastelerias-curated)
|
| 30 |
+
- **Samples**: 10
|
| 31 |
+
- **Features**: 2
|
| 32 |
+
|
| 33 |
+
## Ecuación del Modelo
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
Monthly sales = 65.32
|
| 37 |
+
+ 41.51 × Floor space
|
| 38 |
+
- 0.3409 × Distance to station
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Métricas de Evaluación (Leave-One-Out CV, N=10)
|
| 42 |
+
|
| 43 |
+
| Métrica | Valor |
|
| 44 |
+
|---------|-------|
|
| 45 |
+
| RMSE | 27.02 |
|
| 46 |
+
| MAE | 22.26 |
|
| 47 |
+
| R² | 0.9042 |
|
| 48 |
+
|
| 49 |
+
**Umbral de aceptación**: RMSE ≤ 50 → ✅ Cumplido
|
| 50 |
+
|
| 51 |
+
## Cómo Usar
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import joblib
|
| 55 |
+
import pandas as pd
|
| 56 |
+
from huggingface_hub import hf_hub_download
|
| 57 |
+
|
| 58 |
+
# Descargar modelo
|
| 59 |
+
model_path = hf_hub_download("gusdelact/pastelerias-linear-regression", "model.joblib")
|
| 60 |
+
model = joblib.load(model_path)
|
| 61 |
+
|
| 62 |
+
# Predecir
|
| 63 |
+
X_new = pd.DataFrame({
|
| 64 |
+
"Floor space of the shop": [8],
|
| 65 |
+
"Distance to the nearest station": [150]
|
| 66 |
+
})
|
| 67 |
+
prediction = model.predict(X_new)
|
| 68 |
+
print(f"Ventas predichas: {prediction[0]:.0f} unidades/mes")
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Interpretación de Coeficientes
|
| 72 |
+
- **+1 unidad de Floor space** → +41.5 ventas/mes
|
| 73 |
+
- **+1 metro de distancia a estación** → -0.34 ventas/mes
|
| 74 |
+
- **Base (intercepto)**: 65.3 ventas/mes
|
| 75 |
+
|
| 76 |
+
## Limitaciones
|
| 77 |
+
- Entrenado con solo 10 observaciones — intervalos de confianza amplios
|
| 78 |
+
- Solo válido dentro del rango observado (Floor: 5-10, Distance: 0-330)
|
| 79 |
+
- No captura relaciones no lineales ni interacciones
|
| 80 |
+
- Datos de una región específica (Japón)
|
| 81 |
+
|
| 82 |
+
## Fundamento Teórico
|
| 83 |
+
Ver `notes/03_design_modeling.md` en el repositorio del proyecto para la fundamentación
|
| 84 |
+
completa con citas a ESL §3.2 (OLS), ISLP §5.1.4 (LOO-CV) y FES §3.4.1 (CV con N pequeño).
|
metrics.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"rmse_loo_cv": 27.016858562584517,
|
| 3 |
+
"mae_loo_cv": 22.25680200197573,
|
| 4 |
+
"r2_loo_cv": 0.9042106984038373,
|
| 5 |
+
"rmse_train": 20.42793704708016,
|
| 6 |
+
"r2_train": 0.945235852681711,
|
| 7 |
+
"rmse_threshold": 50.0,
|
| 8 |
+
"threshold_met": true,
|
| 9 |
+
"n_samples": 10,
|
| 10 |
+
"cv_method": "Leave-One-Out"
|
| 11 |
+
}
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8fea73435e71f3af3f103d732dc4e3166845d802ee0833449fe074be3da5dd5a
|
| 3 |
+
size 951
|
model_info.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "LinearRegression",
|
| 3 |
+
"framework": "scikit-learn",
|
| 4 |
+
"target": "Monthly sales",
|
| 5 |
+
"feature_order": [
|
| 6 |
+
"Floor space of the shop",
|
| 7 |
+
"Distance to the nearest station"
|
| 8 |
+
],
|
| 9 |
+
"intercept": 65.32391638894813,
|
| 10 |
+
"coefficients": {
|
| 11 |
+
"Floor space of the shop": 41.5134782564385,
|
| 12 |
+
"Distance to the nearest station": -0.3408826856636193
|
| 13 |
+
},
|
| 14 |
+
"metrics": {
|
| 15 |
+
"rmse_loo_cv": 27.016858562584517,
|
| 16 |
+
"r2_loo_cv": 0.9042106984038373
|
| 17 |
+
},
|
| 18 |
+
"input_ranges": {
|
| 19 |
+
"Floor space of the shop": {
|
| 20 |
+
"min": 5,
|
| 21 |
+
"max": 10,
|
| 22 |
+
"type": "int"
|
| 23 |
+
},
|
| 24 |
+
"Distance to the nearest station": {
|
| 25 |
+
"min": 0,
|
| 26 |
+
"max": 330,
|
| 27 |
+
"type": "int"
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
train_metadata.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "LinearRegression",
|
| 3 |
+
"framework": "scikit-learn",
|
| 4 |
+
"timestamp": "2026-06-24T22:00:39.750756",
|
| 5 |
+
"n_samples": 10,
|
| 6 |
+
"n_features": 2,
|
| 7 |
+
"features": [
|
| 8 |
+
"Floor space of the shop",
|
| 9 |
+
"Distance to the nearest station"
|
| 10 |
+
],
|
| 11 |
+
"target": "Monthly sales",
|
| 12 |
+
"params": {
|
| 13 |
+
"fit_intercept": true
|
| 14 |
+
},
|
| 15 |
+
"intercept": 65.32391638894813,
|
| 16 |
+
"coefficients": {
|
| 17 |
+
"Floor space of the shop": 41.5134782564385,
|
| 18 |
+
"Distance to the nearest station": -0.3408826856636193
|
| 19 |
+
},
|
| 20 |
+
"condition_index": 36.83804573206135,
|
| 21 |
+
"ols_r_squared": 0.945235852681711,
|
| 22 |
+
"ols_adj_r_squared": 0.929588953447914
|
| 23 |
+
}
|