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.1.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.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sugeno-classifier-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e5eda57eaf7f5bada11d089da97c1aa8947b68f4574889432fdfb3acff3f37a4
MD5 a0a9fde968898392fc13f25f197c0075
BLAKE2b-256 21a1cc5c3bb886f38d83e1daf6264369f14e54a4d014b0d64361f37ce16eb1e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sugeno_classifier-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 422e6e0d3d7b2284b9e2e652493c13dae74d287a4fb4e79fe85cf484859330e8
MD5 4f505732a38d5f8d21c32899f1cc8343
BLAKE2b-256 03ed1e1cc7a19efb592332983d4a7da4d1847ea8b7dba3a49eb0afaae34a5d9e

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