Skip to main content
Documentation Status PyPI - Project MIT License https://raw.githubusercontent.com/RaoulHeese/casimac/master/docs/source/_static/simplex.png

This Python project provides a supervised multi-class classification algorithm with a focus on calibration, which allows the prediction of class labels and their probabilities including gradients with respect to features. The classifier is designed along the principles of an scikit-learn estimator.

The details of the algorithm have been published in PLOS ONE (preprint: arXiv:2103.02926).

Complete documentation of the code is available via https://casimac.readthedocs.io/en/latest/. Example notebooks can be found in the examples directory.

Installation

Install the package via pip or clone this repository. In order to use pip, type:

$ pip install casimac

Getting Started

Use the CASIMAClassifier class to create a classifier object. This object provides a fit method for training and a predict method for the estimation of class labels. Furthermore, the predict_proba method can be used to predict class label probabilities.

Below is a short example.

from casimac import CASIMAClassifier

import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
import matplotlib.pyplot as plt

# Create toy data
N = 10
seed = 42
X = np.random.RandomState(seed).uniform(-10,10,N).reshape(-1,1)
y = np.zeros(X.size)
y[X[:,0]>0] = 1

# Classify
clf = CASIMAClassifier(GaussianProcessRegressor)
clf.fit(X, y)

# Predict
X_sample = np.linspace(-10,10,100).reshape(-1,1)
y_sample = clf.predict(X_sample)
p_sample = clf.predict_proba(X_sample)

# Plot result
plt.figure(figsize=(8,3))
plt.plot(X_sample,y_sample,label="class prediction")
plt.plot(X_sample,p_sample[:,1],label="class probability prediction")
plt.scatter(X,y,c='r',label="train data")
plt.xlabel("X")
plt.ylabel("label / probability")
plt.legend()
plt.show()
https://raw.githubusercontent.com/RaoulHeese/casimac/master/docs/source/_static/plot.png

📖 Citation

If you find this code useful, please consider citing:

@article{10.1371/journal.pone.0279876,
      doi={10.1371/journal.pone.0279876},
      author={Heese, Raoul and Schmid, Jochen and Walczak, Micha{\l} and Bortz, Michael},
      journal={PLOS ONE},
      publisher={Public Library of Science},
      title={Calibrated simplex-mapping classification},
      year={2023},
      month={01},
      volume={18},
      url={https://doi.org/10.1371/journal.pone.0279876},
      pages={1-26},
      number={1}
      }

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for casimac 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for casimac 1.2.4
File Size Uploaded
casimac-1.2.4.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for casimac 1.2.4
File Interpreter ABI Platform
casimac-1.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / casimac-1.2.4.tar.gz

Download URL casimac-1.2.4.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
74bda7e7be5c7731ac3df3386d3d76c3673192b57dccbbc26a6453ece77fcf52
BLAKE2b-256 checksum
How to use checksums
55160e75a13df17acf7b3a6939cd710e978d9258197b9d023fde3bd839d9edce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / casimac-1.2.4-py3-none-any.whl

Download URL casimac-1.2.4-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61dcdc312d534bd9718a34dc7bbfb274945ea1980fd2da87e3bb78bfd1a22169
BLAKE2b-256 checksum
How to use checksums
00dac83d9c2f6fbf276e95e91a65c51dad3463488933252d983f7839e89bd7a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

1.2.4 This release

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page