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.py from WalterWi/Sklearn_regresion: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/WalterWi/Sklearn_regresion/resolve/main/predict.py
- Command line
-
hf download hf://WalterWi/Sklearn_regresion/predict.py
-
curl -L -o predict.py https://huggingface.co/WalterWi/Sklearn_regresion/resolve/main/predict.py
583 Bytes
| """Carga model.joblib y predice el precio de casas nuevas. No vuelve a entrenar. | |
| Uso: | |
| python predict.py | |
| """ | |
| from pathlib import Path | |
| import joblib | |
| import pandas as pd | |
| CARPETA = Path(__file__).parent | |
| modelo = joblib.load(CARPETA / "model.joblib") | |
| # Las columnas tienen que llamarse igual que en el entrenamiento | |
| 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$") | |