Instructions to use hsilvosa/openplacsp-cpv-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use hsilvosa/openplacsp-cpv-classifier with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("hsilvosa/openplacsp-cpv-classifier", "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
| language: | |
| - es | |
| license: apache-2.0 | |
| datasets: | |
| - hsilvosa/openplacsp | |
| library_name: sklearn | |
| pipeline_tag: text-classification | |
| tags: | |
| - public-procurement | |
| - cpv | |
| - multilabel-classification | |
| # Multilabel CPV division classifier for Spanish public procurement | |
| A lightweight model that suggests CPV divisions from a procurement notice title, project | |
| name, and summary. It combines word- and character-level TF-IDF features with 45 linear | |
| logistic classifiers. Version 2 calibrates probabilities and learns a separate decision | |
| threshold for each division. | |
| It was trained from the | |
| [hsilvosa/openplacsp](https://huggingface.co/datasets/hsilvosa/openplacsp). | |
| ## Temporal evaluation | |
| Training uses notices published through 2022. The year 2023 is reserved for calibration | |
| and threshold selection, while 2024 remains a held-out test set. | |
| | 2024 test metric | Base model | Version 2 | | |
| |---|---:|---:| | |
| | Recall@3 | 0.9140 | 0.9214 | | |
| | Micro-F1 | 0.5808 | 0.7276 | | |
| | Macro-F1 | 0.4803 | 0.6180 | | |
| | Brier score (lower is better) | 0.0277 | 0.0105 | | |
| | Non-empty multilabel coverage | 0.9933 | 0.8897 | | |
| The model was trained on 606,309 notices with fixed seed | |
| 20260817. Per-division metrics and checksums are available in `metrics.json`. | |
| ## Usage | |
| ```python | |
| from inference import CPVDivisionClassifier | |
| model = CPVDivisionClassifier("model.joblib") | |
| print(model.predict(["Mantenimiento y desarrollo de aplicaciones municipales"])) | |
| ``` | |
| The optional skops export is unavailable; see `safe_export_error` in metrics.json. | |
| ## Limitations | |
| The model learns from Spanish administrative text published on the national public | |
| procurement platform through December 2024. It does not replace the legally assigned CPV | |
| classification. Rare divisions carry greater uncertainty. It must not be used to infer | |
| fraud, illegality, or responsibility. | |