Skip to main content

A command-line Python package to implement the TOPSIS method.

Project description

Topsis-Smarth-102497023

A Python package implementing the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS) for Multi-Criteria Decision Making (MCDM). This package works as a Command Line Tool and generates an output CSV file containing the TOPSIS Score and Rank.

Installation

Install the package from PyPI using:

pip install Topsis-Smarth-102497023

Quick Start

Command Syntax

Once installed, you can use the topsis command directly from your terminal, following the syntax given below.

topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>

Parameters

The command accepts exactly 4 parameters:

Parameter Format Example Description
Input file Path string "data.csv" Path to your CSV file
Weights Comma-separated string "1,1,1,1" Weight for each criterion
Impacts Comma-separated string "+,+,-,+" + for benefit, - for cost
Output file Path string "result.csv" Where to save results

Example Execution

Grab an input csv or excel file strictly adheres to the following structure:

  1. The file must have at least 3 columns- Candidate Identifier column followed by min. 2 criteria.
  2. The first column must contain the names/IDs of the alternatives.
  3. Criteria columns must contain only numeric values.

A sample dataset file (data1.csv) is shown below:

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

Run the following command through the terminal.

topsis data1.csv "1,1,1,1" "+,+,-,+" output_data1.csv

The output file (output_data1.csv) generated will look like this:

Model Corr Rseq RMSE Accuracy Topsis Score Rank
M1 0.79 0.62 1.25 60.89 0.7722 2
M2 0.66 0.44 2.89 63.07 0.2256 5
M3 0.56 0.31 1.57 62.87 0.4389 4
M4 0.82 0.67 2.68 70.19 0.5239 3
M5 0.75 0.56 1.30 80.39 0.8114 1

Sample input and output files are available in the sample_data/ folder.

Important Notes

  • The command accepts exactly four parameters.
  • Number of weights and impacts must match number of criteria columns.
  • Impacts must be only + or -.
  • Make sure the criteria columns must be numeric as mentioned earlier.
  • No cell should be empty.

License

This project is licensed under the MIT License. See LICENSE for more information.

Author

Smarth Kaushal
Penultimate-Year Student, BE-CSE
Thapar Institute of Engineering and Technology, Patiala

Let's Connect: GitHub | LinkedIn | Email


If you find this package useful, please ⭐ star it on GitHub!

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_smarth_102497023-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

topsis_smarth_102497023-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file topsis_smarth_102497023-1.0.0.tar.gz.

File metadata

  • Download URL: topsis_smarth_102497023-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for topsis_smarth_102497023-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cea85a657358e48adf70463f1c2c0e5c6ffeb93209c909c0dc023746e12fb706
MD5 e8fe491c4dec75fcb893e86b1967e395
BLAKE2b-256 58a08f87e8978b7320ceb4c9f070badb2eea4bd5172e7859c8997df1b508bc21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_smarth_102497023-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ea9520efc7f4e3d5376fbacf45d41cfbd4e7b5f3d62679699616b39fac54072
MD5 2f65d34da96c3a0204b28cedc910620f
BLAKE2b-256 d9c1e0e24de002d844de378adb4160911cb115683f839e09047b6e129e2ad71c

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