View Source Flex.System (FLex v0.2.1)

An interface to create a Fuzzy Logic Control System (FLS).

The Fuzzy controllers are very simple conceptually. They consist of an input stage (fuzzification), a processing stage (inference), and an output stage (defuzzification).

Link to this section Summary

Types

t()

Fuzzy Logic System state.

Functions

Adjust the premise free parameters of the FIS (only avaliable with ANFIS engine), using the following methods

Returns a specification to start this module under a supervisor.

Computes the Fuzzy Logic System output for a given input vector.

Adjust the consequent free parameters of the FIS (only avaliable with ANFIS engine), using the following methods

Gets the current system state.

Adjust the free parameters of the FIS (only avaliable with ANFIS engine), using the following methods

Adjust the free parameters of the FIS (only avaliable with ANFIS engine), using the following methods

Callback implementation for GenServer.init/1.

Sets the Inference Engine type.

Sets the Learning rate (etha).

Spawns a Fuzzy Logic System.

Link to this section Types

@type t() :: %Flex.System.State{
  antecedent: [Flex.Variable.t(), ...],
  consequent: Flex.Variable.t(),
  engine_output: Flex.EngineAdapter.engine_state(),
  engine_type:
    Flex.EngineAdapter.Mamdani
    | Flex.EngineAdapter.TakagiSugeno
    | Flex.EngineAdapter.ANFIS,
  initial_gamma: number(),
  learning_rate: number(),
  rules: [Flex.Rule.t(), ...],
  sets_in_rules: list()
}

Fuzzy Logic System state.

  • :rules - (list) A list of rules that defines the behavior of the Fuzzy logic systems.
  • :consequent - Output variable.
  • :antecedent - a list of the input variables.
  • :engine_type - defines the inference engine behavior (default: Mamdini).
  • :sets_in_rules - list of sets involve in the rules (optional, required by ANFIS).
  • :learning_rate - is the speed at which the system parameters are adjusted (ANFIS only).
  • :initial_gamma - is the speed at which the system parameters are adjusted (LSE, ANFIS only).

Link to this section Functions

Link to this function

backward_pass(pid, desired_output)

View Source
@spec backward_pass(
  atom() | pid() | {atom(), any()} | {:via, atom(), any()},
  number()
) ::
  {:ok, number()} | {:error, :einval}

Adjust the premise free parameters of the FIS (only avaliable with ANFIS engine), using the following methods:

  • Learning method: Steepest gradient Backpropagation.
  • Energy function: 0.5 * (target - output)^2

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

compute(pid, input_vector)

View Source
@spec compute(atom() | pid() | {atom(), any()} | {:via, atom(), any()}, list()) ::
  any()

Computes the Fuzzy Logic System output for a given input vector.

Link to this function

forward_pass(pid, desired_output)

View Source
@spec forward_pass(atom() | pid() | {atom(), any()} | {:via, atom(), any()}, number()) ::
  {:ok, number()} | {:error, :einval}

Adjust the consequent free parameters of the FIS (only avaliable with ANFIS engine), using the following methods:

  • Learning method: Steepest gradient Backpropagation.
  • Energy function: 0.5 * (target - output)^2
@spec get_state(atom() | pid() | {atom(), any()} | {:via, atom(), any()}) :: t()

Gets the current system state.

Link to this function

hybrid_offline_learning(pid, inputs, targets, epochs)

View Source
@spec hybrid_offline_learning(
  atom() | pid() | {atom(), any()} | {:via, atom(), any()},
  list(),
  list(),
  number()
) :: {:ok, number()} | {:error, :einval}

Adjust the free parameters of the FIS (only avaliable with ANFIS engine), using the following methods:

  • Forward method: Least Square Estimate.
  • Learning method: Steepest gradient Backpropagation.
  • Energy function: 0.5 * (target - output)^2 Note: this functions fires both forward and backward passes with a batch of data.
Link to this function

hybrid_online_learning(pid, desired_output)

View Source
@spec hybrid_online_learning(
  atom() | pid() | {atom(), any()} | {:via, atom(), any()},
  number()
) ::
  {:ok, number()} | {:error, :einval}

Adjust the free parameters of the FIS (only avaliable with ANFIS engine), using the following methods:

  • Learning method: Steepest gradient Backpropagation.
  • Energy function: 0.5 * (target - output)^2 Note: this functions fires both forward and backward passes.

Callback implementation for GenServer.init/1.

Link to this function

set_engine_type(pid, type)

View Source
@spec set_engine_type(
  atom() | pid() | {atom(), any()} | {:via, atom(), any()},
  atom()
) ::
  :ok | {:error, :einval}

Sets the Inference Engine type.

Link to this function

set_learning_rate(pid, learning_rate)

View Source
@spec set_learning_rate(
  atom() | pid() | {atom(), any()} | {:via, atom(), any()},
  number()
) ::
  :ok | {:error, :einval}

Sets the Learning rate (etha).

Link to this function

start_link(params, opt \\ [])

View Source

Spawns a Fuzzy Logic System.

The following options are require:

  • :rules - Defines the behavior of the system based on a list of rules.
  • :antecedent - (list) Defines the input variables.
  • :consequent - Defines the output variable.