Skip to main content

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:

  1. Data Validation: Checks for missing values and ensures all input columns are numeric.
  2. Vector Normalization: Reduces all criteria to the same scale.
  3. Weighting: Multiplies the normalized matrix by the user-assigned weights.
  4. Ideal Best & Worst: Identifies the ideal best and ideal worst values for each criterion.
  5. Euclidean Distance: Calculates the distance of each alternative from the best and worst solutions.
  6. 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.563692 3
M2 0.513032 4
M3 0.439177 6
M4 0.491956 5
M5 0.641886 2
M6 0.738148 1
M7 0.407390 8
M8 0.408499 7

License

This project is open-source and available for educational purposes.

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_sandeepkaur_102483081-1.0.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

topsis_sandeepkaur_102483081-1.0.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file topsis_sandeepkaur_102483081-1.0.2.tar.gz.

File metadata

File hashes

Hashes for topsis_sandeepkaur_102483081-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c3a777703f19bc04d63dda26a3cc95fb338cc7b6bc0344eac934bbea0c6452a4
MD5 869d0a240763a0d6dee98882545dbfc2
BLAKE2b-256 997b5fafb63697c4850d36cfc471ec513829357c7bbf7061f71e5c02d247c898

See more details on using hashes here.

File details

Details for the file topsis_sandeepkaur_102483081-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_sandeepkaur_102483081-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c138cfcd6dd93d1abbc830269b97fd1d58e668e023874c2510b77b25c3e04752
MD5 3806401f2bcc7f5b0ca862dc73e7dc64
BLAKE2b-256 e1432cd600a4fa3a1eb732137081a6e1d7461430b606e2d6965259936a3cd147

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