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

>> 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:

  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.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for Topsis_Ananya_102016083-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6cf6ca82aa579a043d968a77da0e20a189e3d2af5e8f1ed41073260e538b677
MD5 14db6a7c8d29e71df2d475910359acbf
BLAKE2b-256 fe472f5df72602760b1ea9421f87c94c63a4d3a783bc976106bbf7f905b904e2

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