topsisx


Nametopsisx JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/SuvitKumar003/ranklib
SummaryA Python library for Multi-Criteria Decision Making (TOPSIS, AHP, VIKOR, Entropy) with Web Interface
upload_time2025-10-11 06:58:14
maintainerNone
docs_urlNone
authorSuvit Kumar
requires_python>=3.8
licenseNone
keywords mcdm topsis ahp vikor entropy decision-making multi-criteria operations-research optimization
VCS
bugtrack_url
requirements numpy pandas matplotlib argparse fastapi uvicorn streamlit setuptools wheel twine pytest flake8 mypy black pydantic
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TOPSISX 📊

[![PyPI Version](https://img.shields.io/pypi/v/topsisx.svg)](https://pypi.org/project/topsisx/)
[![Python Version](https://img.shields.io/pypi/pyversions/topsisx.svg)](https://pypi.org/project/topsisx/)
[![Downloads](https://static.pepy.tech/badge/topsisx)](https://pepy.tech/project/topsisx)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/SuvitKumar003/ranklib/blob/main/LICENSE)

**TOPSISX** is a comprehensive Python library for **Multi-Criteria Decision Making (MCDM)** with an intuitive web interface. Make data-driven decisions using proven algorithms like TOPSIS, VIKOR, AHP, and Entropy weighting.

---

## ✨ Features

- 🌐 **Web Interface** - Beautiful, user-friendly Streamlit dashboard
- 📊 **Multiple Methods** - TOPSIS, VIKOR, AHP, Entropy weighting
- 📁 **Easy Input** - CSV upload, sample data, or manual entry
- 📈 **Visualizations** - Interactive charts and rankings
- 📄 **PDF Reports** - Professional report generation
- 💻 **CLI Support** - Command-line interface for automation
- 🎯 **Simple API** - Easy integration into your projects

---

## 🚀 Quick Start

### Installation

```bash
pip install topsisx
```

### Option 1: Web Interface (Recommended)

Launch the interactive web app with a single command:

```bash
topsisx --web
```

This will open a beautiful interface in your browser where you can:
- 📤 Upload your CSV file
- 📋 Use sample datasets
- ✏️ Enter data manually
- 🎨 Configure methods and parameters
- 📊 View results and visualizations
- 💾 Download results

### Option 2: Python API

```python
from topsisx.pipeline import DecisionPipeline
import pandas as pd

# Your data
data = pd.DataFrame({
    'Cost': [250, 200, 300, 275, 225],
    'Quality': [16, 16, 32, 32, 16],
    'Time': [12, 8, 16, 8, 16]
})

# Create pipeline
pipeline = DecisionPipeline(weights='entropy', method='topsis')

# Run analysis
result = pipeline.run(data, impacts=['-', '+', '-'])

print(result)
```

### Option 3: Command Line

```bash
# Basic usage
topsisx data.csv --impacts "+,-,+" --output results.csv

# With specific methods
topsisx data.csv --method vikor --weights entropy --impacts "+,-,+"

# Generate PDF report
topsisx data.csv --impacts "+,-,+" --report
```

---

## 📖 Supported Methods

### 1. TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)

Ranks alternatives based on their distance from ideal and anti-ideal solutions.

```python
from topsisx.topsis import topsis

result = topsis(data, weights=[0.3, 0.3, 0.4], impacts=['+', '-', '+'])
```

**Best for:** General-purpose ranking, balanced decision-making

### 2. VIKOR (Compromise Ranking)

Finds compromise solutions considering both group utility and individual regret.

```python
from topsisx.vikor import vikor

result = vikor(data, weights=[0.3, 0.3, 0.4], impacts=['+', '-', '+'], v=0.5)
```

**Best for:** Conflicting criteria, compromise solutions

### 3. AHP (Analytic Hierarchy Process)

Calculates weights through pairwise comparisons.

```python
from topsisx.ahp import ahp
import pandas as pd

# Pairwise comparison matrix
pairwise = pd.DataFrame([
    [1, 3, 5],
    ['1/3', 1, 4],
    ['1/5', '1/4', 1]
])

weights = ahp(pairwise, verbose=True)
```

**Best for:** Subjective criteria, expert judgments

### 4. Entropy Weighting

Calculates objective weights based on data variance.

```python
from topsisx.entropy import entropy_weights

weights = entropy_weights(data.values)
```

**Best for:** Objective weighting, data-driven decisions

---

## 💡 Usage Examples

### Example 1: Laptop Selection

```python
from topsisx.pipeline import DecisionPipeline
import pandas as pd

# Data
laptops = pd.DataFrame({
    'Model': ['Laptop A', 'Laptop B', 'Laptop C', 'Laptop D'],
    'Price': [800, 1200, 1000, 900],
    'RAM_GB': [8, 16, 16, 8],
    'Battery_Hours': [6, 4, 8, 7],
    'Weight_KG': [2.0, 2.5, 1.8, 2.2]
})

# Analysis
pipeline = DecisionPipeline(weights='entropy', method='topsis')
result = pipeline.run(
    laptops,
    impacts=['-', '+', '+', '-']  # Price and Weight are costs
)

print(result)
```

### Example 2: Supplier Selection with AHP

```python
from topsisx.pipeline import DecisionPipeline
import pandas as pd

# Supplier data
suppliers = pd.DataFrame({
    'Supplier': ['S1', 'S2', 'S3'],
    'Cost': [250, 200, 300],
    'Quality': [16, 16, 32],
    'Delivery': [12, 8, 16]
})

# AHP pairwise matrix (Quality > Cost > Delivery)
ahp_matrix = pd.DataFrame([
    [1, 3, 5],      # Quality
    ['1/3', 1, 3],  # Cost
    ['1/5', '1/3', 1]  # Delivery
])

# Analysis with AHP weights
pipeline = DecisionPipeline(weights='ahp', method='topsis')
result = pipeline.run(
    suppliers,
    impacts=['-', '+', '-'],
    pairwise_matrix=ahp_matrix
)

print(result)
```

### Example 3: Compare Methods

```python
from topsisx.pipeline import DecisionPipeline

pipeline = DecisionPipeline(weights='entropy', method='topsis')

# Compare TOPSIS vs VIKOR
comparison = pipeline.compare_methods(
    data=data,
    impacts=['+', '-', '+']
)

print(comparison['comparison'])
```

---

## 🌐 Web Interface Guide

### Starting the Web App

```bash
topsisx --web
```

### Features:

1. **Data Input Options:**
   - 📤 Upload CSV files
   - 📋 Use pre-loaded sample datasets
   - ✏️ Manual data entry

2. **Configuration:**
   - Choose weighting method (Entropy, AHP, Equal)
   - Select ranking method (TOPSIS, VIKOR)
   - Define impact directions (+/-)
   - Set method parameters

3. **Results:**
   - 📊 Interactive ranking tables
   - 📈 Visual charts and graphs
   - 🥇 Top-3 alternatives highlight
   - 💾 Download results as CSV
   - 📄 Generate PDF reports

---

## 🎯 CLI Reference

### Basic Commands

```bash
# Launch web interface
topsisx --web

# Basic analysis
topsisx data.csv --impacts "+,-,+"

# Specify method and weighting
topsisx data.csv --method vikor --weights equal --impacts "+,-,+"

# With ID column preservation
topsisx data.csv --impacts "+,-,+" --id-col "Model"

# Generate report
topsisx data.csv --impacts "+,-,+" --report

# AHP weighting
topsisx data.csv --weights ahp --ahp-matrix ahp.csv --impacts "+,-,+"

# VIKOR with custom v parameter
topsisx data.csv --method vikor --vikor-v 0.7 --impacts "+,-,+"

# Verbose output
topsisx data.csv --impacts "+,-,+" --verbose
```

### Full Options

```
usage: topsisx [-h] [--web] [--weights {entropy,ahp,equal}] 
               [--method {topsis,vikor}] [--impacts IMPACTS]
               [--ahp-matrix AHP_MATRIX] [--vikor-v VIKOR_V]
               [--output OUTPUT] [--report] [--id-col ID_COL]
               [--verbose] [--version] [input]

Options:
  --web                 Launch web interface
  --weights             Weighting method (default: entropy)
  --method              Decision method (default: topsis)
  --impacts             Impact directions (e.g., '+,-,+')
  --ahp-matrix          Path to AHP pairwise comparison matrix
  --vikor-v             VIKOR strategy weight (0-1, default: 0.5)
  --output              Output CSV file path
  --report              Generate PDF report
  --id-col              ID column to preserve
  --verbose             Show detailed information
```

---

## 📁 Data Format

### CSV Format

Your CSV should have:
- **Rows:** Alternatives/options to rank
- **Columns:** Criteria for evaluation
- **Optional:** ID column (will be preserved)

Example `data.csv`:

```csv
Model,Price,RAM,Battery,Weight
Laptop A,800,8,6,2.0
Laptop B,1200,16,4,2.5
Laptop C,1000,16,8,1.8
Laptop D,900,8,7,2.2
```

### Impact Direction

- `+` : Benefit criterion (higher is better) - e.g., Quality, Speed, RAM
- `-` : Cost criterion (lower is better) - e.g., Price, Time, Weight

---

## 📊 Output Format

Results include original data plus:

**TOPSIS:**
- `Topsis_Score`: Similarity to ideal solution (0-1, higher is better)
- `Rank`: Final ranking (1 is best)

**VIKOR:**
- `S`: Group utility measure
- `R`: Individual regret measure
- `Q`: Compromise ranking index
- `Rank`: Final ranking (1 is best)

---

## 🔧 Advanced Usage

### Custom Pipeline

```python
from topsisx.pipeline import DecisionPipeline

# Create custom pipeline
pipeline = DecisionPipeline(
    weights='entropy',
    method='topsis',
    verbose=True  # Show detailed logs
)

# Run with custom parameters
result = pipeline.run(
    data=df,
    impacts=['+', '-', '+'],
    v=0.7  # VIKOR parameter
)
```

### Generate Reports

```python
from topsisx.reports import generate_report

generate_report(
    result,
    method='topsis',
    filename='my_report.pdf'
)
```

### Batch Processing

```python
import glob
from topsisx.pipeline import DecisionPipeline

pipeline = DecisionPipeline(weights='entropy', method='topsis')

# Process multiple CSV files
for csv_file in glob.glob('data/*.csv'):
    df = pd.read_csv(csv_file)
    result = pipeline.run(df, impacts=['+', '-', '+'])
    result.to_csv(f'results/{csv_file}', index=False)
```

---

## 🎓 Methodology

### TOPSIS Algorithm

1. Normalize decision matrix
2. Apply criteria weights
3. Determine ideal (A+) and anti-ideal (A-) solutions
4. Calculate Euclidean distances to A+ and A-
5. Rank by relative closeness to ideal

### VIKOR Algorithm

1. Determine ideal and anti-ideal values
2. Calculate S (group utility) and R (individual regret)
3. Compute Q values as weighted combination
4. Rank alternatives by Q values

### AHP Process

1. Create pairwise comparison matrix (1-9 scale)
2. Normalize matrix by column sums
3. Calculate priority weights (row averages)
4. Check consistency ratio (CR < 0.1)

### Entropy Weighting

1. Normalize data to probability distribution
2. Calculate entropy for each criterion
3. Derive diversity measure (1 - entropy)
4. Normalize diversity to get weights

---

## 📚 API Reference

### DecisionPipeline

```python
DecisionPipeline(weights='entropy', method='topsis', verbose=False)
```

**Methods:**
- `run(data, impacts, pairwise_matrix=None, **kwargs)` - Run analysis
- `compute_weights(data, pairwise_matrix=None)` - Calculate weights
- `compare_methods(data, impacts, pairwise_matrix=None)` - Compare TOPSIS vs VIKOR

### Individual Methods

```python
topsis(data, weights, impacts) -> DataFrame
vikor(data, weights, impacts, v=0.5) -> DataFrame
ahp(pairwise_matrix, verbose=False) -> ndarray
entropy_weights(matrix) -> ndarray
```

---

## 🤝 Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

---

## 📝 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## 👨‍💻 Author

**Suvit Kumar**
- GitHub: [@SuvitKumar003](https://github.com/SuvitKumar003)
- Email: suvitkumar03@gmail.com

---

## 🙏 Acknowledgments

- Based on established MCDM methodologies
- Built with Python, Pandas, NumPy, Streamlit, and Matplotlib
- Inspired by the need for accessible decision-making tools

---

## 📞 Support

- 📖 [Documentation](https://github.com/SuvitKumar003/ranklib/blob/main/README.md)
- 🐛 [Report Issues](https://github.com/SuvitKumar003/ranklib/issues)
- 💬 [Discussions](https://github.com/SuvitKumar003/ranklib/discussions)

---

## ⭐ Star History

If you find this project useful, please consider giving it a star on GitHub!

---

**Made with ❤️ for better decision making**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SuvitKumar003/ranklib",
    "name": "topsisx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "mcdm, topsis, ahp, vikor, entropy, decision-making, multi-criteria, operations-research, optimization",
    "author": "Suvit Kumar",
    "author_email": "suvitkumar03@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b6/c7/1ddc940ec8563c674c642861b32b89d26583028a22cd4bee63ddf21fbf53/topsisx-0.1.4.tar.gz",
    "platform": null,
    "description": "# TOPSISX \ud83d\udcca\r\n\r\n[![PyPI Version](https://img.shields.io/pypi/v/topsisx.svg)](https://pypi.org/project/topsisx/)\r\n[![Python Version](https://img.shields.io/pypi/pyversions/topsisx.svg)](https://pypi.org/project/topsisx/)\r\n[![Downloads](https://static.pepy.tech/badge/topsisx)](https://pepy.tech/project/topsisx)\r\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/SuvitKumar003/ranklib/blob/main/LICENSE)\r\n\r\n**TOPSISX** is a comprehensive Python library for **Multi-Criteria Decision Making (MCDM)** with an intuitive web interface. Make data-driven decisions using proven algorithms like TOPSIS, VIKOR, AHP, and Entropy weighting.\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n- \ud83c\udf10 **Web Interface** - Beautiful, user-friendly Streamlit dashboard\r\n- \ud83d\udcca **Multiple Methods** - TOPSIS, VIKOR, AHP, Entropy weighting\r\n- \ud83d\udcc1 **Easy Input** - CSV upload, sample data, or manual entry\r\n- \ud83d\udcc8 **Visualizations** - Interactive charts and rankings\r\n- \ud83d\udcc4 **PDF Reports** - Professional report generation\r\n- \ud83d\udcbb **CLI Support** - Command-line interface for automation\r\n- \ud83c\udfaf **Simple API** - Easy integration into your projects\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### Installation\r\n\r\n```bash\r\npip install topsisx\r\n```\r\n\r\n### Option 1: Web Interface (Recommended)\r\n\r\nLaunch the interactive web app with a single command:\r\n\r\n```bash\r\ntopsisx --web\r\n```\r\n\r\nThis will open a beautiful interface in your browser where you can:\r\n- \ud83d\udce4 Upload your CSV file\r\n- \ud83d\udccb Use sample datasets\r\n- \u270f\ufe0f Enter data manually\r\n- \ud83c\udfa8 Configure methods and parameters\r\n- \ud83d\udcca View results and visualizations\r\n- \ud83d\udcbe Download results\r\n\r\n### Option 2: Python API\r\n\r\n```python\r\nfrom topsisx.pipeline import DecisionPipeline\r\nimport pandas as pd\r\n\r\n# Your data\r\ndata = pd.DataFrame({\r\n    'Cost': [250, 200, 300, 275, 225],\r\n    'Quality': [16, 16, 32, 32, 16],\r\n    'Time': [12, 8, 16, 8, 16]\r\n})\r\n\r\n# Create pipeline\r\npipeline = DecisionPipeline(weights='entropy', method='topsis')\r\n\r\n# Run analysis\r\nresult = pipeline.run(data, impacts=['-', '+', '-'])\r\n\r\nprint(result)\r\n```\r\n\r\n### Option 3: Command Line\r\n\r\n```bash\r\n# Basic usage\r\ntopsisx data.csv --impacts \"+,-,+\" --output results.csv\r\n\r\n# With specific methods\r\ntopsisx data.csv --method vikor --weights entropy --impacts \"+,-,+\"\r\n\r\n# Generate PDF report\r\ntopsisx data.csv --impacts \"+,-,+\" --report\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcd6 Supported Methods\r\n\r\n### 1. TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)\r\n\r\nRanks alternatives based on their distance from ideal and anti-ideal solutions.\r\n\r\n```python\r\nfrom topsisx.topsis import topsis\r\n\r\nresult = topsis(data, weights=[0.3, 0.3, 0.4], impacts=['+', '-', '+'])\r\n```\r\n\r\n**Best for:** General-purpose ranking, balanced decision-making\r\n\r\n### 2. VIKOR (Compromise Ranking)\r\n\r\nFinds compromise solutions considering both group utility and individual regret.\r\n\r\n```python\r\nfrom topsisx.vikor import vikor\r\n\r\nresult = vikor(data, weights=[0.3, 0.3, 0.4], impacts=['+', '-', '+'], v=0.5)\r\n```\r\n\r\n**Best for:** Conflicting criteria, compromise solutions\r\n\r\n### 3. AHP (Analytic Hierarchy Process)\r\n\r\nCalculates weights through pairwise comparisons.\r\n\r\n```python\r\nfrom topsisx.ahp import ahp\r\nimport pandas as pd\r\n\r\n# Pairwise comparison matrix\r\npairwise = pd.DataFrame([\r\n    [1, 3, 5],\r\n    ['1/3', 1, 4],\r\n    ['1/5', '1/4', 1]\r\n])\r\n\r\nweights = ahp(pairwise, verbose=True)\r\n```\r\n\r\n**Best for:** Subjective criteria, expert judgments\r\n\r\n### 4. Entropy Weighting\r\n\r\nCalculates objective weights based on data variance.\r\n\r\n```python\r\nfrom topsisx.entropy import entropy_weights\r\n\r\nweights = entropy_weights(data.values)\r\n```\r\n\r\n**Best for:** Objective weighting, data-driven decisions\r\n\r\n---\r\n\r\n## \ud83d\udca1 Usage Examples\r\n\r\n### Example 1: Laptop Selection\r\n\r\n```python\r\nfrom topsisx.pipeline import DecisionPipeline\r\nimport pandas as pd\r\n\r\n# Data\r\nlaptops = pd.DataFrame({\r\n    'Model': ['Laptop A', 'Laptop B', 'Laptop C', 'Laptop D'],\r\n    'Price': [800, 1200, 1000, 900],\r\n    'RAM_GB': [8, 16, 16, 8],\r\n    'Battery_Hours': [6, 4, 8, 7],\r\n    'Weight_KG': [2.0, 2.5, 1.8, 2.2]\r\n})\r\n\r\n# Analysis\r\npipeline = DecisionPipeline(weights='entropy', method='topsis')\r\nresult = pipeline.run(\r\n    laptops,\r\n    impacts=['-', '+', '+', '-']  # Price and Weight are costs\r\n)\r\n\r\nprint(result)\r\n```\r\n\r\n### Example 2: Supplier Selection with AHP\r\n\r\n```python\r\nfrom topsisx.pipeline import DecisionPipeline\r\nimport pandas as pd\r\n\r\n# Supplier data\r\nsuppliers = pd.DataFrame({\r\n    'Supplier': ['S1', 'S2', 'S3'],\r\n    'Cost': [250, 200, 300],\r\n    'Quality': [16, 16, 32],\r\n    'Delivery': [12, 8, 16]\r\n})\r\n\r\n# AHP pairwise matrix (Quality > Cost > Delivery)\r\nahp_matrix = pd.DataFrame([\r\n    [1, 3, 5],      # Quality\r\n    ['1/3', 1, 3],  # Cost\r\n    ['1/5', '1/3', 1]  # Delivery\r\n])\r\n\r\n# Analysis with AHP weights\r\npipeline = DecisionPipeline(weights='ahp', method='topsis')\r\nresult = pipeline.run(\r\n    suppliers,\r\n    impacts=['-', '+', '-'],\r\n    pairwise_matrix=ahp_matrix\r\n)\r\n\r\nprint(result)\r\n```\r\n\r\n### Example 3: Compare Methods\r\n\r\n```python\r\nfrom topsisx.pipeline import DecisionPipeline\r\n\r\npipeline = DecisionPipeline(weights='entropy', method='topsis')\r\n\r\n# Compare TOPSIS vs VIKOR\r\ncomparison = pipeline.compare_methods(\r\n    data=data,\r\n    impacts=['+', '-', '+']\r\n)\r\n\r\nprint(comparison['comparison'])\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udf10 Web Interface Guide\r\n\r\n### Starting the Web App\r\n\r\n```bash\r\ntopsisx --web\r\n```\r\n\r\n### Features:\r\n\r\n1. **Data Input Options:**\r\n   - \ud83d\udce4 Upload CSV files\r\n   - \ud83d\udccb Use pre-loaded sample datasets\r\n   - \u270f\ufe0f Manual data entry\r\n\r\n2. **Configuration:**\r\n   - Choose weighting method (Entropy, AHP, Equal)\r\n   - Select ranking method (TOPSIS, VIKOR)\r\n   - Define impact directions (+/-)\r\n   - Set method parameters\r\n\r\n3. **Results:**\r\n   - \ud83d\udcca Interactive ranking tables\r\n   - \ud83d\udcc8 Visual charts and graphs\r\n   - \ud83e\udd47 Top-3 alternatives highlight\r\n   - \ud83d\udcbe Download results as CSV\r\n   - \ud83d\udcc4 Generate PDF reports\r\n\r\n---\r\n\r\n## \ud83c\udfaf CLI Reference\r\n\r\n### Basic Commands\r\n\r\n```bash\r\n# Launch web interface\r\ntopsisx --web\r\n\r\n# Basic analysis\r\ntopsisx data.csv --impacts \"+,-,+\"\r\n\r\n# Specify method and weighting\r\ntopsisx data.csv --method vikor --weights equal --impacts \"+,-,+\"\r\n\r\n# With ID column preservation\r\ntopsisx data.csv --impacts \"+,-,+\" --id-col \"Model\"\r\n\r\n# Generate report\r\ntopsisx data.csv --impacts \"+,-,+\" --report\r\n\r\n# AHP weighting\r\ntopsisx data.csv --weights ahp --ahp-matrix ahp.csv --impacts \"+,-,+\"\r\n\r\n# VIKOR with custom v parameter\r\ntopsisx data.csv --method vikor --vikor-v 0.7 --impacts \"+,-,+\"\r\n\r\n# Verbose output\r\ntopsisx data.csv --impacts \"+,-,+\" --verbose\r\n```\r\n\r\n### Full Options\r\n\r\n```\r\nusage: topsisx [-h] [--web] [--weights {entropy,ahp,equal}] \r\n               [--method {topsis,vikor}] [--impacts IMPACTS]\r\n               [--ahp-matrix AHP_MATRIX] [--vikor-v VIKOR_V]\r\n               [--output OUTPUT] [--report] [--id-col ID_COL]\r\n               [--verbose] [--version] [input]\r\n\r\nOptions:\r\n  --web                 Launch web interface\r\n  --weights             Weighting method (default: entropy)\r\n  --method              Decision method (default: topsis)\r\n  --impacts             Impact directions (e.g., '+,-,+')\r\n  --ahp-matrix          Path to AHP pairwise comparison matrix\r\n  --vikor-v             VIKOR strategy weight (0-1, default: 0.5)\r\n  --output              Output CSV file path\r\n  --report              Generate PDF report\r\n  --id-col              ID column to preserve\r\n  --verbose             Show detailed information\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcc1 Data Format\r\n\r\n### CSV Format\r\n\r\nYour CSV should have:\r\n- **Rows:** Alternatives/options to rank\r\n- **Columns:** Criteria for evaluation\r\n- **Optional:** ID column (will be preserved)\r\n\r\nExample `data.csv`:\r\n\r\n```csv\r\nModel,Price,RAM,Battery,Weight\r\nLaptop A,800,8,6,2.0\r\nLaptop B,1200,16,4,2.5\r\nLaptop C,1000,16,8,1.8\r\nLaptop D,900,8,7,2.2\r\n```\r\n\r\n### Impact Direction\r\n\r\n- `+` : Benefit criterion (higher is better) - e.g., Quality, Speed, RAM\r\n- `-` : Cost criterion (lower is better) - e.g., Price, Time, Weight\r\n\r\n---\r\n\r\n## \ud83d\udcca Output Format\r\n\r\nResults include original data plus:\r\n\r\n**TOPSIS:**\r\n- `Topsis_Score`: Similarity to ideal solution (0-1, higher is better)\r\n- `Rank`: Final ranking (1 is best)\r\n\r\n**VIKOR:**\r\n- `S`: Group utility measure\r\n- `R`: Individual regret measure\r\n- `Q`: Compromise ranking index\r\n- `Rank`: Final ranking (1 is best)\r\n\r\n---\r\n\r\n## \ud83d\udd27 Advanced Usage\r\n\r\n### Custom Pipeline\r\n\r\n```python\r\nfrom topsisx.pipeline import DecisionPipeline\r\n\r\n# Create custom pipeline\r\npipeline = DecisionPipeline(\r\n    weights='entropy',\r\n    method='topsis',\r\n    verbose=True  # Show detailed logs\r\n)\r\n\r\n# Run with custom parameters\r\nresult = pipeline.run(\r\n    data=df,\r\n    impacts=['+', '-', '+'],\r\n    v=0.7  # VIKOR parameter\r\n)\r\n```\r\n\r\n### Generate Reports\r\n\r\n```python\r\nfrom topsisx.reports import generate_report\r\n\r\ngenerate_report(\r\n    result,\r\n    method='topsis',\r\n    filename='my_report.pdf'\r\n)\r\n```\r\n\r\n### Batch Processing\r\n\r\n```python\r\nimport glob\r\nfrom topsisx.pipeline import DecisionPipeline\r\n\r\npipeline = DecisionPipeline(weights='entropy', method='topsis')\r\n\r\n# Process multiple CSV files\r\nfor csv_file in glob.glob('data/*.csv'):\r\n    df = pd.read_csv(csv_file)\r\n    result = pipeline.run(df, impacts=['+', '-', '+'])\r\n    result.to_csv(f'results/{csv_file}', index=False)\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udf93 Methodology\r\n\r\n### TOPSIS Algorithm\r\n\r\n1. Normalize decision matrix\r\n2. Apply criteria weights\r\n3. Determine ideal (A+) and anti-ideal (A-) solutions\r\n4. Calculate Euclidean distances to A+ and A-\r\n5. Rank by relative closeness to ideal\r\n\r\n### VIKOR Algorithm\r\n\r\n1. Determine ideal and anti-ideal values\r\n2. Calculate S (group utility) and R (individual regret)\r\n3. Compute Q values as weighted combination\r\n4. Rank alternatives by Q values\r\n\r\n### AHP Process\r\n\r\n1. Create pairwise comparison matrix (1-9 scale)\r\n2. Normalize matrix by column sums\r\n3. Calculate priority weights (row averages)\r\n4. Check consistency ratio (CR < 0.1)\r\n\r\n### Entropy Weighting\r\n\r\n1. Normalize data to probability distribution\r\n2. Calculate entropy for each criterion\r\n3. Derive diversity measure (1 - entropy)\r\n4. Normalize diversity to get weights\r\n\r\n---\r\n\r\n## \ud83d\udcda API Reference\r\n\r\n### DecisionPipeline\r\n\r\n```python\r\nDecisionPipeline(weights='entropy', method='topsis', verbose=False)\r\n```\r\n\r\n**Methods:**\r\n- `run(data, impacts, pairwise_matrix=None, **kwargs)` - Run analysis\r\n- `compute_weights(data, pairwise_matrix=None)` - Calculate weights\r\n- `compare_methods(data, impacts, pairwise_matrix=None)` - Compare TOPSIS vs VIKOR\r\n\r\n### Individual Methods\r\n\r\n```python\r\ntopsis(data, weights, impacts) -> DataFrame\r\nvikor(data, weights, impacts, v=0.5) -> DataFrame\r\nahp(pairwise_matrix, verbose=False) -> ndarray\r\nentropy_weights(matrix) -> ndarray\r\n```\r\n\r\n---\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please:\r\n\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes\r\n4. Add tests if applicable\r\n5. Submit a pull request\r\n\r\n---\r\n\r\n## \ud83d\udcdd License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\n## \ud83d\udc68\u200d\ud83d\udcbb Author\r\n\r\n**Suvit Kumar**\r\n- GitHub: [@SuvitKumar003](https://github.com/SuvitKumar003)\r\n- Email: suvitkumar03@gmail.com\r\n\r\n---\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\n- Based on established MCDM methodologies\r\n- Built with Python, Pandas, NumPy, Streamlit, and Matplotlib\r\n- Inspired by the need for accessible decision-making tools\r\n\r\n---\r\n\r\n## \ud83d\udcde Support\r\n\r\n- \ud83d\udcd6 [Documentation](https://github.com/SuvitKumar003/ranklib/blob/main/README.md)\r\n- \ud83d\udc1b [Report Issues](https://github.com/SuvitKumar003/ranklib/issues)\r\n- \ud83d\udcac [Discussions](https://github.com/SuvitKumar003/ranklib/discussions)\r\n\r\n---\r\n\r\n## \u2b50 Star History\r\n\r\nIf you find this project useful, please consider giving it a star on GitHub!\r\n\r\n---\r\n\r\n**Made with \u2764\ufe0f for better decision making**\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python library for Multi-Criteria Decision Making (TOPSIS, AHP, VIKOR, Entropy) with Web Interface",
    "version": "0.1.4",
    "project_urls": {
        "Bug Reports": "https://github.com/SuvitKumar003/ranklib/issues",
        "Documentation": "https://github.com/SuvitKumar003/ranklib/blob/main/README.md",
        "Homepage": "https://github.com/SuvitKumar003/ranklib",
        "Source": "https://github.com/SuvitKumar003/ranklib"
    },
    "split_keywords": [
        "mcdm",
        " topsis",
        " ahp",
        " vikor",
        " entropy",
        " decision-making",
        " multi-criteria",
        " operations-research",
        " optimization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1356113ee4e38e971fbedf05bd1cf9fe96925cf96a93812b9106db5975b723d7",
                "md5": "a4b27d03e33e721d445ca3803f35522f",
                "sha256": "5bfa92744fa92b8597043e04e1998ba0e202fe3dd3147ead6a3fd6b744a05475"
            },
            "downloads": -1,
            "filename": "topsisx-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4b27d03e33e721d445ca3803f35522f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21637,
            "upload_time": "2025-10-11T06:58:12",
            "upload_time_iso_8601": "2025-10-11T06:58:12.179472Z",
            "url": "https://files.pythonhosted.org/packages/13/56/113ee4e38e971fbedf05bd1cf9fe96925cf96a93812b9106db5975b723d7/topsisx-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b6c71ddc940ec8563c674c642861b32b89d26583028a22cd4bee63ddf21fbf53",
                "md5": "0784caa475b893dce07574f3f5ebc048",
                "sha256": "65ce685356392015c44fe18b29e30993b7aac695141573b0e5c25dc13b14f1ba"
            },
            "downloads": -1,
            "filename": "topsisx-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0784caa475b893dce07574f3f5ebc048",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22138,
            "upload_time": "2025-10-11T06:58:14",
            "upload_time_iso_8601": "2025-10-11T06:58:14.137772Z",
            "url": "https://files.pythonhosted.org/packages/b6/c7/1ddc940ec8563c674c642861b32b89d26583028a22cd4bee63ddf21fbf53/topsisx-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-11 06:58:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SuvitKumar003",
    "github_project": "ranklib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.24.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.8.0"
                ]
            ]
        },
        {
            "name": "argparse",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "fastapi",
            "specs": [
                [
                    ">=",
                    "0.110.0"
                ]
            ]
        },
        {
            "name": "uvicorn",
            "specs": [
                [
                    ">=",
                    "0.23.0"
                ]
            ]
        },
        {
            "name": "streamlit",
            "specs": [
                [
                    ">=",
                    "1.34.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "68.0.0"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": [
                [
                    ">=",
                    "0.43.0"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "8.2.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    ">=",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "24.3.0"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.7.0"
                ]
            ]
        }
    ],
    "lcname": "topsisx"
}
        
Elapsed time: 1.13845s