Giter Site home page Giter Site logo

gorosgobe / decision-ex Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 12 KB

My first attempt at Elixir, a basic implementation of decision trees.

Elixir 100.00%
elixir elixir-lang decision-trees information-gain classification-algorithm classification classification-trees

decision-ex's Introduction

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:

$ 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"}}]}}]}}]}}]}

decision-ex's People

Contributors

gorosgobe avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.