commit 3295a743ef693030d2e72a1981a344ed23f6693d Author: André Almeida Date: Thu May 9 07:41:21 2019 -0700 Add README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..67fe038 --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# 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%. + +![alt text](https://i.postimg.cc/5207cpvs/Captura-de-ecr-2019-04-09-s-13-06-01.png) + + +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 like https://hub.docker.com/r/bitwalker/alpine-erlang and start the container: + +* 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: + +![alt text](https://i.postimg.cc/mg5dTMyB/Captura-de-ecr-2019-04-09-s-13-05-46.png) + + +2. For the second exercise (Baysian Networks): + +c(engine2). +engine2:getp({m2, ok}). + +![alt text](httpshttps://i.postimg.cc/QxBm0Vrz/Captura-de-ecr-2019-04-09-s-15-57-38.png) + +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 + +* **André Almeida** - [andrealmeida.net](https://andrealmeida.net) + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details +