|
|
--- |
|
|
title: Text2MCDM |
|
|
emoji: π― |
|
|
colorFrom: gray |
|
|
colorTo: blue |
|
|
sdk: gradio |
|
|
sdk_version: "5.31.0" |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
--- |
|
|
|
|
|
# Text2MCDM |
|
|
|
|
|
How do you make decisions when your reasoning is messy and contains uncertainty, subjectivity, or contradictions? This project leverages large language models fine-tuned to extract Z-number decision matrix from natural language narrative. The extracted matrix is then analyzed using z-number-based Multi-Criteria Decision-Making (MCDM) methods (TOPSIS, PROMETHEE). |
|
|
|
|
|
[](https://huggingface.co/spaces/nuriyev/text2mcdm) |
|
|
|
|
|
[Demo](https://huggingface.co/spaces/nuriyev/text2mcdm) | [Model](https://huggingface.co/nuriyev/Qwen3-4B-znum-decision-matrix) | [Dataset](https://huggingface.co/datasets/nuriyev/text2mcdm) |
|
|
|
|
|
## Usage |
|
|
|
|
|
```bash |
|
|
python text2mcdm.py --query "Your decision problem here" --method topsis |
|
|
``` |
|
|
|
|
|
**Arguments:** |
|
|
|
|
|
| Argument | Default | Description | |
|
|
|----------|---------|-------------| |
|
|
| `--query`, `-q` | (built-in example) | Decision narrative | |
|
|
| `--method` | `topsis` | MCDM algorithm: `topsis` or `promethee` | |
|
|
|
|
|
**Example:** |
|
|
|
|
|
```bash |
|
|
python text2mcdm.py --query "I'm trying to decide between taking a train, flying, or driving for my upcoming trip from Paris to Amsterdam, and I need to figure out what actually matters here. Environmental impact is absolutely my top priority, like I cannot stress this enough, I've been trying to reduce my carbon footprint all year and this is non-negotiable for me. The train is obviously amazing for this, planes are a disaster environmentally, and driving alone isn't great either but better than flying I guess. Cost matters somewhat but honestly I have some savings and this is a special trip so I'm not going to stress about it too muchβtrains are reasonable, flights can be cheap with budget airlines, driving with gas and tolls probably adds up. Comfort is kind of important to me since I get motion sick and anxious in certain situations, and trains are super relaxing with legroom and wifi, planes make me nervous and cramped, cars are fine but I'd be exhausted from driving. Time efficiency barely matters since I'm not in a rush at all and I'm taking the whole week off anywayβI know planes are fastest at like an hour, trains take about 3 hours, driving is maybe 5 hours, but whatever, I have time. Oh and reliability is pretty important because I absolutely cannot miss my friend's wedding ceremony on Saturday, and trains are almost always on time, flights get delayed constantly especially budget ones, and driving you could hit traffic or car trouble." --method topsis |
|
|
``` |
|
|
|
|
|
**Output:** |
|
|
|
|
|
Extracted decision matrix: |
|
|
|
|
|
| | environmental_impact | travel_cost | comfort_level | time_efficiency | reliability | |
|
|
|---|---|---|---|---|---| |
|
|
| type | benefit | cost | benefit | benefit | benefit | |
|
|
| train | 5:5 | -3:4 | 4:4 | 2:5 | 5:5 | |
|
|
| flight | 1:5 | -2:4 | 2:4 | 5:5 | 2:4 | |
|
|
| driving | 3:4 | -4:3 | 3:3 | 3:4 | 3:3 | |
|
|
| weight | 5:5 | 3:4 | 4:4 | 1:5 | 5:5 | |
|
|
|
|
|
> NOTE: Each cell contains `a:b` indicating a fuzzy rating `a` with confidence level `b`. Every number (`a` and `b`) is on a scale from 1 to 5 and is mapped to predefined z-number A and B fuzzy sets. |
|
|
|
|
|
Ranking (TOPSIS): |
|
|
|
|
|
``` |
|
|
1. train |
|
|
2. driving |
|
|
3. flight |
|
|
``` |
|
|
|
|
|
## Directory Structure |
|
|
|
|
|
``` |
|
|
. |
|
|
βββ data/ # Training data |
|
|
βββ helpers/ # Helper modules |
|
|
βββ outputs/ # Model checkpoints |
|
|
βββ qwen3_finetune.ipynb # Fine-tuning notebook |
|
|
βββ znum_data_gen.py # Data generation script |
|
|
βββ validate_znum.py # Data validation script |
|
|
βββ text2mcdm.py # Inference and MCDM analysis |
|
|
``` |
|
|
|
|
|
## Data Generation |
|
|
|
|
|
`znum_data_gen.py` generates training data using the Gemini API. `validate_znum.py` validates the generated data. See `--help` for options. |
|
|
|
|
|
## Model |
|
|
|
|
|
Fine-tuned model: [`nuriyev/Qwen3-4B-znum-decision-matrix`](https://huggingface.co/nuriyev/Qwen3-4B-znum-decision-matrix) |
|
|
|
|
|
## TODO |
|
|
|
|
|
- Add adversarial training examples |
|
|
- Handle cases where the user mentions alternatives or criteria to exclude |
|
|
- Handle missing data from user queries |
|
|
- By asking follow-up questions |
|
|
- Or by making assumptions based on context |
|
|
|