A Python package to implement TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)
Project description
Topsis-Akash-102317024
By: Akash, 102317024
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a multi-criteria decision analysis method. It is based on the principle that the best solution has the shortest distance from the positive-ideal solution and the longest distance from the negative-ideal solution.
Installation
pip install Topsis-Akash-102317024
Usage
Command Line
topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>
Example:
topsis data.csv "1,1,2,1" "+,+,-,+" result.csv
Python API
from Topsis_Akash_102317024 import topsis
topsis("data.csv", "1,1,2,1", "+,+,-,+", "result.csv")
Input File Format
The input CSV file must have:
- First column: Alternative names (e.g., M1, M2, …)
- Remaining columns: Numeric criteria values
Example data.csv:
Fund Name,P1,P2,P3,P4,P5
M1,0.84,0.71,6.7,42.1,12.97
M2,0.91,0.83,7.0,31.7,10.52
M3,0.79,0.62,4.8,46.7,13.23
M4,0.78,0.61,6.4,42.4,12.59
M5,0.94,0.88,3.6,62.2,10.11
Parameters
| Parameter | Description |
|---|---|
| InputDataFile | Path to input CSV file |
| Weights | Comma-separated numeric weights, e.g. "1,1,2,1" |
| Impacts | Comma-separated impacts (+ or -), e.g. "+,+,-,+" |
| ResultFileName | Path to output CSV file |
Output
The result CSV will contain all original columns plus two new columns:
- Topsis Score – Performance score (0 to 1, higher is better)
- Rank – Rank of each alternative (1 = best)
Algorithm Steps
- Normalise the decision matrix
- Calculate weighted normalised matrix
- Determine ideal best and ideal worst solutions
- Compute Euclidean distances from ideal solutions
- Calculate performance score (closeness coefficient)
- Rank alternatives
Dependencies
numpypandas
License
MIT License — © 2024 Akash
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_akash_102317024-1.0.0.tar.gz.
File metadata
- Download URL: topsis_akash_102317024-1.0.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0af4736859e3a0b7303de64fa21fd28260bc4d1fa70b96d78706e1c8ba44fbe4
|
|
| MD5 |
69da468f44cd33da780b4287d21ec215
|
|
| BLAKE2b-256 |
2f3bdebcc4458e3874d592f832911b094edac576b3fd939343bb3393392496b2
|
File details
Details for the file topsis_akash_102317024-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_akash_102317024-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5264891bfd5823a62d3ccb46440d7172aa479c88985ff7abf85d194599d5f5d
|
|
| MD5 |
bd07444a336f70f06689ffe71333f3c3
|
|
| BLAKE2b-256 |
2916a6d9ad769aad5e020ce8f6bbdf6f6e3902a8175c63e1c4c4ea66ecfc9789
|