Tabular Regression
Scikit-learn
Joblib
Spanish
machine-learning
regression
linear-regression
educational-example
Instructions to use WalterWi/Sklearn_regresion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use WalterWi/Sklearn_regresion with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("WalterWi/Sklearn_regresion", "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
Download predict_hub.py from WalterWi/Sklearn_regresion: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/WalterWi/Sklearn_regresion/resolve/main/predict_hub.py
- Command line
-
hf download hf://WalterWi/Sklearn_regresion/predict_hub.py
-
curl -L -o predict_hub.py https://huggingface.co/WalterWi/Sklearn_regresion/resolve/main/predict_hub.py
950 Bytes
| """Descarga el modelo desde Hugging Face Hub y predice EN ESTA PC (o en el servidor donde corra). | |
| El modelo vive en el Hub; la inferencia la hace este código. | |
| Uso: | |
| python predict_hub.py tu-usuario/regresion-casas-sklearn | |
| """ | |
| import sys | |
| import joblib | |
| import pandas as pd | |
| from huggingface_hub import hf_hub_download | |
| REPO_ID = sys.argv[1] if len(sys.argv) > 1 else "TU-USUARIO/regresion-casas-sklearn" | |
| # 1. Bajar el archivo del modelo (la primera vez lo descarga; después usa la copia en caché) | |
| ruta = hf_hub_download(repo_id=REPO_ID, filename="model.joblib") | |
| print("Modelo descargado en:", ruta) | |
| # 2. Cargarlo y predecir, igual que con el archivo local | |
| modelo = joblib.load(ruta) | |
| casas_nuevas = pd.DataFrame({"m2": [50, 80, 110], "balcon": [0, 1, 1], "ascensor": [0, 0, 1]}) | |
| for casa, precio in zip(casas_nuevas.to_dict("records"), modelo.predict(casas_nuevas)): | |
| print(f"{casa} -> {precio:.1f} miles de US$") | |