A Python package for simple and efficient implementation of Evidential Reasoning (ER) methods.
Project description
ERTool
ERTool is a Python package designed for simple and efficient implementation of Evidential Reasoning (ER) methods. It aims to provide an intuitive and flexible approach for integrating ER processes, particularly suitable for data analysis and decision support systems.
Features
- Easy-to-use implementation of Evidential Reasoning.
- Efficient in handling complex ER tasks.
- Flexible interface suitable for various application scenarios.
Installation
You can install ERTool directly from PyPI using pip:
pip install ertool
Using Instruction
ertool.er.er_algorithm(W, DBF, numOfChildren, numOfGrades) -> B
Introduction to Input Variables
-
W: A one-dimensional numpy array of floats. It represents the weights of each child node. These weights are used in the algorithm to adjust the influence of each child node.
-
DBF: A two-dimensional numpy array of floats. It stands for "Degrees of Belief" and is one of the main inputs to the algorithm, used to represent the initial belief degrees for each category or grade.
-
numOfChildren: An integer. It indicates the number of child nodes. In the DBF array, this typically corresponds to the number of rows.
-
numOfGrades: An integer. It indicates the number of categories or grades. In the DBF array, this typically corresponds to the number of columns.
Introduction to Output Values
- B Array: Upon completion of the algorithm, the B array is the final calculation result. It reflects the degrees of belief that have been weighted and normalized.
- False (Boolean): It returns B Array if the algorithm successfully executes and completes all computations. If any error is encountered during execution (e.g., division by zero), it returns False.
Quick Start
Here is a basic usage example of ERTool.
Consider a medical scenario. There are three medical experts (weights 10, 8, and 5). For one patient, the three experts rated the different likelihood of the diagnosis of cold, common pneumonia, COVID-19, and uncertain. As shown in the table.
Experts & Diseases | Expert 1 | Expert 2 | Expert 3 |
---|---|---|---|
Cold | 90% | 0 | 0 |
Common Pneumonia | 0 | 90% | 0 |
COVID-19 | 0 | 0 | 90% |
Uncertain | 10% | 10% | 10% |
In this case, the numOfChildren is 3 (the number of experts) and the numOfGrades is 4 (cold, common pneumonia, COVID-19, and uncertain).
The W array is the weights array of every expert and the ERTool package can normalize them automatically.
We can write the code using the ERTool package:
import ertool
import numpy as np
W = np.array([10,8,5])
DBF = np.array([[0.9, 0, 0, 0.1],
[0, 0.9, 0, 0.1],
[0, 0, 0.9, 0.1]])
# List or numpy array are both OK.
# W = [10,8,5]
# DBF = [[0.9, 0, 0, 0.1],
# [0, 0.9, 0, 0.1],
# [0, 0, 0.9, 0.1]]
numOfChildren = 3
numOfGrades = 4
B = ertool.er.er_algorithm(W, DBF, numOfChildren, numOfGrades)
print("B:", B)
With the code, we can calculate the probability that the patient will be diagnosed with each disease using evidential reasoning.
B: [0.43591353 0.30223338 0.15741322 0.10443986]
According to the result, we can know that combining the opinions of the three experts, the probability of the patient being diagnosed with cold, common pneumonia, COVID-19 and uncertain are 0.43591353, 0.30223338, 0.15741322 and 0.10443986.
Contributing
Contributions to ERTool are welcome. Please contact us for how to contribute to the project.
Contact
This project is supported by the National Institute of Health Data Science, Peking University. For any questions or suggestions, please contact us at tyshipku@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ERTool-0.1.5.tar.gz
.
File metadata
- Download URL: ERTool-0.1.5.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14f8ca35e050e81bd91d0eac35fcb701abf8413b792b4336b021c23a1c058fdc |
|
MD5 | 8a8878f5d190c08ca3cef6d613027bb6 |
|
BLAKE2b-256 | 40082a3fd4e41811439197ce347e457da59cdbe92edc89b52d00bbcf0289e556 |
File details
Details for the file ERTool-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: ERTool-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69509c2849a25deb67754cc40f337803e45b9308cfb6b6983ed470aeb60fa5a |
|
MD5 | 23b43612f266019ca97c57f218163b2c |
|
BLAKE2b-256 | 3cc8bf2c25de6120f4573b9ad449d337b4739884d808ae0196836c2fa0f63e2a |