101 lines
3.1 KiB
Markdown
101 lines
3.1 KiB
Markdown
# Erlang Decision Tree and Baysian Networks
|
|
|
|

|
|
|
|
This repository have two different exercises in erlang:
|
|
|
|
**1.Decision tree that maximizes the optimal point and consequently provides decision support based on the assumptions provided.**
|
|
|
|
* The probability of making a medication/treatment 1 and use is OK of 42%;
|
|
* One possibility of making a medication/treatment 1 and of the user staying KO is 22.5%;
|
|
* The probability of making a medication/treatment 1 and is not conclusive is 35.6%;
|
|
* The probability of making a medication/treatment 2 and staying OK is 62%;
|
|
* The probability of making a medication/treatment 2 and getting KO is 38%.
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
**2.There are ways to get the probabilities knowing certain parameters (they do not indicate the optimal point, but calculate a probability of success depending on the existing resources) - using the baysian networks.**
|
|
|
|
What is the probability of giving the patient M2 and is OK, knowing that:
|
|
|
|
* The probability of administering M1 and the patient is OK is 20%;
|
|
* The probability of administering M2 knowing that I administered M1 and the patient being OK is 70%;
|
|
* The probability of administering M2 knowing that I did not administer M1 and the patient is OK of 20%.
|
|
|
|
### Prerequisites
|
|
|
|
Basic knowledge of erlang, algorithm and statistics.
|
|
|
|
* erlang - https://www.erlang.org;
|
|
|
|
|
|
### Install or use Docker
|
|
|
|
If you prefer install the erlang compiler, please search for the appropriate installation for your OS.
|
|
|
|
If you prefer you can use Docker to test this solution.
|
|
Get a [docker container](https://hub.docker.com/search?q=erlang&type=image) and start the container.
|
|
|
|
I suggest [this container](https://hub.docker.com/r/bitwalker/alpine-erlang) and run:
|
|
|
|
```
|
|
docker pull bitwalker/alpine-erlang
|
|
docker run --rm -it --user=root bitwalker/alpine-erlang
|
|
```
|
|
|
|
### Run the solution
|
|
|
|
1. For the first exercise (Decision Tree):
|
|
|
|
```
|
|
c(engine).
|
|
engine:doAll().
|
|
```
|
|
|
|
and the best solution is:
|
|
|
|

|
|
|
|
** You can do a medication 1 and medication 2 of 97.6% of success to be OK.**
|
|
|
|
|
|
|
|
|
|
|
|
2. For the second exercise (Baysian Networks):
|
|
|
|
```
|
|
c(engine3).
|
|
engine3:getp({m2, ok}).
|
|
```
|
|
|
|
|
|

|
|
|
|
**There is a 16% chance that the patient will be OK administering the drug M2.**
|
|
|
|
## Built With
|
|
|
|
* erlang - https://www.erlang.org;
|
|
|
|
## Contributing
|
|
|
|
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on my code of conduct, and the process for submitting pull requests to me.
|
|
|
|
## Versioning
|
|
|
|
I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.andrealmeida.net/public_projects/erlang-decision-tree/tags).
|
|
|
|
## Authors
|
|
|
|
[](https://andrealmeida.net)
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
|
|