Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .DS_Store +0 -0
- .gitignore +207 -0
- config.json +8 -0
- configuration_sm_subgroup_classifier.py +9 -0
- en_ID/metadata.pkl +3 -0
- en_ID/model.pkl +3 -0
- en_ID/scaler.pkl +3 -0
- en_ID/training_details.txt +39 -0
- en_NA-nb-OP/metadata.pkl +3 -0
- en_NA-nb-OP/model.pkl +3 -0
- en_NA-nb-OP/scaler.pkl +3 -0
- en_NA-nb-OP/training_details.txt +39 -0
- en_NA-nb/metadata.pkl +3 -0
- en_NA-nb/model.pkl +3 -0
- en_NA-nb/scaler.pkl +3 -0
- en_NA-nb/training_details.txt +39 -0
- example.py +15 -0
- fi_ID-NA/metadata.pkl +3 -0
- fi_ID-NA/model.pkl +3 -0
- fi_ID-NA/scaler.pkl +3 -0
- fi_ID-NA/training_details.txt +39 -0
- fi_ID/metadata.pkl +3 -0
- fi_ID/model.pkl +3 -0
- fi_ID/scaler.pkl +3 -0
- fi_ID/training_details.txt +39 -0
- fi_NA-nb-OP-rv/metadata.pkl +3 -0
- fi_NA-nb-OP-rv/model.pkl +3 -0
- fi_NA-nb-OP-rv/scaler.pkl +3 -0
- fi_NA-nb-OP-rv/training_details.txt +39 -0
- fi_NA-nb-OP/metadata.pkl +3 -0
- fi_NA-nb-OP/model.pkl +3 -0
- fi_NA-nb-OP/scaler.pkl +3 -0
- fi_NA-nb-OP/training_details.txt +39 -0
- fi_NA-nb/metadata.pkl +3 -0
- fi_NA-nb/model.pkl +3 -0
- fi_NA-nb/scaler.pkl +3 -0
- fi_NA-nb/training_details.txt +39 -0
- modeling_sm_subgroup_classifier.py +138 -0
- sv_HI-NA-nb-re/metadata.pkl +3 -0
- sv_HI-NA-nb-re/model.pkl +3 -0
- sv_HI-NA-nb-re/scaler.pkl +3 -0
- sv_HI-NA-nb-re/training_details.txt +39 -0
- sv_ID-NA-nb/metadata.pkl +3 -0
- sv_ID-NA-nb/model.pkl +3 -0
- sv_ID-NA-nb/scaler.pkl +3 -0
- sv_ID-NA-nb/training_details.txt +39 -0
- sv_ID/metadata.pkl +3 -0
- sv_ID/model.pkl +3 -0
- sv_ID/scaler.pkl +3 -0
- sv_ID/training_details.txt +39 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[codz]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
share/python-wheels/
|
| 24 |
+
*.egg-info/
|
| 25 |
+
.installed.cfg
|
| 26 |
+
*.egg
|
| 27 |
+
MANIFEST
|
| 28 |
+
|
| 29 |
+
# PyInstaller
|
| 30 |
+
# Usually these files are written by a python script from a template
|
| 31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 32 |
+
*.manifest
|
| 33 |
+
*.spec
|
| 34 |
+
|
| 35 |
+
# Installer logs
|
| 36 |
+
pip-log.txt
|
| 37 |
+
pip-delete-this-directory.txt
|
| 38 |
+
|
| 39 |
+
# Unit test / coverage reports
|
| 40 |
+
htmlcov/
|
| 41 |
+
.tox/
|
| 42 |
+
.nox/
|
| 43 |
+
.coverage
|
| 44 |
+
.coverage.*
|
| 45 |
+
.cache
|
| 46 |
+
nosetests.xml
|
| 47 |
+
coverage.xml
|
| 48 |
+
*.cover
|
| 49 |
+
*.py.cover
|
| 50 |
+
.hypothesis/
|
| 51 |
+
.pytest_cache/
|
| 52 |
+
cover/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
.pybuilder/
|
| 76 |
+
target/
|
| 77 |
+
|
| 78 |
+
# Jupyter Notebook
|
| 79 |
+
.ipynb_checkpoints
|
| 80 |
+
|
| 81 |
+
# IPython
|
| 82 |
+
profile_default/
|
| 83 |
+
ipython_config.py
|
| 84 |
+
|
| 85 |
+
# pyenv
|
| 86 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 88 |
+
# .python-version
|
| 89 |
+
|
| 90 |
+
# pipenv
|
| 91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 94 |
+
# install all needed dependencies.
|
| 95 |
+
#Pipfile.lock
|
| 96 |
+
|
| 97 |
+
# UV
|
| 98 |
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
| 99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 100 |
+
# commonly ignored for libraries.
|
| 101 |
+
#uv.lock
|
| 102 |
+
|
| 103 |
+
# poetry
|
| 104 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 105 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 106 |
+
# commonly ignored for libraries.
|
| 107 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 108 |
+
#poetry.lock
|
| 109 |
+
#poetry.toml
|
| 110 |
+
|
| 111 |
+
# pdm
|
| 112 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 113 |
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
| 114 |
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
| 115 |
+
#pdm.lock
|
| 116 |
+
#pdm.toml
|
| 117 |
+
.pdm-python
|
| 118 |
+
.pdm-build/
|
| 119 |
+
|
| 120 |
+
# pixi
|
| 121 |
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
| 122 |
+
#pixi.lock
|
| 123 |
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
| 124 |
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
| 125 |
+
.pixi
|
| 126 |
+
|
| 127 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 128 |
+
__pypackages__/
|
| 129 |
+
|
| 130 |
+
# Celery stuff
|
| 131 |
+
celerybeat-schedule
|
| 132 |
+
celerybeat.pid
|
| 133 |
+
|
| 134 |
+
# SageMath parsed files
|
| 135 |
+
*.sage.py
|
| 136 |
+
|
| 137 |
+
# Environments
|
| 138 |
+
.env
|
| 139 |
+
.envrc
|
| 140 |
+
.venv
|
| 141 |
+
env/
|
| 142 |
+
venv/
|
| 143 |
+
ENV/
|
| 144 |
+
env.bak/
|
| 145 |
+
venv.bak/
|
| 146 |
+
|
| 147 |
+
# Spyder project settings
|
| 148 |
+
.spyderproject
|
| 149 |
+
.spyproject
|
| 150 |
+
|
| 151 |
+
# Rope project settings
|
| 152 |
+
.ropeproject
|
| 153 |
+
|
| 154 |
+
# mkdocs documentation
|
| 155 |
+
/site
|
| 156 |
+
|
| 157 |
+
# mypy
|
| 158 |
+
.mypy_cache/
|
| 159 |
+
.dmypy.json
|
| 160 |
+
dmypy.json
|
| 161 |
+
|
| 162 |
+
# Pyre type checker
|
| 163 |
+
.pyre/
|
| 164 |
+
|
| 165 |
+
# pytype static type analyzer
|
| 166 |
+
.pytype/
|
| 167 |
+
|
| 168 |
+
# Cython debug symbols
|
| 169 |
+
cython_debug/
|
| 170 |
+
|
| 171 |
+
# PyCharm
|
| 172 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 173 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 174 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 175 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 176 |
+
#.idea/
|
| 177 |
+
|
| 178 |
+
# Abstra
|
| 179 |
+
# Abstra is an AI-powered process automation framework.
|
| 180 |
+
# Ignore directories containing user credentials, local state, and settings.
|
| 181 |
+
# Learn more at https://abstra.io/docs
|
| 182 |
+
.abstra/
|
| 183 |
+
|
| 184 |
+
# Visual Studio Code
|
| 185 |
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
| 186 |
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
| 187 |
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
| 188 |
+
# you could uncomment the following to ignore the entire vscode folder
|
| 189 |
+
# .vscode/
|
| 190 |
+
|
| 191 |
+
# Ruff stuff:
|
| 192 |
+
.ruff_cache/
|
| 193 |
+
|
| 194 |
+
# PyPI configuration file
|
| 195 |
+
.pypirc
|
| 196 |
+
|
| 197 |
+
# Cursor
|
| 198 |
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
| 199 |
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
| 200 |
+
# refer to https://docs.cursor.com/context/ignore-files
|
| 201 |
+
.cursorignore
|
| 202 |
+
.cursorindexingignore
|
| 203 |
+
|
| 204 |
+
# Marimo
|
| 205 |
+
marimo/_static/
|
| 206 |
+
marimo/_lsp/
|
| 207 |
+
__marimo__/
|
config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": ["SmSubgroupClassifier"],
|
| 3 |
+
"auto_map": {
|
| 4 |
+
"AutoConfig": "configuration_sm_subgroup_classifier.SmSubgroupClassifierConfig",
|
| 5 |
+
"AutoModel": "modeling_sm_subgroup_classifier.SmSubgroupClassifier"
|
| 6 |
+
},
|
| 7 |
+
"model_type": "sm_subgroup_classifier"
|
| 8 |
+
}
|
configuration_sm_subgroup_classifier.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class SmSubgroupClassifierConfig(PretrainedConfig):
|
| 5 |
+
model_type = "sm_subgroup_classifier"
|
| 6 |
+
|
| 7 |
+
def __init__(self, available_models=None, **kwargs):
|
| 8 |
+
super().__init__(**kwargs)
|
| 9 |
+
self.available_models = available_models or []
|
en_ID/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ca61fbfd1ba2ce417a30bde0d53adf2ffd1ea1a8c6186eff0149c770f001c10
|
| 3 |
+
size 62
|
en_ID/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:48dc684753e19792ce04cadeae9025441fc6507396eb93ab6dc740f87f1f3dad
|
| 3 |
+
size 9055
|
en_ID/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f230b5ecc0b0cf4a07aec1ab185ebea9060ea6eca6f7780119e9416ec15c0f1
|
| 3 |
+
size 25191
|
en_ID/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for en_ID
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: en
|
| 5 |
+
Register: ID
|
| 6 |
+
Training Date: 2025-09-26 14:09:04
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 41071
|
| 10 |
+
- Training samples: 32856
|
| 11 |
+
- Test samples: 8215
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: 'sports', ''
|
| 17 |
+
- Class distribution: {'sports': 983, '': 40088}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9984783931832014, 0.9987825292953888, 0.9975650585907777, 0.9989347131334653, 0.9981737939430833]
|
| 22 |
+
- CV mean: 0.9984
|
| 23 |
+
- CV std: 0.0005
|
| 24 |
+
- CV confidence interval: 0.9984 ± 0.0010
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9988
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
en_NA-nb-OP/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33039d60b51479962f055e496f8b49f16e8c9dd1d424896502d1fe6db7cb9005
|
| 3 |
+
size 84
|
en_NA-nb-OP/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f83d56eccb7a610a0b57baa16d63af8839c571455358919a4d892bcf581a66e
|
| 3 |
+
size 33671
|
en_NA-nb-OP/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85019b0b45399ef17ada3a02dbb3c77b0783fca6e0e18bd4e8e818e740f304c7
|
| 3 |
+
size 25191
|
en_NA-nb-OP/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for en_NA-nb-OP
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: en
|
| 5 |
+
Register: NA-nb-OP
|
| 6 |
+
Training Date: 2025-09-26 14:08:46
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 1536
|
| 10 |
+
- Training samples: 1228
|
| 11 |
+
- Test samples: 308
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 4
|
| 16 |
+
- Class names: '', 'culture', 'dining', 'lifestyle'
|
| 17 |
+
- Class distribution: {'': 747, 'culture': 327, 'dining': 172, 'lifestyle': 290}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9634146341463414, 0.959349593495935, 0.9634146341463414, 0.9877551020408163, 0.9755102040816327]
|
| 22 |
+
- CV mean: 0.9699
|
| 23 |
+
- CV std: 0.0104
|
| 24 |
+
- CV confidence interval: 0.9699 ± 0.0209
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9643
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
en_NA-nb/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:836ae4c831fe01dd10837795f65517e2768a1b1bd5364187226b09a39044826b
|
| 3 |
+
size 64
|
en_NA-nb/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97142d5962fb70803f26b449fa21ced30015b550de8604dc850ad50c07bee259
|
| 3 |
+
size 9055
|
en_NA-nb/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7423f9e8f84672e12ec4a45f5886d488146a6b5f20fc6a48db4977e89f663078
|
| 3 |
+
size 25191
|
en_NA-nb/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for en_NA-nb
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: en
|
| 5 |
+
Register: NA-nb
|
| 6 |
+
Training Date: 2025-09-26 14:08:58
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 49026
|
| 10 |
+
- Training samples: 39220
|
| 11 |
+
- Test samples: 9806
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: '', 'comments'
|
| 17 |
+
- Class distribution: {'': 46239, 'comments': 2787}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.989673635900051, 0.9886537480877103, 0.9903110657827638, 0.9899286078531362, 0.9903110657827638]
|
| 22 |
+
- CV mean: 0.9898
|
| 23 |
+
- CV std: 0.0006
|
| 24 |
+
- CV confidence interval: 0.9898 ± 0.0012
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9897
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
example.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from transformers import AutoModel
|
| 3 |
+
|
| 4 |
+
# Load sm_subgroup_classifier
|
| 5 |
+
sm_classifier = AutoModel.from_pretrained(
|
| 6 |
+
"erikhenriksson/sm-subgroup-classifier", trust_remote_code=True
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
# create a random 1024 dimensional embedding
|
| 10 |
+
embedding = np.random.rand(1024).astype(np.float32)
|
| 11 |
+
|
| 12 |
+
# Use - model automatically discovers what's available
|
| 13 |
+
result = sm_classifier("fi", "NA-nb", embedding)
|
| 14 |
+
|
| 15 |
+
print(result)
|
fi_ID-NA/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:836ae4c831fe01dd10837795f65517e2768a1b1bd5364187226b09a39044826b
|
| 3 |
+
size 64
|
fi_ID-NA/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91641ec86de57b7e5bc916dd05cad1bc6189dcd58a67f4f3cc8516af6ac5b228
|
| 3 |
+
size 9055
|
fi_ID-NA/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b61d42366ac1a5e42e2924c14aac56e71c18c92670fef5cef8072ae4698c0612
|
| 3 |
+
size 25191
|
fi_ID-NA/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for fi_ID-NA
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: fi
|
| 5 |
+
Register: ID-NA
|
| 6 |
+
Training Date: 2025-09-26 14:06:57
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 1729
|
| 10 |
+
- Training samples: 1383
|
| 11 |
+
- Test samples: 346
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: '', 'comments'
|
| 17 |
+
- Class distribution: {'': 389, 'comments': 1340}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9855595667870036, 0.9927797833935018, 0.9927797833935018, 0.9927536231884058, 0.9818840579710145]
|
| 22 |
+
- CV mean: 0.9892
|
| 23 |
+
- CV std: 0.0046
|
| 24 |
+
- CV confidence interval: 0.9892 ± 0.0092
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9913
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
fi_ID/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e193cf54249f175dabf353519ff468ff9b644e995a749d1abb9d45286eaa185b
|
| 3 |
+
size 62
|
fi_ID/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15dc245f640dd24687143cb21fdedf34968f9de671aec463f8bbc91bec7ea88f
|
| 3 |
+
size 9055
|
fi_ID/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ed4c1193f133be974168c0f1b02f520aa06f0e056b4f5dd7c8f952cc20a8675
|
| 3 |
+
size 25191
|
fi_ID/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for fi_ID
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: fi
|
| 5 |
+
Register: ID
|
| 6 |
+
Training Date: 2025-09-26 14:08:45
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 34973
|
| 10 |
+
- Training samples: 27978
|
| 11 |
+
- Test samples: 6995
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: '', 'sports'
|
| 17 |
+
- Class distribution: {'': 34495, 'sports': 478}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9980343102215868, 0.9987491065046462, 0.9992852037169406, 0.9987488829311886, 0.9978552278820375]
|
| 22 |
+
- CV mean: 0.9985
|
| 23 |
+
- CV std: 0.0005
|
| 24 |
+
- CV confidence interval: 0.9985 ± 0.0010
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9986
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
fi_NA-nb-OP-rv/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f1febda2186d53eefc99e24613b84c6746d3dfb4d9d938c736199e7a18c55884
|
| 3 |
+
size 91
|
fi_NA-nb-OP-rv/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83cfc695439d258effeb25e30a6677c1c0e18b8d07c3a4e1c36738eac4b800ac
|
| 3 |
+
size 33671
|
fi_NA-nb-OP-rv/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7694b06950c31c271c8d8c2a03bf252b1b59b2dae800bcfd6ff31c1b4f296919
|
| 3 |
+
size 25191
|
fi_NA-nb-OP-rv/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for fi_NA-nb-OP-rv
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: fi
|
| 5 |
+
Register: NA-nb-OP-rv
|
| 6 |
+
Training Date: 2025-09-26 14:06:58
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 4929
|
| 10 |
+
- Training samples: 3943
|
| 11 |
+
- Test samples: 986
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 4
|
| 16 |
+
- Class names: 'books', 'dining', 'beverages', 'cosmetics'
|
| 17 |
+
- Class distribution: {'books': 2958, 'dining': 294, 'beverages': 283, 'cosmetics': 1394}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9898605830164765, 0.9936628643852978, 0.9936628643852978, 0.9885786802030457, 0.9911167512690355]
|
| 22 |
+
- CV mean: 0.9914
|
| 23 |
+
- CV std: 0.0020
|
| 24 |
+
- CV confidence interval: 0.9914 ± 0.0041
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9899
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
fi_NA-nb-OP/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8181ed2154a1e738d8731ba8b6559a50b8d98ff39db75d319023ec18339569f3
|
| 3 |
+
size 77
|
fi_NA-nb-OP/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f00c094692e5bb83931d54deef16ef5f7b807f0537d15a1ed6345acab21e88f
|
| 3 |
+
size 25471
|
fi_NA-nb-OP/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5dac617f742be37b2fd9976ce2704013ecaa88a3eb69a0c6f1894edd5b2b6434
|
| 3 |
+
size 25191
|
fi_NA-nb-OP/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for fi_NA-nb-OP
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: fi
|
| 5 |
+
Register: NA-nb-OP
|
| 6 |
+
Training Date: 2025-09-26 14:06:57
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 1969
|
| 10 |
+
- Training samples: 1575
|
| 11 |
+
- Test samples: 394
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 3
|
| 16 |
+
- Class names: '', 'culture', 'consumption'
|
| 17 |
+
- Class distribution: {'': 874, 'culture': 695, 'consumption': 400}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9841269841269841, 0.9936507936507937, 0.9841269841269841, 0.9777777777777777, 0.9650793650793651]
|
| 22 |
+
- CV mean: 0.9810
|
| 23 |
+
- CV std: 0.0094
|
| 24 |
+
- CV confidence interval: 0.9810 ± 0.0188
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9848
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
fi_NA-nb/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:836ae4c831fe01dd10837795f65517e2768a1b1bd5364187226b09a39044826b
|
| 3 |
+
size 64
|
fi_NA-nb/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73957b464aecf86217f464d4db098528d7f7447904f721044e0a93987372e896
|
| 3 |
+
size 9055
|
fi_NA-nb/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ee14f4b973f3e012477bb168eb62930d29c713bd94ef1f4eccef46f3b32fcca
|
| 3 |
+
size 25191
|
fi_NA-nb/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for fi_NA-nb
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: fi
|
| 5 |
+
Register: NA-nb
|
| 6 |
+
Training Date: 2025-09-26 14:08:40
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 218088
|
| 10 |
+
- Training samples: 174470
|
| 11 |
+
- Test samples: 43618
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: '', 'comments'
|
| 17 |
+
- Class distribution: {'': 193558, 'comments': 24530}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9926061787126726, 0.9932939760417264, 0.9922622800481458, 0.9933512924858142, 0.992778128044936]
|
| 22 |
+
- CV mean: 0.9929
|
| 23 |
+
- CV std: 0.0004
|
| 24 |
+
- CV confidence interval: 0.9929 ± 0.0008
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9927
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
modeling_sm_subgroup_classifier.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pickle
|
| 3 |
+
|
| 4 |
+
import joblib
|
| 5 |
+
import torch
|
| 6 |
+
from transformers import PreTrainedModel
|
| 7 |
+
|
| 8 |
+
from .configuration_sm_subgroup_classifier import SmSubgroupClassifierConfig
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class SmSubgroupClassifier(PreTrainedModel):
|
| 12 |
+
config_class = SmSubgroupClassifierConfig
|
| 13 |
+
|
| 14 |
+
def __init__(self, config):
|
| 15 |
+
super().__init__(config)
|
| 16 |
+
self.config = config
|
| 17 |
+
self._loaded_classifiers = {}
|
| 18 |
+
self.model_dir = None
|
| 19 |
+
self._available_models = None
|
| 20 |
+
|
| 21 |
+
@property
|
| 22 |
+
def available_models(self):
|
| 23 |
+
"""Auto-discover available models"""
|
| 24 |
+
if self._available_models is None:
|
| 25 |
+
self._available_models = self._discover_available_models()
|
| 26 |
+
return self._available_models
|
| 27 |
+
|
| 28 |
+
def _discover_available_models(self):
|
| 29 |
+
"""Scan model directory for available models"""
|
| 30 |
+
if not self.model_dir or not os.path.exists(self.model_dir):
|
| 31 |
+
return []
|
| 32 |
+
|
| 33 |
+
models = []
|
| 34 |
+
for item in os.listdir(self.model_dir):
|
| 35 |
+
item_path = os.path.join(self.model_dir, item)
|
| 36 |
+
if os.path.isdir(item_path):
|
| 37 |
+
# Verify it's a valid model directory
|
| 38 |
+
required_files = ["model.pkl", "scaler.pkl", "metadata.pkl"]
|
| 39 |
+
if all(
|
| 40 |
+
os.path.exists(os.path.join(item_path, f)) for f in required_files
|
| 41 |
+
):
|
| 42 |
+
models.append(item)
|
| 43 |
+
|
| 44 |
+
return sorted(models)
|
| 45 |
+
|
| 46 |
+
def _load_classifier(self, model_key):
|
| 47 |
+
"""Load a specific classifier by model key (e.g., 'en_OP-ob')"""
|
| 48 |
+
if model_key in self._loaded_classifiers:
|
| 49 |
+
return self._loaded_classifiers[model_key]
|
| 50 |
+
|
| 51 |
+
if model_key not in self.available_models:
|
| 52 |
+
raise ValueError(
|
| 53 |
+
f"Model '{model_key}' not available. Available: {self.available_models}"
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
# Path to classifier
|
| 57 |
+
classifier_path = os.path.join(self.model_dir, model_key)
|
| 58 |
+
if not os.path.exists(classifier_path):
|
| 59 |
+
raise FileNotFoundError(f"Classifier not found at {classifier_path}")
|
| 60 |
+
|
| 61 |
+
# Load components
|
| 62 |
+
classifier = joblib.load(os.path.join(classifier_path, "model.pkl"))
|
| 63 |
+
scaler = joblib.load(os.path.join(classifier_path, "scaler.pkl"))
|
| 64 |
+
with open(os.path.join(classifier_path, "metadata.pkl"), "rb") as f:
|
| 65 |
+
metadata = pickle.load(f)
|
| 66 |
+
|
| 67 |
+
classifier_info = {
|
| 68 |
+
"classifier": classifier,
|
| 69 |
+
"scaler": scaler,
|
| 70 |
+
"class_names": metadata["class_names"],
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
self._loaded_classifiers[model_key] = classifier_info
|
| 74 |
+
return classifier_info
|
| 75 |
+
|
| 76 |
+
def forward(self, language, model_name, embeddings):
|
| 77 |
+
"""
|
| 78 |
+
Args:
|
| 79 |
+
language: Language code (en, fi, sv)
|
| 80 |
+
model_name: Model name (OP-ob, NA, etc.)
|
| 81 |
+
embeddings: Pre-computed embeddings
|
| 82 |
+
"""
|
| 83 |
+
# Create model key
|
| 84 |
+
model_key = f"{language}_{model_name}"
|
| 85 |
+
|
| 86 |
+
# Convert embeddings to numpy if needed
|
| 87 |
+
if torch.is_tensor(embeddings):
|
| 88 |
+
embeddings = embeddings.detach().cpu().numpy()
|
| 89 |
+
if embeddings.ndim == 1:
|
| 90 |
+
embeddings = embeddings.reshape(1, -1)
|
| 91 |
+
|
| 92 |
+
# Load classifier
|
| 93 |
+
classifier_info = self._load_classifier(model_key)
|
| 94 |
+
|
| 95 |
+
# Scale and predict
|
| 96 |
+
embeddings_scaled = classifier_info["scaler"].transform(embeddings)
|
| 97 |
+
predictions = classifier_info["classifier"].predict(embeddings_scaled)
|
| 98 |
+
probabilities = classifier_info["classifier"].predict_proba(embeddings_scaled)
|
| 99 |
+
|
| 100 |
+
# Format results - just use class names and probabilities
|
| 101 |
+
results = []
|
| 102 |
+
for pred, probs in zip(predictions, probabilities):
|
| 103 |
+
predicted_class_name = classifier_info["class_names"][pred]
|
| 104 |
+
# Get all class probabilities
|
| 105 |
+
all_probs = {
|
| 106 |
+
classifier_info["class_names"][i]: float(prob)
|
| 107 |
+
for i, prob in enumerate(probs)
|
| 108 |
+
}
|
| 109 |
+
results.append(
|
| 110 |
+
{
|
| 111 |
+
"label": predicted_class_name,
|
| 112 |
+
"probabilities": all_probs,
|
| 113 |
+
}
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
return results[0] if len(results) == 1 else results
|
| 117 |
+
|
| 118 |
+
@classmethod
|
| 119 |
+
def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
|
| 120 |
+
# Load config
|
| 121 |
+
config = SmSubgroupClassifierConfig.from_pretrained(
|
| 122 |
+
pretrained_model_name_or_path, **kwargs
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
# Create model instance (skip the pytorch weight loading)
|
| 126 |
+
model = cls(config)
|
| 127 |
+
|
| 128 |
+
# For HF Hub, we need to resolve to the actual cached directory
|
| 129 |
+
try:
|
| 130 |
+
from huggingface_hub import snapshot_download
|
| 131 |
+
|
| 132 |
+
# Download/get the cached directory path
|
| 133 |
+
model.model_dir = snapshot_download(pretrained_model_name_or_path)
|
| 134 |
+
except ImportError:
|
| 135 |
+
# Fallback if huggingface_hub not available
|
| 136 |
+
model.model_dir = pretrained_model_name_or_path
|
| 137 |
+
|
| 138 |
+
return model
|
sv_HI-NA-nb-re/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a0f52bdc3d0252e9176382affb050c74fa24ed744785573a67ae28cdb9d785f
|
| 3 |
+
size 62
|
sv_HI-NA-nb-re/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:45b36afa0b2d6b74474f7ec1ae3779322e637f64af1bfe522083fe356a22a194
|
| 3 |
+
size 9055
|
sv_HI-NA-nb-re/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7732e98d25e09a32de626c8996637f3e844deb95f1495a77e72cd6cc957da2f4
|
| 3 |
+
size 25191
|
sv_HI-NA-nb-re/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for sv_HI-NA-nb-re
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: sv
|
| 5 |
+
Register: HI-NA-nb-re
|
| 6 |
+
Training Date: 2025-09-26 14:05:16
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 6804
|
| 10 |
+
- Training samples: 5443
|
| 11 |
+
- Test samples: 1361
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: 'crafts', ''
|
| 17 |
+
- Class distribution: {'crafts': 135, '': 6669}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9963269054178145, 0.9963269054178145, 0.9972451790633609, 0.9944852941176471, 0.9954044117647058]
|
| 22 |
+
- CV mean: 0.9960
|
| 23 |
+
- CV std: 0.0009
|
| 24 |
+
- CV confidence interval: 0.9960 ± 0.0019
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9956
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
sv_ID-NA-nb/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:836ae4c831fe01dd10837795f65517e2768a1b1bd5364187226b09a39044826b
|
| 3 |
+
size 64
|
sv_ID-NA-nb/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3e6a7f1c0e31e315d84e43bc75299c48fe02215b7def50de7fc350316f807cb
|
| 3 |
+
size 9055
|
sv_ID-NA-nb/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c0321f17c25e743d5a5318c5011f9b6bdbe864aa683f9ff00d7bc2a6efc28cbb
|
| 3 |
+
size 25191
|
sv_ID-NA-nb/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for sv_ID-NA-nb
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: sv
|
| 5 |
+
Register: ID-NA-nb
|
| 6 |
+
Training Date: 2025-09-26 14:05:20
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 1189
|
| 10 |
+
- Training samples: 951
|
| 11 |
+
- Test samples: 238
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 2
|
| 16 |
+
- Class names: '', 'comments'
|
| 17 |
+
- Class distribution: {'': 852, 'comments': 337}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9214659685863874, 0.9526315789473684, 0.9315789473684211, 0.968421052631579, 0.9263157894736842]
|
| 22 |
+
- CV mean: 0.9401
|
| 23 |
+
- CV std: 0.0177
|
| 24 |
+
- CV confidence interval: 0.9401 ± 0.0354
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9706
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|
sv_ID/metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21413604878beb792fbc2f549db7a71b67cfaaca8200989e74e5df69a0e6c7b1
|
| 3 |
+
size 69
|
sv_ID/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f22126201e503512b9bbf51ed4c310d6e59ae89dd12e37835154c15a382d2612
|
| 3 |
+
size 25471
|
sv_ID/scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f5634d9ac1f9b6a3d8e303ca1a929f6ade9ac33f1acdf697ae765a60646fd66
|
| 3 |
+
size 25191
|
sv_ID/training_details.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Training Details for sv_ID
|
| 2 |
+
========================================
|
| 3 |
+
|
| 4 |
+
Language: sv
|
| 5 |
+
Register: ID
|
| 6 |
+
Training Date: 2025-09-26 14:06:57
|
| 7 |
+
|
| 8 |
+
Data Summary:
|
| 9 |
+
- Total samples: 15060
|
| 10 |
+
- Training samples: 12048
|
| 11 |
+
- Test samples: 3012
|
| 12 |
+
- Embedding dimension: 1024
|
| 13 |
+
|
| 14 |
+
Classes:
|
| 15 |
+
- Number of classes: 3
|
| 16 |
+
- Class names: '', 'sports', 'help'
|
| 17 |
+
- Class distribution: {'': 14108, 'sports': 542, 'help': 410}
|
| 18 |
+
|
| 19 |
+
Cross-Validation Results:
|
| 20 |
+
- CV folds: 5
|
| 21 |
+
- CV scores: [0.9962655601659751, 0.9954356846473029, 0.9983402489626556, 1.0, 0.9991697799916978]
|
| 22 |
+
- CV mean: 0.9978
|
| 23 |
+
- CV std: 0.0017
|
| 24 |
+
- CV confidence interval: 0.9978 ± 0.0035
|
| 25 |
+
|
| 26 |
+
Final Performance:
|
| 27 |
+
- Test accuracy: 0.9977
|
| 28 |
+
|
| 29 |
+
Model Configuration:
|
| 30 |
+
- Algorithm: Logistic Regression
|
| 31 |
+
- Regularization (C): 1.0
|
| 32 |
+
- Feature scaling: StandardScaler
|
| 33 |
+
- Random state: 42
|
| 34 |
+
|
| 35 |
+
Files:
|
| 36 |
+
- Classifier: model.pkl
|
| 37 |
+
- Scaler: scaler.pkl
|
| 38 |
+
- Metadata: metadata.pkl
|
| 39 |
+
- This file: training_details.txt
|