Skip to main content

An implementation of the monotone nonlinear Choquet classifier for binary classification

Project description

Choquet-classifier

Implementation of the Choquet classifier. This model was presented in "Learning monotone nonlinear models using the Choquet integral" [1]

  • 🚧Under Construction🚧

Installation

Dependencies

  • Python (>=3.9)
  • NumPy (>=1.23.3)
  • SciPy (>=1.9.1)
  • scikit-learn (>=1.1.1)

User installation

  • clone this repository or
  • pip installation will be added soon

Usage

The application is compatible to scikit-learn and can be used like every other classifier from the scikit-learn library. In order to use the Choquet classifier, import the class ChoquetClassifier from the module choquet_classifier from the package classifier. Some examples are shown below:

Default example

Use the contructor and the function fit to initialize the Choquet classifier for a given dataset.

>>> from classifier.choquet_classifier import ChoquetClassifier
>>> X = [[1, 3, 2],
...      [1, 0, 3]]
>>> y = [1, 0]
>>> cc = ChoquetClassifier()
>>> cc.fit(X, y)

Use the function predict to classify samples.

>>> Z = [[1, 1, 2],
...      [2, 1, 3]]
>>> cc.predict(Z)
array([0, 0])

Examples with hyper-parameters

>>> from classifier.choquet_classifier import ChoquetClassifier
>>> X = [[1, 3, 2],
...      [1, 0, 3]]
>>> y = [1, 0]
>>> cc = ChoquetClassifier(additivity=3, regularization=1)
>>> cc.fit(X, y)

Again, the function predict can be used to classify samples. Note the different output compared to the first example.

>>> Z = [[1, 1, 2],
...      [2, 1, 3]]
>>> sc.predict(Z)
array([0, 1])

Example with different class labels

The classes do not have to be labeled with 0 and 1; any integer numbers or strings may be used instead. The smaller label in terms of the relation or lexicographic ordering is given to the negative class, whereas the other label is assigned to the positive class.

The first example contains the class labels 2 and 1. Label 2 is assigned to the positive class and label 1 is assigned to the negative class since 2>1.

>>> from classifier.choquet_classifier import ChoquetClassifier
>>> X = [[1, 3, 2],
...      [1, 0, 3]]
>>> y = [2, 1]
>>> cc = ChoquetClassifier()
>>> cc.fit(X, y)
>>> Z = [[1, 1, 2],
...      [2, 1, 3]]
>>> sc.predict(Z)
array([1, 1])

The second example contains the class labels 'one' and 'two'. Label 'one' is assigned to the negative class and label 'two' is assigned to the positive class because 'one' comes lexicographically first.

>>> from classifier.choquet_classifier import ChoquetClassifier
>>> X = [[1, 3, 2],
...      [1, 0, 3]]
>>> y = ['two', 'one']
>>> cc = ChoquetClassifier()
>>> cc.fit(X, y)
>>> Z = [[1, 1, 2],
...      [2, 1, 3]]
>>> sc.predict(Z)
array(['one', 'one'])

Licence

MIT

Reference

[1] Ali Fallah Tehrani, Weiwei Cheng, Krzysztof Dembczynski and Eyke Hüllermeier. Learning monotone nonlinear models using the Choquet integral. 2012.

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

choquet_classifier_glenscalai-0.0.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

choquet_classifier_glenscalai-0.0.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for choquet_classifier_glenscalai-0.0.1.tar.gz
Algorithm Hash digest
SHA256 29d6e18ebfb29cd50764d3fac75d7f67160dba1bc955de8bb907474deccc1bb2
MD5 147a06377cae59771c0c76268a3d2816
BLAKE2b-256 c37cb25b936aaf166487848b53c3bd43c5031e5a41db428b0251300b7ff76820

See more details on using hashes here.

File details

Details for the file choquet_classifier_glenscalai-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for choquet_classifier_glenscalai-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4e388d362dea26afcde4fcb58c473433d2f305ffd95077874130b7f9248e55f
MD5 c90be71b0c538d46867ee9f1f558cf4b
BLAKE2b-256 a38e333dd536cbd268183dd2f8a2b55041b36a95390532586f70af85c88cb6f6

See more details on using hashes here.

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