Skip to main content

Implementation of the Sugeno classifier

Project description

Sugeno classifier

Implementation of the Sugeno classifier, which was presented in the paper "Machine Learning with the Sugeno Integral: The Case of Binary Classification" [1].

Installation

Dependencies

The Sugeno classifier requires:

  • Python (>=3.8)
  • NumPy (>=1.19.0)
  • scikit-learn (>=0.24.1)
  • PuLP (>=2.4)

User installation

Use the package manager pip to install the Sugeno classifier.

pip install sugeno-classifier

Usage

The implementation is compatible to scikit-learn and can be used like other algorithms from this library. In order to use the Sugeno classifier, import the class SugenoClassifier from the module sugeno_classifier from the package classifier. Some examples are shown below:

First example

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

>>> from classifier.sugeno_classifier import SugenoClassifier
>>> X = [[1, 3, 2],
...      [2, 1, 3]]
>>> y = [0, 1]
>>> sc = SugenoClassifier()
>>> sc.fit(X, y)

Use the function predict to classify samples.

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

Example with hyperparameters

The Sugeno classifier has two hyperparameter, the maxitivity and the margin, which can be set in the constructor. Both can influence the classification performance. See [1] for more information.

>>> from classifier.sugeno_classifier import SugenoClassifier
>>> X = [[1, 3, 2],
...      [2, 1, 3]]
>>> y = [0, 1]
>>> sc = SugenoClassifier(maxitivity=2, margin=0.01)
>>> sc.fit(X, y)

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

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

Example with different class labels

The classes do not have to be labeled with 0 and 1, they can be any integer numbers or strings. The label, which is smaller in terms of the relation < or lexicographically ordering, is assigned to negative class and the other one to the positive class.

The first example contains the class labels 2 and 4. Label 2 is assigned to the negative class and label 4 is assigned to the positive class because of 2<4.

>>> from classifier.sugeno_classifier import SugenoClassifier
>>> X = [[1, 3, 2],
...      [2, 1, 3]]
>>> y = [2, 4]
>>> sc = SugenoClassifier()
>>> sc.fit(X, y)
>>> Z = [[3, 2, 1],
...      [1, 2, 3]]
>>> sc.predict(Z)
array([2, 4])

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.sugeno_classifier import SugenoClassifier
>>> X = [[1, 3, 2],
...      [2, 1, 3]]
>>> y = ['one', 'two']
>>> sc = SugenoClassifier()
>>> sc.fit(X, y)
>>> Z = [[3, 2, 1],
...      [1, 2, 3]]
>>> sc.predict(Z)
array(['one', 'two'])

License

MIT

References

[1] Sadegh Abbaszadeh and Eyke Hüllermeier. Machine Learning with the Sugeno Integral: The Case of Binary Classication. 2020.

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

sugeno-classifier-1.0.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

sugeno_classifier-1.0.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file sugeno-classifier-1.0.0.tar.gz.

File metadata

  • Download URL: sugeno-classifier-1.0.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for sugeno-classifier-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7e9ac2821b91d14740edb1c0e5f162518bcecb33773df6e2ed51f0ee7248a686
MD5 83b79411ebe70b70b06055455643473a
BLAKE2b-256 2dfc606b89a8d92e33f336ec019b44db0990f3cfda8608e3052354b44a10e2d1

See more details on using hashes here.

File details

Details for the file sugeno_classifier-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sugeno_classifier-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for sugeno_classifier-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8426ddd71076c6a8a123f76078556c076757bd568835ae03bb327bf7cf6b03ad
MD5 59c166fb3e93962ba82c13ffa2465197
BLAKE2b-256 667e9f4c2a5231fcebcfc154a686c55c26d6b7d7d304e83e4875b57e10dbb4e9

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