TOPSIS-Python-Assignment (Part 2)
Project description
TOPSIS-Python
Project Overview
This project implements the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) algorithm. It is a multi-criteria decision analysis method used to rank a finite number of alternatives based on their distance from the "ideal best" and "ideal worst" solutions.
This package provides a command-line tool to perform the analysis on any CSV dataset containing numerical data.
Installation
To run this project, ensure you have Python installed along with the following libraries:
pip install pandas numpy matplotlib
Methodology
The algorithm follows these standard steps:
- Data Validation: Checks for missing values and ensures all input columns are numeric.
- Vector Normalization: Reduces all criteria to the same scale.
- Weighting: Multiplies the normalized matrix by the user-assigned weights.
- Ideal Best & Worst: Identifies the ideal best and ideal worst values for each criterion.
- Euclidean Distance: Calculates the distance of each alternative from the best and worst solutions.
- Performance Score: Calculates a score (0 to 1) and ranks the alternatives (Higher Score = Better Rank).
Usage
The script is designed to be run from the command line.
python topsis.py <InputDataFile> <Weights> <Impacts> <ResultFileName>
Parameters
- InputDataFile: Path to the input CSV file.
- Weights: Comma-separated numbers (e.g., "1,1,1,1").
- Impacts: Comma-separated signs ("+" or "-").
- ResultFileName: Name of the output CSV file.
Example Execution
Below is a demonstration of the tool using the sample data provided in this assignment.
1. Command Used
python topsis.py data.csv "1,1,1,1,1" "+,+,-,+,-" result.csv
2. Output Results
The program calculates the TOPSIS Score and Rank for each fund.
| Fund Name | Topsis Score | Rank |
|---|---|---|
| M1 | 0.4435 | 6 |
| M2 | 0.4851 | 5 |
| M3 | 0.2834 | 7 |
| M4 | 0.5362 | 3 |
| M5 | 0.2281 | 8 |
| M6 | 0.6973 | 1 |
| M7 | 0.5891 | 2 |
| M8 | 0.5342 | 4 |
License
This project is open-source and available for educational purposes.
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 Distributions
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_sandeepkaur_102483081-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_sandeepkaur_102483081-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb5cf8a983b64b0d4f21cce0b6eeb3862a56959ad55ad8cf652f776d71153c1d
|
|
| MD5 |
882f656744228df63b017d8d470b4321
|
|
| BLAKE2b-256 |
dc5389c0a3cd000f7939a83b024ea89786446934bc80e1055fba36c8568ac181
|