V2.0(2023-07-26): Supplement the code
V1.0(2023-07-25): Some necessary formulas are missing, and the explanation is not clear enough
algorithm thinking
Introducing: Subjective Scoring Problems
In general, it is used in small sample data. If there are other options, other algorithms can be used instead.
By establishing a hierarchical structure, multiple subjective judgments are transformed into objective pairwise comparisons, and qualitative judgments that are difficult to quantify are transformed into operable element comparisons. Therefore, it is often used to solve evaluation problems.
Hierarchical structure
- target layer
- Standard layer
- Program layer
for example:
Choice of travel destination (covers multiple factors)
Choice of school (covers multiple factors)
Goal: Solve evaluation problems
Use scoring ideas to solve
Weight --> Importance thinking
- Scoring Method Realization Problem Realization Form
Features of evaluation questions
Determine evaluation indicators and form an evaluation system
Questions to think about:
- What is the purpose of the evaluation
- We have a branch plan to achieve this goal
- Evaluation Criteria or Indicators
Evaluation questions background search engine
Google—>bing—>Baidu—>Zhihu—>WeChat
Specify indicator weight
Divide and Conquer: Pairwise Comparisons
- Scale satisfaction on a scale of 1-9
Abstraction of evaluation form - judgment matrix
-
The meaning expressed by Aij is, compared with the index j, the importance of i
-
When i=j, the index is the same, set to 1
-
Aij and satisfy Aij*Aji =1 (positive reciprocal matrix)
-
Consistent matrix: satisfy Aij*Ajk=1
Rows and columns are in multiples
consistency check
The judgment matrices constructed in the AHP are all consistent matrices with multiple relations
Before calculating the weight of the judgment matrix, a consistency check must be carried out
A consistent matrix has one eigenvalue of n and the rest of the eigenvalues are 0.
in conclusion:
When the n-order positive and reciprocal matrix A is a straight matrix, if and only if the largest eigenvalue λ=n, λ>n when it is inconsistent
1. Calculate the consistency index CI
where λ is the maximum value of the eigenvalues of the judgment matrix
n is the order of the judgment matrix
2. Find the corresponding average random consistency index RI
constructed using random sampling
3. Calculate the consistency ratio CR
CR=CI/RI
If CR<0.1, it can be considered that the consistency of the judgment matrix is acceptable, otherwise the judgment matrix needs to be corrected
Weights need to be normalized
Calculate the ratio as an arithmetic ratio
If the judgment matrix is not a positive and reciprocal matrix, then all the data can be used
- Calculate the weight of each column
- arithmetic mean
Weight solution method
Arithmetic average method to find weight
- Normalize the judgment matrix by column
- Adding the normalized columns
- Divide each element of the added vector by n to get the weight vector
The weight vector obtained by the arithmetic mean method
Geometric mean method to find weight
- Multiply the elements of A by row to get a new column vector
- Raise each component of the new vector to the nth power
- normalize
Eigenvalue method
tip: Generally speaking, you will choose to use the eigenvalues to solve the weights
A consistent matrix has one eigenvalue n and the rest eigenvalues are 0
step:
- Find the largest eigenvalue of matrix A and its corresponding eigenvector
- Find the eigenvector and normalize to get our weight
Obtain the evaluation result through the weight matrix
Use Excel to solve the evaluation results
-
Use F4 to lock the indicator weight column
AHP steps
Step 1: Hierarchy Diagram
Target layer Objective
Criterion layer
Program layer Plan
Generated with SmartArt
The method that comes with PPT
Generated by Edraw icon
or similar professional software
Step 2: Construct the Judgment Matrix
Construct judgment matrix OC
C1-C2-C3-C4-C5 can generate five judgment matrices
Step 3: The judgment matrix passes the consistency test
(The test can only be used if the weight is passed)
The calculation of weight in the game can use the eigenvalue method more
Highlights: In order to ensure the robustness of the results
This paper uses three methods to calculate the weight, and then calculates the scores of each scheme according to the weight, and performs sorting and comprehensive analysis to avoid the deviation caused by using one method
Step 4: Calculate the synthetic weight of each layer element to the system target, and sort them
Limitations of AHP
- There should not be too many decision-making layers, otherwise the error between the judgment matrix and the consistency matrix will be too large