Skip to main content

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

>> python 102016083.py inputfile.csv "1,1,1,1,1" "-,+,+,+,+" outputfile.csv

where 102016083.py contains code for topsis.

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:

  1. Correct number of parameters.
  2. Appropriate message for wrong input.
  3. Handling filenotfound error
  4. Number of weights, impacts and columns are same
  5. 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


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

Topsis_Ananya_102016083-1.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file Topsis_Ananya_102016083-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Topsis_Ananya_102016083-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59e7a0a3bf1c3205aeac3d20b8600dac2582df2b48c8ff07e3d540c67e783388
MD5 b88a4d256a74bba8b042d9f940595ac4
BLAKE2b-256 abd36591ae82b0f5205f96c03fc68327dd9f02413a5890b30f1fa9e76fd58741

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page