Skip to main content

TOPSIS Implementation in Python

Project description

TOPSIS

Author: Anoushka Singh Roll Number: 102303312


Overview

TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) is a multi-criteria decision-making (MCDM) method developed in the 1980s.
It ranks alternatives based on their relative closeness to the ideal best and ideal worst solutions.

This package provides a command-line implementation of the TOPSIS algorithm and supports CSV input files.


Installation

Install the package using pip:

pip install Topsis-Anoushka-102303312


Command Line Usage

After installation, run the following command in the current working directory:

topsis

Example

topsis data.csv "1,2,1,1" "+,-,-,+" result.csv


Input Requirements

  • Input file must contain three or more columns
  • First column must contain alternative names (non-numeric)
  • Second to last columns must contain numeric values only
  • Number of weights, impacts, and criteria columns must be equal
  • Impacts must be:
    • + for benefit criteria
    • - for cost criteria
  • Weights and impacts must be comma-separated
  • Weights need not be normalized (handled internally)

Input File Format (data.csv)

Each row represents an alternative, and each column (except the first) represents a decision criterion such as Correlation, R², RMSE, Accuracy, etc.

Example:

Model Corr Rseq RMSE Accuracy
M1 0.79 0.62 1.25 60.89
M2 0.66 0.44 2.89 63.07
M3 0.56 0.31 1.57 62.87
M4 0.82 0.67 2.68 70.19
M5 0.75 0.56 1.30 80.39

Output File Format (result.csv)

For weights "1,2,1,1" and impacts "+,-,-,+", the output file will contain two additional columns: Topsis Score and Rank.

Example Output

Model Corr Rseq RMSE Accuracy Topsis Score Rank
M1 0.79 0.62 1.25 60.89 0.423744391359611 4
M2 0.66 0.44 2.89 63.07 0.467426368298297 3
M3 0.56 0.31 1.57 62.87 0.760230957034903 1
M4 0.82 0.67 2.68 70.19 0.207772533881566 5
M5 0.75 0.56 1.30 80.39 0.504864457803718 2

Description of Output

  • Topsis Score: Relative closeness of the alternative to the ideal solution
  • Rank: Rank based on TOPSIS score (1 = best alternative)

License

This project is developed for academic purposes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis_anoushka_102303312-1.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

topsis_anoushka_102303312-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file topsis_anoushka_102303312-1.0.1.tar.gz.

File metadata

File hashes

Hashes for topsis_anoushka_102303312-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a5e31ceadaedb008c2c53945f224cf410bad0492a252c6c79a87e2a30c7c7e69
MD5 d0675be2e6ae8a416de7b82eb107825e
BLAKE2b-256 71df579d9c12ebfbd4bbdc9b1254ffda2b0b595a535dd7dd196590a9cc38db14

See more details on using hashes here.

File details

Details for the file topsis_anoushka_102303312-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_anoushka_102303312-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fa9bee69ba58461204d94abfe812b70c4a0a159279054064685657e2cb445a3
MD5 5322ebbdc877336a58c321055b4e0abf
BLAKE2b-256 393157aef3d3445db138983c17a61eaedbb05a78a8ffb18bc6250f960703baa4

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