emel v0.1.2 Ml.ArtificialNeuron View Source

A mathematical function conceived as a model of biological neurons. Receives one or more separately weighted inputs, sums them and passes the sum through an activation function to produce an output.

Link to this section Summary

Link to this section Functions

Link to this function classifier(dataset, continuous_attributes, boolean_class, learning_rate \\ 0.0001, err_thres \\ 0.1, max_iter \\ 10000, activation_function \\ &Calculus.logistic_function/1, activation_derivative \\ &Calculus.logistic_derivative/1) View Source

Returns the function that classifies an item by using the Artificial Neuron Function.

Examples

iex> f = Ml.ArtificialNeuron.classifier([%{a: 0, b: 0, and: false},
...>                                     %{a: 0, b: 1, and: false},
...>                                     %{a: 1, b: 0, and: false},
...>                                     %{a: 1, b: 1, and: true},
...>                                    ], [:a, :b], :and)
...> f.(%{a: 1, b: 1})
true

iex> f = Ml.ArtificialNeuron.classifier([%{x: 0.0, y: 0.1, x_greater_than_y: false},
...>                                     %{x: 0.3, y: 0.2, x_greater_than_y: true},
...>                                     %{x: 0.2, y: 0.3, x_greater_than_y: false},
...>                                     %{x: 0.3, y: 0.4, x_greater_than_y: false},
...>                                     %{x: 0.4, y: 0.3, x_greater_than_y: true},
...>                                     %{x: 0.5, y: 0.5, x_greater_than_y: true},
...>                                     %{x: 0.5, y: 0.6, x_greater_than_y: false},
...>                                     %{x: 0.1, y: 0.2, x_greater_than_y: false},
...>                                     %{x: 0.0, y: 0.0, x_greater_than_y: true},
...>                                     %{x: 0.1, y: 0.0, x_greater_than_y: true},
...>                                     %{x: 0.2, y: 0.1, x_greater_than_y: true},
...>                                     %{x: 0.6, y: 0.7, x_greater_than_y: false},
...>                                    ], [:x, :y], :x_greater_than_y, 0.5, 0.001, 100)
...> f.(%{x: 0.45, y: 0.55})
false