Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mcda-analyzer

БесплатноБез исполняемых скриптовНе проверен

Multi-criteria decision analysis skill with AHP, TOPSIS, and weighted scoring methods.

a5c-aiот a5c-ai★ 1 947 звёзд на GitHub

Об этом скилле

mcda-analyzer

You are mcda-analyzer - a specialized skill for multi-criteria decision analysis including AHP, TOPSIS, and weighted scoring methods.

Overview

This skill enables AI-powered decision analysis including:

  • Analytic Hierarchy Process (AHP)
  • TOPSIS (Technique for Order Preference by Similarity)
  • Weighted scoring methods
  • Pairwise comparison matrices
  • Consistency ratio calculation
  • Sensitivity analysis
  • Decision visualization
  • Criteria weighting

Capabilities

1. Analytic Hierarchy Process (AHP)

import numpy as np
import pandas as pd

def ahp_analysis(criteria: list, pairwise_matrix: np.ndarray):
    """
    Analytic Hierarchy Process for criteria weighting

    criteria: list of criterion names
    pairwise_matrix: n x n matrix of pairwise comparisons
    """
    n = len(criteria)

    # Calculate priority vector (principal eigenvector)
    # Simplified: normalized column average method
    col_sums = pairwise_matrix.sum(axis=0)
    normalized = pairwise_matrix / col_sums
    priorities = normalized.mean(axis=1)

    # Calculate consistency
    weighted_sum = pairwise_matrix @ priorities
    lambda_max = np.mean(weighted_sum / priorities)

    # Consistency Index
    ci = (lambda_max - n) / (n - 1) if n > 1 else 0

    # Random Index (for n = 1 to 10)
    ri_values = {1: 0, 2: 0, 3: 0.58, 4: 0.90, 5: 1.12,
                 6: 1.24, 7: 1.32, 8: 1.41, 9: 1.45, 10: 1.49}
    ri = ri_values.get(n, 1.49)

    # Consistency Ratio
    cr = ci / ri if ri > 0 else 0

    return {
        "criteria": criteria,
        "priorities": dict(zip(criteria, priorities)),
        "lambda_max": round(lambda_max, 4),
        "consistency_index": round(ci, 4),
        "consistency_ratio": round(cr, 4),
        "is_consistent": cr < 0.10,
        "interpretation": "Consistent" if cr < 0.10 else "Inconsistent - revise judgments"
    }

def create_pairwise_matrix(judgments: dict, criteria: list):
    """
    Create pairwise comparison matrix from judgments

    judgments: {(criterion1, criterion2): value} where value is relative importance
    Scale: 1=equal, 3=moderate, 5=strong, 7=very strong, 9=extreme
    """
    n = len(criteria)
    matrix = np.ones((n, n))

    idx = {c: i for i, c in enumerate(criteria)}

    for (c1, c2), value in judgments.items():
        i, j = idx[c1], idx[c2]
        matrix[i, j] = value
        matrix[j, i] = 1 / value

    return matrix

2. TOPSIS Analysis

def topsis_analysis(alternatives: list, criteria: list, decision_matrix: np.ndarray,
                   weights: list, criteria_types: list):
    """
    TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)

    alternatives: list of alternative names
    criteria: list of criterion names
    decision_matrix: m alternatives x n criteria matrix
    weights: criterion weights (sum to 1)
    criteria_types: list of 'benefit' or 'cost' for each criterion
    """
    m, n = decision_matrix.shape

    # Step 1: Normalize decision matrix
    # Vector normalization
    norm_divisors = np.sqrt((decision_matrix ** 2).sum(axis=0))
    normalized = decision_matrix / norm_divisors

    # Step 2: Weighted normalized matrix
    weighted = normalized * weights

    # Step 3: Determine ideal and anti-ideal solutions
    ideal = np.zeros(n)
    anti_ideal = np.zeros(n)

    for j in range(n):
        if criteria_types[j] == 'benefit':
            ideal[j] = weighted[:, j].max()
            anti_ideal[j] = weighted[:, j].min()
        else:  # cost criterion
            ideal[j] = weighted[:, j].min()
            anti_ideal[j] = weighted[:, j].max()

    # Step 4: Calculate distances
    dist_to_ideal = np.sqrt(((weighted - ideal) ** 2).sum(axis=1))
    dist_to_anti = np.sqrt(((weighted - anti_ideal) ** 2).sum(axis=1))

    # Step 5: Calculate relative closeness
    closeness = dist_to_anti / (dist_to_ideal + dist_to_anti)

    # Rank alternatives
    ranking = np.argsort(-closeness) + 1  # 1 is best

    results = []
    for i, alt in enumerate(alternatives):
        results.append({
            'alternative': alt,
            'closeness_coefficient': round(closeness[i], 4),
            'distance_to_ideal': round(dist_to_ideal[i], 4),
            'distance_to_anti_ideal': round(dist_to_anti[i], 4),
            'rank': int(ranking[i])
        })

    results.sort(key=lambda x: x['rank'])

    return {
        "ranking": results,
        "best_alternative": results[0]['alternative'],
        "ideal_solution": dict(zip(criteria, ideal)),
        "anti_ideal_solution": dict(zip(criteria, anti_ideal))
    }

3. Weighted Scoring Method

def weighted_scoring(alternatives: list, criteria: list,
                    scores: np.ndarray, weights: list):
    """
    Simple weighted scoring method

    alternatives: list of alternative names
    criteria: list of criterion names
    scores: m x n matrix of scores (0-10 scale typical)
    weights: criterion weights (sum to 1)
Полный SKILL.md на GitHub

Установить mcda-analyzer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(*)
Read
Write
Edit
Glob
Grep
WebFetch

FAQ

Что делает скилл mcda-analyzer?

Multi-criteria decision analysis skill with AHP, TOPSIS, and weighted scoring methods.

Как установить скилл mcda-analyzer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mcda-analyzer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mcda-analyzer с