https://github.com/gorosgobe/decision-ex
My first attempt at Elixir, a basic implementation of decision trees.
https://github.com/gorosgobe/decision-ex
classification classification-algorithm classification-trees decision-trees elixir elixir-lang information-gain
Last synced: 3 months ago
JSON representation
My first attempt at Elixir, a basic implementation of decision trees.
- Host: GitHub
- URL: https://github.com/gorosgobe/decision-ex
- Owner: gorosgobe
- Created: 2017-12-14T01:29:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-26T17:51:21.000Z (almost 8 years ago)
- Last Synced: 2025-06-02T22:02:20.331Z (4 months ago)
- Topics: classification, classification-algorithm, classification-trees, decision-trees, elixir, elixir-lang, information-gain
- Language: Elixir
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# decision-ex
My first attempt at Elixir, a basic implementation of decision trees.
Implementation based on the Decision Trees 2017 Haskell exam for first year Computing students at Imperial College London, course taught by Tony Field.
Spec available at: https://www.doc.ic.ac.uk/~ajf/haskelltests/decisiontrees/spec.pdf# How to use
Using the Elixir interpreter:```elixir
$ iex utils.exs
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> c "decisionTree.exs"
[DecisionTree]
iex(2)> c "attSelector.exs"
[AttSelector]
iex(3)> c "naiveAttSelector.exs"
[NaiveAttSelector]
iex(4)> c "informationGainSelector.exs"
[InformationGainSelector]
iex(5)> DecisionTree.buildTree DecisionTree.fishingData, DecisionTree.result, InformationGainSelector
{:node, "outlook",
[{"sunny",
{:node, "humidity",
[{"high", {:leaf, "bad"}}, {"normal", {:leaf, "good"}}]}},
{"overcast", {:leaf, "good"}},
{"rainy",
{:node, "wind", [{"windy", {:leaf, "bad"}}, {"calm", {:leaf, "good"}}]}}]}
iex(6)> DecisionTree.buildTree DecisionTree.fishingData, DecisionTree.result, NaiveAttSelector
{:node, "outlook",
[{"sunny",
{:node, "temp",
[{"hot", {:leaf, "bad"}},
{"mild",
{:node, "humidity",
[{"high", {:leaf, "bad"}}, {"normal", {:leaf, "good"}}]}},
{"cool", {:leaf, "good"}}]}}, {"overcast", {:leaf, "good"}},
{"rainy",
{:node, "temp",
[{"hot", {:null}},
{"mild",
{:node, "humidity",
[{"high",
{:node, "wind",
[{"windy", {:leaf, "bad"}}, {"calm", {:leaf, "good"}}]}},
{"normal", {:leaf, "good"}}]}},
{"cool",
{:node, "humidity",
[{"high", {:null}},
{"normal",
{:node, "wind",
[{"windy", {:leaf, "bad"}}, {"calm", {:leaf, "good"}}]}}]}}]}}]}```