Skip to main content

Ordinal classification for Python, scikit-learn compatible

Project description

skordinal

Overview
CI/CD Unit tests !python
Code Ruff License - BSD 3-Clause

What is skordinal?

skordinal is an experimental framework built on Python that integrates with scikit-learn to automate machine learning experiments through simple JSON configuration files. Initially designed for ordinal classification, it supports regular classification algorithms as long as they are compatible with scikit-learn, making it easy to run reproducible experiments across multiple datasets and classification methods.

Table of Contents

Installation

Requirements

skordinal requires Python 3.9 or higher and is tested on Python 3.9, 3.10, 3.11, and 3.12.

All dependencies are managed through pyproject.toml and include:

  • numpy (>=1.21)
  • pandas (>=1.0.1)
  • scikit-learn (>=1.3.0)
  • scipy (>=1.7)

Setup

  1. Clone the repository:

    git clone https://github.com/ayrna/skordinal
    cd skordinal
    
  2. Install the framework:

    pip install .
    

    For development purposes, use editable installation:

    pip install -e .
    

    Optional dependencies for development:

    pip install -e .[dev]
    

Note: The editable mode is required for running tests due to automatic dependency resolution.

Testing Installation

Test your installation with the provided example:

python config.py with skordinal/configurations/full_functionality_test.json

Quick Start

skordinal includes sample datasets with pre-partitioned train/test splits using a 30-holdout experimental design.

Basic experiment configuration:

{
    "general_conf": {
        "basedir": "skordinal/datasets/data",
        "datasets": ["balance-scale", "contact-lenses", "tae"],
        "hyperparam_cv_nfolds": 3,
        "output_folder": "results/",
        "metrics": ["ccr", "mae", "amae"],
        "cv_metric": "mae"
    },
    "configurations": {
        "SVM": {
            "classifier": "SVC",
            "parameters": {
                "C": [0.001, 0.1, 1, 10, 100],
                "gamma": [0.1, 1, 10]
            }
        },
        "SVMOP": {
            "classifier": "OrdinalDecomposition",
            "parameters": {
                "dtype": "ordered_partitions",
                "decision_method": "frank_hall",
                "base_classifier": "SVC",
                "parameters": {
                    "C": [0.01, 0.1, 1, 10],
                    "gamma": [0.01, 0.1, 1, 10],
                    "probability": ["True"]
                }
            }
        }
    }
}

Run the experiment:

python config.py with my_experiment.json

Results are saved in results/ folder with performance metrics for each dataset-classifier combination. The framework automatically performs cross-validation, hyperparameter tuning, and evaluation on test sets.

Configuration Files

Experiments are defined using JSON configuration files with two main sections: general_conf for experiment settings and configurations for classifier definitions.

general-conf

Controls global experiment parameters.

Required parameters:

  • basedir: folder containing all dataset subfolders, it doesn't allow more than one folder at a time. It can be indicated using a full path, or a relative one to the framework folder.
  • datasets: name of datasets that will be experimented with. A subfolder with the same name must exist inside basedir.

Optional parameters:

  • hyperparam_cv_folds: number of folds used while cross-validating.
  • jobs: number of jobs used for GridSearchCV during cross-validation.
  • input_preprocessing: data preprocessing ("std" for standardization, "norm" for normalization, "" for none)
  • output_folder: name of the folder where all experiment results will be stored.
  • metrics: name of the accuracy metrics to measure the train and test performance of the classifier.
  • cv_metric: error measure used for GridSearchCV to find the best set of hyper-parameters.

configurations

Defines classifiers and their hyperparameters for GridSearchCV. Each configuration has a name and consists of:

  • classifier: scikit-learn or built-in skordinal classifier
  • parameters: hyperparameters for grid search (nested for ensemble methods)

Running Experiments

Basic Usage

python config.py with experiment_file.json

Example Output

Results are stored in the specified output folder with detailed performance metrics and hyperparameter information for each dataset and configuration combination.

License

BSD 3


Go to Top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skordinal-0.0.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

skordinal-0.0.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

skordinal-0.0.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

skordinal-0.0.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

skordinal-0.0.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file skordinal-0.0.1.tar.gz.

File metadata

  • Download URL: skordinal-0.0.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for skordinal-0.0.1.tar.gz
Algorithm Hash digest
SHA256 974c7397c6f5dd95f8e28210271896988b647d67408d01248ecc2dfb06cdaf61
MD5 03198b1f2240007f1e784fa81f2a15b9
BLAKE2b-256 ce04734d83d501d0e35e87607753bdb70fd5afc71d37e8575331cb6c1b230b18

See more details on using hashes here.

Provenance

The following attestation bundles were made for skordinal-0.0.1.tar.gz:

Publisher: release.yml on ayrna/skordinal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skordinal-0.0.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for skordinal-0.0.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14870c9cc13f942865059c85633423681dc933f4fe179fb3a066b5c2132b74ce
MD5 014ccc536a4c1901504115307dd900be
BLAKE2b-256 83920a861ac757f287b8160faabae969a538be40bce4fe8cfb079debbc26f876

See more details on using hashes here.

Provenance

The following attestation bundles were made for skordinal-0.0.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ayrna/skordinal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skordinal-0.0.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for skordinal-0.0.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b5d99353a88db7f16a029cd991e54cc881577b9aa3c85c8991970023c46777ca
MD5 0043e87f0839063852cb3c26a933d34b
BLAKE2b-256 79b5a9c949d64092d7040e53b7007fe76fee1ad1b74ed947b31c62bf18b7c073

See more details on using hashes here.

Provenance

The following attestation bundles were made for skordinal-0.0.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ayrna/skordinal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skordinal-0.0.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for skordinal-0.0.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8d0e543bd3aa1dce33b02e008d984e22c962e89daca593ebc3237394fed26caf
MD5 51332fe4d0e1179f2c2086f54163bf27
BLAKE2b-256 ff65aa2b93728a361b7b7c106577eae41d3ffa4e5a9a71fcf8b1295cfc218804

See more details on using hashes here.

Provenance

The following attestation bundles were made for skordinal-0.0.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ayrna/skordinal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skordinal-0.0.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for skordinal-0.0.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55fe47e327ec7b83264cf62bc25827fcfd26829f42a58afe5204169bbe0f722a
MD5 a531fa3d7e0fa57665a22a3c31992c1e
BLAKE2b-256 ea7bd4a9c3087d4a9d789d3c8e0acf1c6ae49e0f5d0d017dacfb73912750f41f

See more details on using hashes here.

Provenance

The following attestation bundles were made for skordinal-0.0.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ayrna/skordinal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page