emel v0.3.0 Emel.Ml.LogisticRegression View Source
A classification algorithm used to assign observations to a set of two classes. It transforms its output using the logistic sigmoid function to return a probability value which can then be mapped to the classes.
Link to this section Summary
Functions
Returns the function that classifies an item (or a list of items) by using the Logistic Regression Algorithm
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)
View Source
Returns the function that classifies an item (or a list of items) by using the Logistic Regression Algorithm.
Examples
iex> f = Emel.Ml.LogisticRegression.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, 0.5, 0.001, 100)
...> f.(%{a: 1, b: 1})
true
iex> f = Emel.Ml.LogisticRegression.classifier([%{x: 0.0, y: 0.1, greater_than: false},
...> %{x: 0.3, y: 0.2, greater_than: true},
...> %{x: 0.2, y: 0.3, greater_than: false},
...> %{x: 0.3, y: 0.4, greater_than: false},
...> %{x: 0.4, y: 0.3, greater_than: true},
...> %{x: 0.5, y: 0.5, greater_than: false},
...> %{x: 0.5, y: 0.6, greater_than: false},
...> %{x: 0.1, y: 0.2, greater_than: false},
...> %{x: 0.0, y: 0.0, greater_than: false},
...> %{x: 0.1, y: 0.0, greater_than: true},
...> %{x: 0.2, y: 0.1, greater_than: true},
...> %{x: 0.6, y: 0.7, greater_than: false},
...> ], [:x, :y], :greater_than, 0.2, 0.01, 1000)
...> f.([%{x: 0.2, y: 0.1},
...> %{x: 0.3, y: 0.2},
...> %{x: 0.1, y: 0.3},
...> %{x: 0.3, y: 0.1},
...> %{x: 0.5, y: 0.4},
...> %{x: 0.5, y: 0.5}])
[true, true, false, true, true, false]