Matrix Regression
Multi-label text classification algorithm for online learning.
Description
Implementation of the MatrixRegression (MR) algorithm for multi-label text classification that can be used in an online learning context. It is presented in the following paper:
Abstract:
In this paper, we propose a new classification method that addresses classification in multiple categories of textual documents. We call it Matrix Regression (MR) due to its resemblance to regression in a high dimensional space. Experiences on a medical corpus of hospital records to be classified by ICD (International Classification of Diseases) code demonstrate the validity of the MR approach. We compared MR with three frequently used algorithms in text categorization that are k-Nearest Neighbors, Centroide and Support Vector Machine. The experimental results show that our method outperforms them in both precision and time of classification.
Installation
Via PyPi using pip, as easy as:
pip install matrixreg
Usage
from matrixreg import MatrixRegression
mr = MatrixRegression()
# Fit
mr.fit(X_train, y_train)
# Predict
mr.predict(X_test)
# Partial fit
mr.partial_fit(new_X, new_y)
Parameters optimization
This implementation is scikit-friendly; thus, it supports GridSearchCV.
# Parameter to optimize
param_grid = [{"threshold": [0.3, 0.6, 0.9]}]
# Initialization
mr = MatrixRegression()
clf = GridSearchCV(mr, param_grid, cv=5, verbose=10, n_jobs=-1, scoring='f1_micro')
# Fit
clf.fit(X_train, y_train)
# Results
clf.best_params_, clf.best_score_
Author
Nicolò Verardo
Metadata
Release files for matrixreg 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| matrixreg-0.3.0.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matrixreg-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / matrixreg-0.3.0.tar.gz
| Download URL | matrixreg-0.3.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74e0ae1c90d6d9adc5d6fa2b7e7429c8afcc7864efcad2e06dc0aad0741f2ae0
|
|
BLAKE2b-256 checksum How to use checksums |
61ce1b1549369643bf5751af7b05014c965b8c22309f081f6b815e1b84010ca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / matrixreg-0.3.0-py3-none-any.whl
| Download URL | matrixreg-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6dcd42e8130bf99d6e3315cb6b037c43103353b349fb91c833b4c9ce4e5c585
|
|
BLAKE2b-256 checksum How to use checksums |
3064d870146aa55ead841585900d243b08bf5090ff4ad1b31448490e73cacf54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|