emel/ml/logistic_regression

A classification algorithm used to assign observations to a set of two classes. It transforms its output by using the logistic sigmoid function to return a probability value which can then be mapped to the classes.

Functions

pub fn classifier(
  data: List(#(List(Float), Bool)),
  learning_rate: Float,
  error_threshold: Float,
  max_iterations: Int,
) -> fn(List(Float)) -> Bool

Returns the function that classifies a poin by using the Logistic Regression Algorithm.

Data = [
  {[0.0, 0.0], false},
  {[0.0, 1.0], false},
  {[1.0, 0.0], false},
  {[1.0, 1.0], true}
],
LearningRate = 0.01,
ErrorThreshold = 0.1,
MaxIterations = 1000,
F = emel@ml@logistic_regression:classifier(Data, LearningRate, ErrorThreshold, MaxIterations),
F([1.0, 1.0]).
% true
Search Document