semvec/pypi-packages huggingface dataset:
Topsis-Parth-102203636 1.0.0
Multiple criteria decision making for selection of best model
License: MIT

# TOPSIS Implementation in Python

## About TOPSIS
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a multi-criteria decision analysis method which was originally developed by Hwang and Yoon in 1981. TOPSIS chooses the alternative that is the closest to the positive ideal solution and farthest from the negative ideal solution.

## Installation

```bash
pip install topsis
```

## Usage
The program accepts the following arguments:
1. Input file (.csv)
2. Weights (comma-separated)
3. Impacts (comma-separated)
4. Output file (.csv)

```bash
python topsis.py input.csv "1,1,1,2,2" "+,-,-,+,-" output.csv
```

## Input File Format
Input file must contain three or more columns:
* First column: Object/Variable name
* Second to last columns: Criteria values
* File must be a CSV file (.csv extension)

Sample input file:
```csv
Fund Name,P1,P2,P3,P4,P5
M1,0.68,0.48,13.07,0.74,0.87
M2,0.78,0.61,14.85,0.71,0.29
M3,0.61,0.37,14.01,0.71,0.95
M4,0.76,0.39,11.11,0.77,0.14
M5,0.59,0.41,11.32,0.82,0.55
```

## Output Format
Output file contains all the columns of input file along with two additional columns having normalized scores and ranks.

Sample output file:
```csv
Fund Name,P1,P2,P3,P4,P5,Topsis Score,Rank
M1,0.68,0.48,13.07,0.74,0.87,0.7722,2
M2,0.78,0.61,14.85,0.71,0.29,0.6253,4
M3,0.61,0.37,14.01,0.71,0.95,0.8231,1
M4,0.76,0.39,11.11,0.77,0.14,0.5486,5
M5,0.59,0.41,11.32,0.82,0.55,0.6791,3
```

## Parameters

### Weights
Weights indicate the relative importance of each criterion. They should be provided as comma-separated values. Number of weights should be equal to number of criteria.

Example: `"1,1,1,2,2"`

### Impacts
Impacts decide whether the criterion is to be maximized (+) or minimized (-). They should be provided as comma-separated values. Number of impacts should be equal to number of criteria.

Example: `"+,-,-,+,-"`

## Error Handling
The program handles the following errors:
* Input file does not exist
* Input file is not a CSV file
* Input file has less than 3 columns
* Number of weights, impacts is not equal to number of criteria
* Impacts are not either '+' or '-'
* Non-numeric values in criteria columns

## Example
Consider a real estate decision problem with the following criteria:
1. Cost (-)
2. Square footage (+)
3. Distance to city center (-)
4. Age of building (-)
5. Number of rooms (+)

```bash
python topsis.py houses.csv "0.25,0.25,0.15,0.15,0.20" "-,+,-,-,+" output.csv
```

## Dependencies
* Python 3.x
* Pandas
* NumPy

## License
This project is licensed under MIT License - see the LICENSE file for details.

## Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
string-to-code 0.5.0
Generates a piece of messy code in a given language displaying a given string 
License: MIT
Requires Python: <4.0.0,>=3.10
Keywords: code-generation

`string_to_code`
================

[![python_test](https://github.com/vil02/string_to_code_proj/actions/workflows/python_test.yml/badge.svg)](https://github.com/vil02/string_to_code_proj/actions/workflows/python_test.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vil02_string_to_code_proj&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vil02_string_to_code_proj)
[![codecov](https://codecov.io/gh/vil02/string_to_code_proj/branch/master/graph/badge.svg?token=EZN5LIK387)](https://codecov.io/gh/vil02/string_to_code_proj)
[![CodeFactor](https://www.codefactor.io/repository/github/vil02/string_to_code_proj/badge)](https://www.codefactor.io/repository/github/vil02/string_to_code_proj)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/db4940f574964617abc44d57ee4e7c9b)](https://app.codacy.com/gh/vil02/string_to_code_proj/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

Basic functionality of
[`string_to_code`](https://github.com/vil02/string_to_code_proj)
is to generate a piece of _messy_ code printing a given string.

Examples and documentation can be found on [GitHub](https://github.com/vil02/string_to_code_proj).
type-comparable 2.1
Helper for checking variable equivalence by type. Useful for tests.
License: MIT
Requires Python: >=3.7
Keywords: test, tests, pytest, pytest-pluggin, type, typing

About
=====

Module allows to compare variables not only by value but by type too. 

Quick example:

.. code-block:: python

    from typing import Any

    from type_comparable import make_type_comparable

    response = {
        'id': 144233,
        'date_create': '2020-01-25T17:31:33.910803',
        'important_data': 'important data',
        'other_data': 'other data',
        'inner_data': {
            'field a': 'value a',
            'field d': 'value b'
        },
        'line': [1, 'some text', 3]
    }
    assert make_type_comparable(response) == {
        'id': int,  # <-- will compare by type int
        'date_create': str, # < -- will compare by type str
        'important_data': 'important data',  # <-- exact match as is
        'other_data': Any, # <-- allow any data,
        'inner_date': {  # <-- also work with nested dictionaries
            'field a': str,
            'field b': 'value b'
        }
        'line': [int, Any, 3]  # <- check elements in array
    }

    # if you don't want wrap left variable (response) if can wrap right:
    assert response == make_type_comparable(...)

Very useful for tests by pytest.


Support types
=============

Comparable types (which can be passed to `make_type_comparable()`):

- `int`
- `bool`
- `str`
- `list`
- `dict`
- other

Types for comparison:

- all python builtin (`int`, `str`, `bool`, `list`, `dict`, etc.)
- `object` and `typing.Any` - mean any type but not `None`
- `typing.Optional` - mean any type and `None`. `Optional[int]` now not supported

Also you can try to use with your custom types but without guaranteed (verify 
manually before use in product)


Know issues
===========

Wrapped `None` is not `None` :-(

.. code-block:: python

    >> make_type_comparable(None) is None
    False

    # use equal
    >> make_type_comparable(None) == None
    True


Install
=======

From PyPi:

.. code-block:: bash

    $ pip install type_comparable


From local:

.. code-block:: bash

    # update setuptools
    $ pip install 'setuptools >= 30.4'
    # do install
    $ make install
    # or
    $ pip install .


Development
===========

Prepare and activate virtual environment like:

.. code-block:: bash

    $ python3 -m venv .env
    # for bash
    $ source .env/bin/activate
    # for fish
    $ . .env/bin/activate.fish
    
Update pre-install dependencies:

.. code-block:: bash

    $ pip install 'setuptools >= 30.4'


Install:

.. code-block:: bash

    $ make install_dev
    # or
    $ pip install --editable .[develop]

Run tests:

.. code-block:: bash

    $ make test
    # or 
    $ pytest tests/