Skip to main content

TOPSIS implementation in python for multi-criteria decision making

Project description

TOPSIS implementation in python for multi-criteria decision making

Class project for DATA ANALYSIS AND VISUALISATION 2020 - UCS633 Thapar University, Patiala
Navkiran Singh  

COE17
Roll number: 101703365

Update: Added windows command line support

Output is a dataframe with 3 columns

  • Alternatives serial number
  • Corresponding performance Score or closeness to ideal solution
  • Rank

Installation

pip install topsis_navkiran

Note the name has an underscore not a hyphen. If installation gives error or package is not found after installing, install as sudo.

Recommended - test it out in a virtual environment.

Upgrade

pip install topsis_navkiran --upgrade

To use via command line

topsis_navkiran_cli data.csv 25,25,25,25 -+++

First argument after run.py is filename with .csv extension. The .csv file is assumed to have a structure similar to one provided in topsis_navkiran/data.csv

That is, the .csv file should have a header with column names and first column should only list alternatives and not attribute values.

To use in .py script

from topsis_navkiran import topsis
"""
decision_matrix is 2D numpy array, weights is a 1D array and impacts is a string of the form +-+-- 
where + indicates benefit and - indicates cost
"""
output_dataframe = topsis(decision_matrix,weights,impacts)

Debugging and Exception Handling

The program has several assert statements which raise errors with helpful description in the following cases:

  • Wrong dimensions of decision matrix (not 2D), weights (not 1D)
  • Length of weights and impacts don't match
  • Weights or impacts don't match number of attributes
  • For command line, number of arguments is less than 3 required
  • File extension must be .csv

Based off on a similar package for TOPSIS in R

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

topsis_navkiran-1.1.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

topsis_navkiran-1.1.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file topsis_navkiran-1.1.4.tar.gz.

File metadata

  • Download URL: topsis_navkiran-1.1.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for topsis_navkiran-1.1.4.tar.gz
Algorithm Hash digest
SHA256 e9bfe057cf01286c6ee74a652fc709acdc1b5b6e56de76cb33bb66cae1178632
MD5 2adc2a4e2a1d948ad20cdefd40a11499
BLAKE2b-256 eda8350fad161213adf8b31fce352bf453b2e6e01447b3db81b15957408fae11

See more details on using hashes here.

File details

Details for the file topsis_navkiran-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: topsis_navkiran-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for topsis_navkiran-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b0b43001296ae0d84d461875efd9037e1f5449216721f2b84de396b4bf2d8e3c
MD5 b811a0eec49017e9df47ca73ee31cdf1
BLAKE2b-256 3fa768f141a159e9c28cf32ba09efd86408bdd263013455ed4f12b9cd3ae3305

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