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.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


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.1.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.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_sandeepkaur_102483081-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ecd3e61ac4af7120d0e7d44f2fdbcee01a0c7e8c02750feda868aff6130f908a
MD5 967c83f72ba7ab117128a123935e93ee
BLAKE2b-256 d0f4e31cfadbf9d613849491239c68b8434a885c58f9388688bf13c08f7a275f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_sandeepkaur_102483081-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45b8b609946204a7b9f547cf0e22390d55496d59549cff7b36b4d651a9940361
MD5 6c6214a096ca6d6c955a909dd8ecb0e9
BLAKE2b-256 8a6897d85f82cc88eed2a1534c3514ed07a2300d5a07cf1430138bf737556d18

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