A python package to carry out MCDM using TOPSIS on a dataset with given weights, impacts
Project description
TOPSIS-Python
Submitted By: Ananya Singh
Roll Number: 102016083
Batch: 3CS8
pypi: https://pypi.org/project/Topsis-Ananya-102016083
Installation
pip install Topsis-Ananya-102016083
What is TOPSIS
TOPSIS or Technique for Order Preference by Similarity to Ideal Solution is a method of compensatory aggregation that compares a set of alternatives by identifying weights for each criterion, normalising scores for each criterion and calculating the geometric distance between each alternative and the ideal alternative, which is the best score in each criterion
How to use this package:
Topsis-Ananya-102016083 can be run as in the following example:
In Command Prompt
>> topsis inputfile.csv "1,1,1,1,1" "-,+,+,+,+" outputfile.csv
Working and functions
Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) is a multi-criteria-based decision-making method. TOPSIS chooses the alternative of shortest the Euclidean distance from the ideal solution and greatest distance from the negative ideal solution.
This following package uses a function topsis_score with 4 parameters: input,weights,impact,output. It generates an output.csv file using the Input.csv and the parameters weights and impact. Function normalised normalises the input dataframe. Function weighted multiplies the weights. Function checkparameters checks for all conditions to be checked. Function best returns best ideal value for each column depending on impact sign. Function worst returns worst ideal value for each column depending on impact sign. Function euclidean_dist returns euclidean distance value.
Dataset
Consider an input.csv file
First column of file is removed since it is the object/variable name.
File has 3 or more columns.
2nd to last column contains numeric values only.
input:
topsis inputfile.csv "1,1,1,1,1" "-,+,+,+,+" outputfile.csv
output:
output.csv file will contain the input data along with columns of topsis score and rank.
Weights w
will be multiplied and are normalised using normalized function in the code.
Information of benefit positive(+) or negative(-) impact criteria should be provided by impact 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 checks for the following cases:
- Correct number of parameters.
- Appropriate message for wrong input.
- Handling filenotfound error
- Number of weights, impacts and columns are same
- Impacts are '-' or '+', separated by ','
License
Copyright 2023 Ananya Singh
This repository is licensed under the MIT license.
See LICENSE for details.
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file Topsis_Ananya_102016083-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: Topsis_Ananya_102016083-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6cf6ca82aa579a043d968a77da0e20a189e3d2af5e8f1ed41073260e538b677 |
|
MD5 | 14db6a7c8d29e71df2d475910359acbf |
|
BLAKE2b-256 | fe472f5df72602760b1ea9421f87c94c63a4d3a783bc976106bbf7f905b904e2 |