semvec/pypi-packages huggingface dataset:
Topsis-Chahat-Garg-102203557 0.1.0
A Python package for implementing the TOPSIS method.
Requires Python: >=3.6

Multi-Criteria Decision Making with TOPSIS

Overview
This repository contains a Python-based implementation of the TOPSIS decision-making methodology (Technique for Order of Preference by Similarity to Ideal Solution). The tool helps evaluate and rank different options based on multiple decision criteria while considering their relative significance.

System Requirements
- Python 3.x environment
- Required packages:
  pandas
  numpy

To set up the dependencies:
pip install pandas numpy

File Structure
- Main script: 102203557.py
- Required input: CSV format decision matrix
- Generated output: CSV file with rankings

Input Data Requirements
Your input CSV file should be structured as follows:
- Column 1: Alternative identifiers
- Columns 2+: Numerical values for each criterion

Sample input format (input.csv):
Alternative,Metric1,Metric2,Metric3,Metric4
Option1,20,300,50,0.5
Option2,25,250,60,0.7

Running the Program
Execute the script using the following syntax:
python 102203557.py input_file weights impacts output_file

Parameters:
- input_file: Path to your input CSV
- weights: Criterion weights (comma-separated)
- impacts: Criterion types (+ for maximization, - for minimization)
- output_file: Desired location for results

Example:
python 102203557.py input.csv "1,1,1,1" "+,-,+,+" results.csv

Results Format
The output CSV includes:
- All original input data
- TOPSIS score column
- Final ranking column

Sample output structure:
Alternative,Metric1,Metric2,Metric3,Metric4,TOPSIS_Score,Rank
Option1,20,300,50,0.5,0.78,2
Option2,25,250,60,0.7,0.85,1

Error Management
The program includes validation for:
1. File existence and accessibility
2. Data format requirements
3. Input parameter consistency
4. Valid impact indicators

Common error messages:
- "Unable to locate specified input file"
- "Input data must contain 3+ columns"
- "Weight/impact count must match criterion count"
- "Impact values limited to '+' or '-'"
Topsis-Abhinav-102203464 0.1.0
A Python package for implementing the TOPSIS method.
Requires Python: >=3.6

# TOPSIS Implementation

This Python script implements the **Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS)**, a multi-criteria decision-making method. It evaluates and ranks alternatives based on multiple criteria, considering weights and impacts.

## Requirements

Before running the script, ensure you have Python installed along with the following libraries:
- `pandas`
- `numpy`

To install the required libraries, run:
```bash
pip install pandas numpy
 
Usage
The script is executed from the command line and requires the following inputs:
python topsis.py <InputFile> <Weights> <Impacts> <ResultFile>


Arguments:
InputFile: Path to the CSV file containing the dataset.

The first column should have the names/identifiers of alternatives.
The subsequent columns should contain numeric values representing the criteria.
Weights: Comma-separated weights for each criterion (e.g., 1,2,3).

Impacts: Comma-separated impacts for each criterion (+ for beneficial and - for non-beneficial). Example: +, -, +.

ResultFile: Path to save the output CSV file containing the TOPSIS scores and ranks.

Example
Input Data
Alternative,Criteria1,Criteria2,Criteria3
A1,250,16,12
A2,200,20,8
A3,300,12,16
A4,275,15,11
 
Command:
python topsis.py example.csv 0.5,0.3,0.2 +,+,- result.csv

Output Data (result.csv):
Alternative,Criteria1,Criteria2,Criteria3,Topsis Score,Rank
A1,250,16,12,0.7742,1
A2,200,20,8,0.4268,4
A3,300,12,16,0.6423,2
A4,275,15,11,0.5797,3

Steps in the Script
Data Loading:

Reads the input file and validates that it has at least three columns.
Validation:

Checks if the number of weights and impacts match the number of criteria.
Ensures impacts are either + or -.
Normalization:

Normalizes the criteria values using vector normalization.
Weighted Matrix Calculation:

Multiplies normalized values by their respective weights.
Ideal Values:

Determines the ideal best and worst values based on the impacts.
Score Calculation:

Computes TOPSIS scores using distances to the ideal best and worst values.
Ranking:

Assigns ranks based on the scores (higher scores are better).
Output:

Saves the results (scores and ranks) to the specified output file.
Error Handling


File Not Found:
If the input file does not exist, the script exits with an error message.

Validation Errors:
If the weights/impacts do not match the number of criteria, or if impacts are invalid, appropriate error messages are displayed.

General Errors:
Any other unexpected errors during execution are caught and displayed.

Notes
The first column of the input file is treated as the identifier for alternatives.
Ensure all criteria columns contain numeric values.
Weights must be positive real numbers, and impacts must be + or -.

License
This script is open-source and can be used, modified, and distributed freely.
topsis-shubhaan-102203456 1.2.0
A Python package for the TOPSIS method

# TOPSIS Package

The TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) package is a Python library for multi-criteria decision-making. It helps users rank alternatives based on their proximity to the ideal solution and their distance from the worst-case solution.

## Installation

You can install the package using pip:

```bash
pip install topsis
```

## Usage

The package provides a simple interface for applying the TOPSIS method. Follow these steps:

### Import the Package

```python
from topsis import topsis
```

### Prepare Input Data

You need the following inputs:
1. A decision matrix (a 2D list or NumPy array) where each row represents an alternative and each column represents a criterion.
2. A list of weights for each criterion.
3. A list of impacts for each criterion (either `'+'` for positive impact or `'-'` for negative impact).

#### Example Input:

```python
decision_matrix = [
    [250, 16, 12, 5],
    [200, 20, 15, 6],
    [300, 18, 10, 8],
    [275, 25, 16, 7]
]
weights = [0.25, 0.25, 0.25, 0.25]
impacts = ['+', '+', '-', '+']
```

### Run the TOPSIS Method

Call the `topsis` function with the prepared inputs:

```python
rankings = topsis(decision_matrix, weights, impacts)
```

The `rankings` variable will contain the final rankings of the alternatives.

### Full Example

```python
from topsis import topsis

decision_matrix = [
    [250, 16, 12, 5],
    [200, 20, 15, 6],
    [300, 18, 10, 8],
    [275, 25, 16, 7]
]
weights = [0.25, 0.25, 0.25, 0.25]
impacts = ['+', '+', '-', '+']

rankings = topsis(decision_matrix, weights, impacts)
print("Rankings:", rankings)
```

## Output
The output will be a list containing the rankings of the alternatives, with `1` representing the best alternative.

#### Example Output:

```
Rankings: [2, 3, 1, 4]
```

## Features
- Simple interface for applying the TOPSIS method.
- Supports any number of alternatives and criteria.
- Customizable weights and impacts.

## Testing

Run the unit tests to verify the functionality:

```bash
python -m unittest discover tests
```

## License

This package is licensed under the MIT License. See the LICENSE file for details.
Topsis-Vivek-102203778 0.1.0
A Python package to perform TOPSIS analysis
Requires Python: >=3.6

# Topsis-Vivek-102203778

## Overview

`Topsis-Vivek-102203778` is a Python package that implements the **TOPSIS** (Technique for Order of Preference by Similarity to Ideal Solution) method for multi-criteria decision analysis (MCDA). This package allows you to evaluate and rank alternatives based on multiple criteria, considering both positive and negative impacts of each criterion.

The implementation supports reading input data from a CSV file, applying weights to the criteria, and calculating the TOPSIS score and rankings. The final results are saved to an output CSV file with the TOPSIS score and corresponding rank for each alternative.

## Features

- Normalize the decision matrix.
- Apply weights to the normalized data.
- Identify the ideal best and worst solutions based on the specified impacts.
- Calculate the distances to the ideal best and worst solutions.
- Compute the TOPSIS score for each alternative.
- Rank the alternatives based on the TOPSIS score.
- Save the results in a CSV file.

## Installation

You can install this package from PyPI using the following command:

```bash
pip install Topsis-Vivek-102203778
```bash


## Usage
Please provide the filename for the CSV, including the .csv extension. After that, enter the weights vector with values separated by commas. Following the weights vector, input the impacts vector, where each element is denoted by a plus (+) or minus (-) sign. Lastly, specify the output file name along with the .csv extension.

```py -m topsis.__main__ [input_file_name.csv] [weight as string] [impact as string] [result_file_name.csv]```

## Example Usage
The below example is for the data have 5 columns.
```topsis-vivek input.csv "1,1,2,0.5,0.75" "+,+,-,-,-" output.csv ```

## Example Dataset

Fund Name | P1 | P2 | P3 | P4 | P5
------------ | ------------- | ------------ | ------------- | ------------ | ------------
M1 | 0.78 | 0.61 | 5.5 | 34.7 | 10.4
M2 | 0.88 | 0.77 | 5 | 58.4 | 16.26
M3 | 0.61 | 0.37 | 5.9 | 39.9 | 11.7
M4 | 0.76 | 0.58 | 4.2 | 57.7 | 15.81
M5 | 0.84 | 0.71 | 3.2 | 48 | 13.19
M6 | 0.76 | 0.58 | 4 | 68.8 | 18.54
M7 | 0.81 | 0.66 | 6.5 | 38.2 | 11.54
M8 | 0.81 | 0.66 | 3.2 | 32.8 | 9.37

## Output Dataset
Fund Name | P1 | P2 | P3 | P4 | P5 | TOPSIS Score | Rank
------------ | ------------- | ------------ | ------------- | ------------ | ------------ | ------------ | ------------
M1 | 0.78 | 0.61 | 5.5 | 34.7 | 10.4 | 0.45384759973942024 | 6
M2 | 0.88 | 0.77 | 5 | 58.4 | 16.26 | 0.5250616666395651 | 5
M3 | 0.61 | 0.37 | 5.9 | 39.9 | 11.7 | 0.286469615636936 | 8
M4 | 0.76 | 0.58 | 4.2 | 57.7 | 15.81 | 0.6022625270239917 | 3
M5 | 0.84 | 0.71 | 3.2 | 48 | 13.19 | 0.8452645767159974 | 2
M6 | 0.76 | 0.58 | 4 | 68.8 | 18.54 | 0.5852919015001125 | 4
M7 | 0.81 | 0.66 | 6.5 | 38.2 | 11.54 | 0.3427884605083087 | 7
M8 | 0.81 | 0.66 | 3.2 | 32.8 | 9.37 | 0.8900689209819633 | 1

<br>

## Important Points
1) There should be only numeric columns except the first column i.e. Fund Name.
2) Input file must contain atleast three columns.

<br>