semvec/pypi-packages huggingface dataset:
TOPSIS-SatvikMehra-101803278 0.0.1
TOPSIS Implementation

# TOPSIS

## What is TOPSIS?
Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) originated in the 1980s as a multi-criteria decision making method. TOPSIS chooses the alternative of shortest Euclidean distance from the ideal solution, and greatest distance from the negative-ideal solution.
## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install **TOPSIS**.
Dependencies and devDependencies will be installed automatically.

```bash
pip install TOPSIS-SatvikMehra-101803278
```

## Usage
##### 1) As a Library:
Import in your python File:
```python
from TOPSIS import topsis
topsis()
```
Run the python file by typing in terminal/cmd:
```sh
python nameOfFile.py nameOfDataFile.csv "weights" "impacts" nameOfOutputFile.csv
```
##### 2) Using Command Promt:

Command line args:
- name of input File(csv format)
- weights(as a string)
- impacts(as a string)
- name of output file(csv format)
Eg. 
```bash
topsis data.csv "1,1,1,1" "+,+,-,+" output.csv
```

# Input file (data.csv)
The decision matrix should be constructed with each row representing a Model alternative, and each column representing a criterion like Accuracy, R2, Root Mean Squared Error, Correlation, and many more.

|Model|Corr|Rseq|RMSE|Accuracy|
|---|----|----|----|--------|
|M1   |0.79|0.62|1.25|60.89   |
|M2   |0.66|0.44|2.89|63.07   |
|M3   |0.56|0.31|1.57|62.87   |
|M4   |0.82|0.67|2.68|70.19   |
|M5   |0.75|0.56|1.3 |80.39   |

Weights (`weights`) is not already normalised will be normalised later in the code.

Information of benefit positive(+) or negative(-) impact criteria should be provided in impacts.
# Output file (output.csv)

|Model|Corr|Rseq|RMSE|Accuracy|Topsis_score       |Rank|
|---|----|----|----|--------|-------------------|----|
|M1   |0.79|0.62|1.25|60.89   |0.7722097345612788 |2   |
|M2   |0.66|0.44|2.89|63.07   |0.22559875426413367|5   |
|M3   |0.56|0.31|1.57|62.87   |0.43889731728018605|4   |
|M4   |0.82|0.67|2.68|70.19   |0.5238778712729114 |3   |
|M5   |0.75|0.56|1.3 |80.39   |0.8113887082429979 |1   |

The output file contains columns of input file along with two additional columns having **Topsis_score** and **Rank**
## License
[MIT](https://choosealicense.com/licenses/mit/)
TOPSIS-Ansh-101803295 1.0.1
The Technique for Order of Preference by Similarity to the Ideal Solution

# TOPSIS

Code by: Ansh Garg

<hr style = "border:2px solid gray"> </hr>
## What is TOPSIS

TOPSIS stands for â€˜The Technique for Order of Preference by Similarity to the Ideal Solutionâ€™ is a multi-criteria decision analysis(MCDA) method. It is a method of compensatory aggregation that compares a set of alternatives by identifying weights for each criterion, normalising scores for each criterion and calculating the geometric distance between each alternative and the ideal alternative, which is the best score in each criterion.


## How to run

#### Before running, make sure you have pandas installed on your system

Open Terminal and input the following commands


>> pip install Topsis-Ansh-101803295

To get started quickly, just use the following:

>> from TOPSIS_Ansh_101803295.topsis import topsis <br>
>> topsis('inputfilename','Weights','Impacts','Outputfilename')

make ensure the weights and impacts should be in ""

eg: "1,1,1,1" and "+,-,+,-"

## Pre-requisite
The data should be enclosed in the csv file. There must be more than 2 columns


## Result
the output(outputfilename)  is saved in the project folder with extra 2 columns with topsis score and rank.


## Sample Input

This input was used to test the module

<table><thead><tr><th>Model</th><th>Corr</th><th>Rseq</th><th>RMSE</th><th>Accuracy</th></tr></thead><tbody><tr><td>M1</td><td>0.79</td><td>0.62</td><td>1.25</td><td>60.89</td></tr><tr><td>M2</td><td>0.66</td><td>0.44</td><td>2.89</td><td>63.07</td></tr><tr><td>M3</td><td>0.56</td><td>0.31</td><td>1.57</td><td>62.87</td></tr><tr><td>M4</td><td>0.82</td><td>0.67</td><td>2.68</td><td>70.19</td></tr><tr><td>M5</td><td>0.75</td><td>0.56</td><td>1.3</td><td>80.39</td></tr></tbody></table>

## Output


<table><thead><tr><th>Model</th><th align="right">Corr</th><th align="center">Rseq</th><th>RMSE</th><th>Accuracy</th><th>Topsis Score</th><th>Rank</th></tr></thead><tbody><tr><td>M1</td><td align="right">0.79</td><td align="center">0.62</td><td>1.25</td><td>60.89</td><td>0.639133</td><td>2.0</td></tr><tr><td>M2</td><td align="right">0.66</td><td align="center">0.44</td><td>2.89</td><td>63.07</td><td>0.212592</td><td>5.0</td></tr><tr><td>M3</td><td align="right">0.56</td><td align="center">0.31</td><td>1.57</td><td>62.87</td><td>0.407846</td><td>4.0</td></tr><tr><td>M4</td><td align="right">0.82</td><td align="center">0.67</td><td>2.68</td><td>70.19</td><td>0.519153</td><td>3.0</td></tr><tr><td>M5</td><td align="right">0.75</td><td align="center">0.56</td><td>1.3</td><td>80.39</td><td>0.828267</td><td>1.0</td></tr></tbody></table>


## License

Â© 2020 Ansh Garg

This repository is licensed under the MIT license. See LICENSE for details.