Skip to main content

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

Release files for TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110 1.2.2
File Size Uploaded
TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110-1.2.2.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110 1.2.2
File Interpreter ABI Platform
TopsisPackageDataScience_vanshika102016110nassa3CS12_102016110-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size:10.5 kB

Release files / TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110-1.2.2.tar.gz

Download URL TopsisPackageDataScience-vanshika102016110nassa3CS12-102016110-1.2.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
951fa710840505783da973944c5c33693a426369b54b83086d28e62787fd677a
BLAKE2b-256 checksum
How to use checksums
f69996ae1fd48172b796b25658a0b0f110df7e2d12a9f9bf4d66068ef402d9a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / TopsisPackageDataScience_vanshika102016110nassa3CS12_102016110-1.2.2-py3-none-any.whl

Download URL TopsisPackageDataScience_vanshika102016110nassa3CS12_102016110-1.2.2-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39d3e666e61221f203ef843e6a9d1666a10aff85ff4a2fc924e188f14c44642a
BLAKE2b-256 checksum
How to use checksums
517cf6ecf34079f93d81a624c389e7a71ea60bc255c5e7be0d818013fedbcf04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page