Flex.Variable (FLex v0.2.2)

View Source

An interface to create Fuzzy Variables.

Summary

Types

t()

Fuzzy Variable struct.

Functions

Turns an antecedent fuzzy variable (input) from a crisp value to a fuzzy value.

Creates a Fuzzy Variable.

Updates a consequent Fuzzy Variable (ANFIS).

Updates an antecedent Fuzzy Variable (ANFIS).

Types

t()

@type t() :: %Flex.Variable{
  fuzzy_sets: [Flex.Set.t(), ...],
  mf_values: %{},
  range: any(),
  rule_output: term(),
  tag: String.t(),
  type: :antecedent | :consequent
}

Fuzzy Variable struct.

  • :tag - (string) Defines the linguistic name of the fuzzy variable (e.g., "error").
  • :fuzzy_sets - (list) Defines which all the fuzzy sets related to the variable.
  • :mf_values - (map) The current values of each of the membership functions of the fuzzy sets.
  • :range - (range) The range in which the variable exists.
  • :type - (atom) :antecedent if the variable is an input or consequent for outputs.

Functions

fuzzification(fuzzy_var, input)

@spec fuzzification(t(), any()) :: :error | t()

Turns an antecedent fuzzy variable (input) from a crisp value to a fuzzy value.

new(params)

@spec new(keyword()) :: t()

Creates a Fuzzy Variable.

The following options are require:

  • :tag - (string) Defines the linguistic name of the fuzzy variable (e.g., "error"),
  • :fuzzy_sets - (list) Defines which type of membership function use the set (e.g., "triangle").
  • :type - (atom) Defines the type of variable (e.g., :antecedent or :consequent),
  • :range - (range) The range in which the variable exists.

update(fuzzy_variable, x_vector)

@spec update(t(), list()) :: t()

Updates a consequent Fuzzy Variable (ANFIS).

update(fuzzy_variable, gradients, learning_rate)

@spec update(t(), list(), number()) :: t()

Updates an antecedent Fuzzy Variable (ANFIS).