Skip to content

Linear

Linear

Bases: Term

Linear polynomial term.

Equation

\(\mu(x)= \mathbf{c}\mathbf{v}+k = \sum_i c_iv_i + k\)

where

  • \(x\): irrelevant
  • \(\mathbf{v}\): vector of values from the input variables
  • \(\mathbf{c}\) vector of coefficients for the input variables
  • \(k\) is a constant

Attributes

coefficients instance-attribute

coefficients = list(coefficients or [])

engine instance-attribute

engine = engine

Functions

__init__

__init__(name: str = '', coefficients: Sequence[float] | None = None, engine: Engine | None = None) -> None

Constructor.

Parameters:

Name Type Description Default
name str

name of the term

''
coefficients Sequence[float] | None

coefficients for the input variables (plus constant \(k\), optionally)

None
engine Engine | None

engine with the input variables

None

__repr__

__repr__() -> str

Return the code to construct the term in Python.

Returns:

Type Description
str

code to construct the term in Python.

configure

configure(parameters: str) -> None

Configure the term with the parameters.

Parameters:

Name Type Description Default
parameters str

coefficients c1 ... cn k.

required

membership

membership(x: Scalar) -> Scalar

Compute the membership function evaluated at \(x\).

Parameters:

Name Type Description Default
x Scalar

scalar

required

Returns:

Type Description
Scalar

\(\mu(x)=\sum_i c_iv_i + k\)

Raises:

Type Description
ValueError

when the number of coefficients (+1) is different from the number of input variables

parameters

parameters() -> str

Return the parameters of the term.

Returns:

Type Description
str

c1 ... cn k.

update_reference

update_reference(engine: Engine | None) -> None

Set the reference to the engine.

Parameters:

Name Type Description Default
engine Engine | None

engine with the input variables

required