Python library for implementing TOPSIS for multi-criteria decision analysis.
Project description
TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) Python Implementation
This repository contains a Python implementation of the TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) method, which is used for multi-criteria decision analysis. It ranks alternatives based on the performance data of various criteria and provides a final score and rank.
Features
- Multi-Criteria Decision Making (MCDM): Helps in evaluating and ranking alternatives based on multiple criteria.
- Customizable Weights & Impacts: Define the importance of each criterion and whether it's beneficial or non-beneficial.
- Automated Scoring and Ranking: Automatically computes a TOPSIS score and ranks the alternatives.
Requirements
- Python 3.x
numpyandpandaslibraries
To install the required libraries, you can use:
pip install numpy pandas
Dataset
The dataset used in this project is a CSV file containing alternatives and criteria. The first row contains column headers (criteria names), and the first column contains the names of alternatives. The remaining columns represent the performance scores for each criterion.
Example Dataset (102203771-data.csv):
Fund Name P1 P2 P3 P4 P5
M1 0.84 0.71 6.7 42.1 12.59
M2 0.91 0.83 7 31.7 10.11
M3 0.79 0.62 4.8 46.7 13.23
M4 0.78 0.61 6.4 42.4 12.55
M5 0.94 0.88 3.6 62.2 16.91
M6 0.88 0.77 6.5 51.5 14.91
M7 0.66 0.44 5.3 48.9 13.83
M8 0.93 0.86 3.4 37 10.55
Usage
Input Format
Input CSV File: A CSV file where the first column is the alternative name, and the remaining columns represent the performance scores for each criterion.
Weights: A comma-separated string defining the weights for each criterion (e.g., 0.25,0.25,0.25,0.15,0.10).
Impacts: A comma-separated string defining the impact of each criterion (e.g., +,+,+,+,-). + represents a beneficial criterion, while - represents a non-beneficial criterion.
Running the Package
To run the script, use the following command in the terminal or command prompt:
python Topsis.py 102203771-data.csv 0.25,0.25,0.25,0.15,0.10 +,+,+,+,- output.csv
Output
After running the command, the package will generate an output file output.csv with the following additional columns:
TOPSIS Score: The calculated score for each alternative.
Rank: The rank based on the TOPSIS score (1 is the best).
Fund Name P1 P2 P3 P4 P5 TOPSIS Score Rank
M1 0.84 0.71 6.7 42.1 12.59 0.644718515 2
M2 0.91 0.83 7 31.7 10.11 0.680361059 1
M3 0.79 0.62 4.8 46.7 13.23 0.443784812 7
M4 0.78 0.61 6.4 42.4 12.55 0.563499544 4
M5 0.94 0.88 3.6 62.2 16.91 0.489616631 6
M6 0.88 0.77 6.5 51.5 14.91 0.639262133 3
M7 0.66 0.44 5.3 48.9 13.83 0.376340122 8
M8 0.93 0.86 3.4 37 10.55 0.514142481 5
License
This project is licensed under the MIT License
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topsis_kritik-1.0.0.tar.gz.
File metadata
- Download URL: topsis_kritik-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a43af7bc52621e86e5d327ca1aae185e092211ee247ba3296e060248c46a9364
|
|
| MD5 |
1115d5ec56863f4a64c2131b8cb1e966
|
|
| BLAKE2b-256 |
66f035a60a67fbad631c41c98fa8b9810ed7fa22394bceb9137e76434e1716fc
|
File details
Details for the file topsis_kritik-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_kritik-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54b3a46a04902b131694fcbc2f0effc1319aed92313e3fb66feb882e7fa9eee8
|
|
| MD5 |
8ba791f196b0c653c37d29dcd0b05a63
|
|
| BLAKE2b-256 |
7bdec804931070d320ac99b8eecba83d17de020f7bd60c5dfef3e440e0584253
|