This is a package for TOPSIS score calculation
Project description
PROJECT DESCRIPTION
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a method used to evaluate and rank alternatives by comparing them to an ideal solution. It calculates how close each option is to the best possible outcome and how far it is from the worst. By considering multiple criteria and their importance, TOPSIS helps make clear and logical decisions, often used in areas like project selection, resource allocation, and performance evaluation. Its simplicity and effectiveness make it a popular choice for solving complex problems.
How does it work?
Suppose you are deciding between various smartphone models by comparing features such as price, storage, camera quality, and design. Rather than guessing, TOPSIS processes the data by normalizing it, weighting each criterion based on its importance (e.g., prioritizing camera quality over design), and determining the distance of each model from the optimal solution. The model nearest to the "perfect scenario" receives the highest rank.
Prerequisites
To get started, ensure you have the following:
- Python: Version 3.7 or higher (preferably).
- Pandas: For data handling and manipulation.
- NumPy: For numerical calculations.
To install the dependencies, just run:
pip install pandas
pip install numpy
How to run the script?
Command-Line Execution
Here is the command you will use to run the script:
topsis <inputFileName> <Weights> <Impacts> <resultFileName>
Where: inputFileName: is your CSV file that holds the data. It should have one column for alternatives and the rest for decision-making criteria (e.g., price, storage, camera). Weights: is a comma-separated string that specifies the importance (weight) of each criterion. Impacts: is another comma-separated string, indicating whether a criterion is beneficial (+) or non-beneficial (-). resultFileName: is where you want to save the output, containing the scores and ranks.
Example
Let us say we have a CSV file named input_data.csv and we want to weigh the features as 20%, 30%, 30%, and 20%, respectively, with the first three being beneficial and the last one (Looks) being non-beneficial.
Run:
topsis input_data.csv "0.2,0.3,0.3,0.2" "+,+,+,-" result.csv
This command will process the data, calculate the scores, and save the results in a file called result.csv.
Input File Structure
The CSV file should look like this:
| Model | Price | Storage | Camera | Looks |
|---|---|---|---|---|
| M1 | 250 | 16 | 12 | 5 |
| M2 | 200 | 16 | 8 | 3 |
| M3 | 300 | 32 | 16 | 4 |
| M4 | 275 | 32 | 8 | 4 |
| M5 | 225 | 16 | 16 | 2 |
Here, each row represents a different alternative (e.g., smartphone model) and each column represents a decision-making criterion.
Output Format
After running the decision-making script, the output includes the calculated Score and Rank for each model:
| Model | Price | Storage | Camera | Looks | Score | Rank |
|---|---|---|---|---|---|---|
| M1 | 250 | 16 | 12 | 5 | 0.4459 | 4 |
| M2 | 200 | 16 | 8 | 3 | 0.3700 | 5 |
| M3 | 300 | 32 | 16 | 4 | 0.6299 | 1 |
| M4 | 275 | 32 | 8 | 4 | 0.4936 | 2 |
| M5 | 225 | 16 | 16 | 2 | 0.4758 | 3 |
Explanation
- Score: The score is calculated based on a weighted evaluation of the decision-making criteria.
- Rank: Models are ranked based on their scores, with
1being the highest rank.
License
This project is licensed under the MIT License. Feel free to use, modify, or contribute!
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_102203080-1.1.tar.gz.
File metadata
- Download URL: topsis_102203080-1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
911e5f6078d4c677fe4fabd183a09fcb5d6aaa4089599268fc2c5a9186151acd
|
|
| MD5 |
5a73d08c5324696af47eeef240d8399c
|
|
| BLAKE2b-256 |
7a98073867ef509705cba126668046ef1a40314acdc210e01ba6e113bfa3391e
|
File details
Details for the file topsis_102203080-1.1-py3-none-any.whl.
File metadata
- Download URL: topsis_102203080-1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6fe3b78c956afc78288366ecb14d2c7c9e1d8fe72793846a75370ed9fcab2ce
|
|
| MD5 |
92a4387438bad02953ef23b694adf9ab
|
|
| BLAKE2b-256 |
37f297ddfdac930b11ab61b6bf7a56596df2d31986b3320dfd20b873a2fa9ded
|