emel v0.1.2 Help.Model View Source

Link to this section Summary

Functions

Returns a function that transforms a value of a continuous attribute to a value of a discrete attribute

Applies feature scaling on the dataset’s numeric values of keys and reduces them to a scale between 0 and 1

Trims and parses the string into a float

Separates the dataset into a training set and testing set

Link to this section Functions

Link to this function categorizer(categories_separated_by_thresholds) View Source

Returns a function that transforms a value of a continuous attribute to a value of a discrete attribute.

Examples

iex> f = Help.Model.categorizer(["small", 7.0, "moderate", 12.0, "large"])
...> f.(8.0)
"moderate"

iex> f = Help.Model.categorizer(["small", 7.0, "moderate", 12.0, "large"])
...> f.(6.0)
"small"

iex> f = Help.Model.categorizer(["non positive", 0.0, "positive"])
...> f.(-0.3)
"non positive"

iex> f = Help.Model.categorizer(["non positive", 0.0, "positive"])
...> f.(0.0)
"non positive"
Link to this function normalize(dataset, keys) View Source

Applies feature scaling on the dataset’s numeric values of keys and reduces them to a scale between 0 and 1.

Examples

iex> Help.Model.normalize([%{a: 0}, %{a: 1}], [:a])
[%{a: 0.0}, %{a: 1.0}]

iex> Help.Model.normalize([%{"x" => 1}, %{"x" => 2}, %{"x" => 1.5}], ["x"])
[%{"x" => 0.0}, %{"x" => 1.0}, %{"x" => 0.5}]

iex> Help.Model.normalize([%{"x" => 1, "y" => -2, "z" => -4}, %{"x" => 2, "y" => 2, "z" => -8}], ["y", "z"])
[%{"x" => 1, "y" => 0.0, "z" => 1.0}, %{"x" => 2, "y" => 1.0, "z" => 0.0}]

Trims and parses the string into a float.

Link to this function training_and_test_sets(dataset, ratio) View Source

Separates the dataset into a training set and testing set.