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


pypi: <>
git: https://github.com/stuporunicorn/topsis102016110


Installation

pip install Topsis-VanshikaNassa-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:

Topsis-VanshikaNassa-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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for Topsis_VanshikaNassa_102016110-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f135bf9dee7c42449ba9aa865a42efc3aee506bef284c3e16ef670051575c7c8
MD5 b51ebb9be16fa6ef1547390d8021770a
BLAKE2b-256 76450615a1963d3a80e66e8563906885cea0777bc4a70209e70c9fc123bf9bbb

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