Skip to main content

A python package to implement TOPSIS on a given dataset

Project description

TOPSIS-Python

Submitted By: Vanshika Nassa
Roll Number: 102016110
Batch: 3CS12


git: https://github.com/stuporunicorn/topsis102016110


Installation

pip install TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110

What is TOPSIS

Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) originated in the 1980s as a multi-criteria decision making method. TOPSIS chooses the alternative of shortest Euclidean distance from the ideal solution, and greatest distance from the negative-ideal solution. More details at wikipedia.


How to use this package:

TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110 can be run as in the following example:

In Command Prompt

>> topsis data.csv "1,1,1,1,1" "+,-,+,-,+" result.csv

Sample dataset

Consider this sample.csv file

First column of file is removed by model before processing so follow the following format.

All other columns of file should not contain any categorical values.

Fund Name,P1,P2,P3,P4,P5 M1,0.81,0.66,5.9,43.8,15.6 M2,0.67,0.58,1.8,62.1,16.4 M3,0.89,0.87,4.2,50.7,14.15 M4,0.82,0.67,2,32.6,11.98 M5,0.76,0.56,6.9,31.3,12.9 M6,0.72,0.88,2.7,47.8,12.8 M7,0.92,0.98,3.1,54.3,16.32 M8,0.78,0.61,7.1,36,10.85 weights vector = [0.25,1,1,0.80,1]

impacts vector = [ +,+,-,+,-]

input:

topsis sample.csv "0.25,1,1,0.80,1" "+,+,-,+,-" output.csv

output:

output.csv file will contain following data :

Fund Name,P1,P2,P3,P4,P5,Topsis score,Rank M1,0.81,0.66,5.9,43.8,15.6,0.25437487737312253,6 M2,0.67,0.58,1.8,62.1,16.4,0.6506396821452161,3 M3,0.89,0.87,4.2,50.7,14.15,0.5763040337448186,5 M4,0.82,0.67,2.0,32.6,11.98,0.6316539516437067,4 M5,0.76,0.56,6.9,31.3,12.9,0.1588440472634522,8 M6,0.72,0.88,2.7,47.8,12.8,0.7467977034332189,1 M7,0.92,0.98,3.1,54.3,16.32,0.6891413065596583,2 M8,0.78,0.61,7.1,36.0,10.85,0.23756825400098508,7

Information of benefit positive(+) or negative(-) impact criteria should be provided in I.


The rankings are stored in a csv file, with the 1st rank offering us the best decision, and last rank offering the worst decision making, according to TOPSIS method.

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

License

Copyright 2023 Vanshika Nassa
This repository is licensed under the MIT license.
See LICENSE for details. MIT

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

Built Distribution

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

File details

Details for the file TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110-1.2.2.tar.gz.

File metadata

File hashes

Hashes for TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110-1.2.2.tar.gz
Algorithm Hash digest
SHA256 951fa710840505783da973944c5c33693a426369b54b83086d28e62787fd677a
MD5 25c285089a8abafad5de4801bf8c984e
BLAKE2b-256 f69996ae1fd48172b796b25658a0b0f110df7e2d12a9f9bf4d66068ef402d9a8

See more details on using hashes here.

File details

Details for the file TopsisPackageDataScience_vanshika102016110nassa3CS12_102016110-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for TopsisPackageDataScience_vanshika102016110nassa3CS12_102016110-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39d3e666e61221f203ef843e6a9d1666a10aff85ff4a2fc924e188f14c44642a
MD5 ad1b493772ab54c67e756f047a669114
BLAKE2b-256 517cf6ecf34079f93d81a624c389e7a71ea60bc255c5e7be0d818013fedbcf04

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