Skip to main content

Python implementation of TOPSIS method

Project description

ISTOP

TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) implementation in python

Please checkout this link to see more details about TOPSIS steps.

Install

You can install the latest release,

$ pip install istop

Usage

>>> import numpy as np
>>> from istop import Topsis

>>> evaluation_matrix = np.array([
...     [1, 2, 3, 4],
...     [4, 3, 2, 1],
...     [3, 3, 3, 3],
...     [4, 4, 4, 4],
...     [1, 2, 4, 4]
... ])
>>> criteria = [False, True, True, True]
>>> weights = [5, 5, 9, 0]

>>> topsis = Topsis(
...     matrix=evaluation_matrix,
...     criteria=criteria,
...     weights=weights
... )
>>> result = topsis.calculate()
>>> print(result.best_ranks)
[2, 3, 4, 1, 5]
>> print(result.worst_similarities)
[0.56842726 0.18322884 0.43760627 0.55861195 0.68474356]

>>> print(result)
best_ranks=[2, 3, 4, 1, 5]
best_similarities=[0.43157274 0.81677116 0.56239373 0.44138805 0.31525644]
worst_ranks=[2, 3, 4, 1, 5]
worst_similarities=[0.56842726 0.18322884 0.43760627 0.55861195 0.68474356]

The weights parameter is optional. If you don't send it, the default value for each attribute will be 1.

Contribution

Please check to the pylint and flake8 steps in workflow before contribution.

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

istop-0.0.1.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

istop-0.0.1.1-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page