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
Reference
[1] Ali Fallah Tehrani, Weiwei Cheng, Krzysztof Dembczynski and Eyke Hüllermeier. Learning monotone nonlinear models using the Choquet integral. 2012.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file choquet_classifier_glenscalai-0.0.1.tar.gz.
File metadata
- Download URL: choquet_classifier_glenscalai-0.0.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29d6e18ebfb29cd50764d3fac75d7f67160dba1bc955de8bb907474deccc1bb2
|
|
| MD5 |
147a06377cae59771c0c76268a3d2816
|
|
| BLAKE2b-256 |
c37cb25b936aaf166487848b53c3bd43c5031e5a41db428b0251300b7ff76820
|
File details
Details for the file choquet_classifier_glenscalai-0.0.1-py3-none-any.whl.
File metadata
- Download URL: choquet_classifier_glenscalai-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e388d362dea26afcde4fcb58c473433d2f305ffd95077874130b7f9248e55f
|
|
| MD5 |
c90be71b0c538d46867ee9f1f558cf4b
|
|
| BLAKE2b-256 |
a38e333dd536cbd268183dd2f8a2b55041b36a95390532586f70af85c88cb6f6
|