### Glob Examples Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/operation Retrieve examples from the library based on the specified return type. ```python glob_examples( return_type: Literal["module"], module: ModuleType | None = None, recursive: bool = True ) -> Iterable[ModuleType] ``` ```python glob_examples( return_type: Literal["engine"], module: ModuleType | None = None, recursive: bool = True ) -> Iterable[Engine] ``` ```python glob_examples( return_type: Literal["dataset"] | Literal["fld"], module: ModuleType | None = None, recursive: bool = True ) -> Iterable[ScalarArray] ``` ```python glob_examples( return_type: Literal["language"] | Literal["fll"], module: ModuleType | None = None, recursive: bool = True ) -> Iterable[str] ``` ```python glob_examples( return_type: Literal["files"], module: ModuleType | None = None, recursive: bool = True ) -> Iterable[Path] ``` ```python glob_examples( return_type: ( Literal["module"] | Literal["engine"] | Literal["dataset"] | Literal["fld"] | Literal["language"] | Literal["fll"] | Literal["files"] ) = "engine", module: ModuleType | None = None, recursive: bool = True, ) -> Iterable[ModuleType | Engine | ScalarArray | str | Path] ``` -------------------------------- ### glob_examples Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/operation Glob the examples (alphabetically and in ascending order) returning the specified type. This method is useful for discovering and retrieving example data structures from the library. ```APIDOC ## glob_examples ### Description Glob the examples (alphabetically and in ascending order) returning the specified type. ### Method staticmethod ### Parameters #### Query Parameters - **return_type** (Literal['module'] | Literal['engine'] | Literal['dataset'] | Literal['fld'] | Literal['language'] | Literal['fll'] | Literal['files']) - Optional - type of objects to return. Default: 'engine' - **module** (ModuleType | None) - Optional - package (eg, `fuzzylite.examples`) or module (eg, `fuzzylite.examples.terms.arc`) to glob. Default: None - **recursive** (bool) - Optional - recursively glob into subdirectories. Default: True ### Yields - **Type** (Iterable[ModuleType | Engine | ScalarArray | str | Path]) - Description: Iterable of the specified type. ``` -------------------------------- ### Configure Comparator Parameters Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/activation Configures the activation method with the specified comparator and threshold parameters. Example format: '> 0.5'. ```python configure(parameters: str) -> None ``` -------------------------------- ### Benchmark Class Method for_example in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/benchmark/Benchmark Creates and returns a Benchmark instance configured for a specific example module. Allows customization of data rows, shuffling, and seeding. ```python for_example(example: ModuleType, rows: int | float = 1.0, shuffle: bool = True, seed: int | None = None) -> Benchmark ``` -------------------------------- ### Initialize TermFactory - pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/TermFactory Constructs a new TermFactory instance. No specific setup or imports are required beyond the class definition. ```python __init__() -> None ``` -------------------------------- ### Get Comparator Parameters Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/activation Returns the current comparator and threshold settings as a string. Useful for inspecting the configuration. ```python parameters() -> str ``` -------------------------------- ### Arc Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Arc Initializes a new Arc instance with optional name, start, end, and height parameters. ```python __init__(name: str = '', start: float = nan, end: float = nan, height: float = 1.0) -> None ``` -------------------------------- ### Configure Binary Term Parameters in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Binary Configures the Binary Term using a string of parameters. The expected format is 'start direction [height]'. ```python configure(parameters: str) -> None Configure the term with the parameters. Parameters: Name | Type | Description | Default ---|---|---|--- `parameters` | `str` | `start direction [height]`. | _required_ ``` -------------------------------- ### Initialize First activation Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/First Constructor for the First activation method. ```python __init__(rules: int = 1, threshold: float = 0.0) -> None ``` -------------------------------- ### Initialize Node Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Constructor for creating a new Node instance. ```python __init__( element: Element | None = None, variable: str = "", constant: float = nan, left: Node | None = None, right: Node | None = None, ) -> None ``` -------------------------------- ### GET /highest_activated_term Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Finds the term with the maximum aggregated activation degree. ```APIDOC ## GET /highest_activated_term ### Description Find the term with the maximum aggregated activation degree. ### Method GET ### Endpoint /highest_activated_term ### Response #### Success Response (200) - **Activated | None** - term with the maximum aggregated activation degree. ``` -------------------------------- ### Get Node Value Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Retrieves the string representation of the node's content. ```python value() -> str ``` -------------------------------- ### GET /grouped_terms Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Retrieves grouped activated terms and their aggregated activation degrees. ```APIDOC ## GET /grouped_terms ### Description Group the activated terms and aggregate their activation degrees. ### Method GET ### Endpoint /grouped_terms ### Response #### Success Response (200) - **dict[str, Activated]** - grouped activated terms by name with aggregated activation degrees. ``` -------------------------------- ### Engine Initialization Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/engine/Engine Constructor for creating a new Engine instance with optional variables and rule blocks. ```APIDOC ## __init__ ### Description Initializes a new Engine instance. ### Parameters #### Request Body - **name** (str) - Optional - name of the engine - **description** (str) - Optional - description of the engine - **input_variables** (Iterable[InputVariable] | None) - Optional - list of input variables - **output_variables** (Iterable[OutputVariable] | None) - Optional - list of output variables - **rule_blocks** (Iterable[RuleBlock] | None) - Optional - list of rule blocks - **load** (bool) - Optional - whether to automatically update references to this engine and load the rules in the rule blocks. ``` -------------------------------- ### RuleBlock __init__ Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/rule/RuleBlock Initializes a new RuleBlock instance. Configure name, description, enabled status, and fuzzy logic operators. ```python __init__( name: str = "", description: str = "", enabled: bool = True, conjunction: TNorm | None = None, disjunction: SNorm | None = None, implication: TNorm | None = None, activation: Activation | None = None, rules: Iterable[Rule] | None = None, ) -> None ``` -------------------------------- ### Get package name Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/library/Representation Returns the qualified class name for a given object. ```python package_of(x: Any) -> str ``` -------------------------------- ### Get List of Functions Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/FunctionFactory Retrieves a list of all available functions managed by the FunctionFactory. ```python _create_functions() -> list[Element] ``` -------------------------------- ### Import FuzzyLite Language File Source: https://fuzzylite.github.io/pyfuzzylite Loads a fuzzy logic engine configuration from a FuzzyLite Language (.fll) file. ```python import fuzzylite as fl engine = fl.FllImporter().from_file("examples/mamdani/ObstacleAvoidance.fll") ``` -------------------------------- ### Get Final Representation Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/library Assigns the final representation object to the 'repr' attribute. ```python repr: Final = repr ``` -------------------------------- ### Get method arity Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/operation Returns the number of arguments expected by the provided callable. ```python arity_of(method: Callable) -> int ``` -------------------------------- ### Configure activation parameters Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/First Configures the activation method using a string of parameters. ```python configure(parameters: str) -> None ``` -------------------------------- ### General Activation Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/activation Activates every rule of a rule block in insertion order. ```APIDOC ## General Bases: `Activation` Activation method that activates every rule of a rule block in insertion order. ### Functions #### `activate(rule_block: RuleBlock)` ``` activate(rule_block: RuleBlock) -> None ``` Activate every rule in the rule block in the order they were added. Parameters: Name | Type | Description | Default ---|---|---|--- `rule_block` | `RuleBlock` | rule block to activate. | _required_ ``` -------------------------------- ### SShape Attributes Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/SShape Represents the start and end points of the S-shaped membership function. ```python start = start ``` ```python end = end ``` -------------------------------- ### ActivationFactory Class Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/ActivationFactory Documentation for the ActivationFactory class and its initialization method. ```APIDOC ## ActivationFactory ### Description Construction factory of activation methods for rule blocks. Inherits from ConstructionFactory[Activation]. ### Functions #### __init__ - **Description**: Constructor for the ActivationFactory class. - **Signature**: __init__() -> None ``` -------------------------------- ### Arc Attribute Definitions Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Arc Definitions for the start and end attributes of the Arc term. ```python end = end ``` ```python start = start ``` -------------------------------- ### Get InputVariable fuzzy value Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Computes and returns the current fuzzy input value. ```python fuzzy_value() -> Array[str_] ``` -------------------------------- ### Initialize ActivationFactory Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/factory Constructor for the ActivationFactory class. ```python __init__() -> None ``` -------------------------------- ### Get InputVariable FuzzyLite string representation Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Returns the FuzzyLite language string for the variable. ```python __str__() -> str ``` -------------------------------- ### GET /engine/component Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/engine Retrieves a specific component (InputVariable, OutputVariable, or RuleBlock) from the engine by its name. ```APIDOC ## GET /engine/component ### Description Allows retrieval of engine components using their name as an identifier. ### Method GET ### Parameters #### Query Parameters - **item** (str) - Required - The name of the component to find. ### Response #### Success Response (200) - **component** (InputVariable | OutputVariable | RuleBlock) - The first component found with the specified name. ``` -------------------------------- ### Initialize OutputVariable Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/variable/OutputVariable Constructor for creating an OutputVariable instance with specified parameters. ```python __init__( name: str = "", description: str = "", enabled: bool = True, minimum: float = -inf, maximum: float = inf, lock_range: bool = False, lock_previous: bool = False, default_value: float = nan, aggregation: SNorm | None = None, defuzzifier: Defuzzifier | None = None, terms: Iterable[Term] | None = None, ) -> None ``` -------------------------------- ### Initialize Settings Object Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/library Initializes and assigns a Settings object to the 'settings' attribute. ```python settings: Final = Settings() ``` -------------------------------- ### Get List of Function Operators Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/FunctionFactory Retrieves a list of all available operators for functions managed by the FunctionFactory. ```python _create_operators() -> list[Element] ``` -------------------------------- ### ConstructionFactory __init__ Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/ConstructionFactory Initializes the ConstructionFactory. Optionally accepts a dictionary of constructors to pre-populate the factory. ```python __init__(constructors: dict[str, type[T]] | None = None) -> None ``` -------------------------------- ### Get class name Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/operation Retrieves the class name of an object, with an option for fully qualified names. ```python class_name(x: Any, /, qualname: bool = False) -> str ``` -------------------------------- ### GaussianProduct Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/GaussianProduct Initializing a GaussianProduct term with its name, means, standard deviations, and height. ```python def __init__( name: str = "", mean_a: float = nan, standard_deviation_a: float = nan, mean_b: float = nan, standard_deviation_b: float = nan, height: float = 1.0, ) -> None: ``` -------------------------------- ### Hedge Types and Examples Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/hedge/Hedge This section lists the available hedge types and their corresponding fuzzy term modifications. ```APIDOC ## Hedge Types ### Description This section illustrates how different hedges can be applied to various fuzzy terms. ### Available Hedges - `fuzzylite.hedge.Not` - `fuzzylite.hedge.Seldom` - `fuzzylite.hedge.Somewhat` - `fuzzylite.hedge.Very` - `fuzzylite.hedge.Extremely` - `fuzzylite.hedge.Any ### Examples of Hedge Application #### Arc Term - `fuzzylite.hedge.Seldom fuzzylite.term.Arc` - `fuzzylite.hedge.Somewhat fuzzylite.term.Arc` - `fuzzylite.hedge.Very fuzzylite.term.Arc` - `fuzzylite.hedge.Extremely fuzzylite.term.Arc` - `fuzzylite.hedge.Not fuzzylite.term.Arc` - `fuzzylite.hedge.Any fuzzylite.term.Arc` #### Binary Term - `fuzzylite.hedge.Seldom fuzzylite.term.Binary` - `fuzzylite.hedge.Somewhat fuzzylite.term.Binary` - `fuzzylite.hedge.Very fuzzylite.term.Binary` - `fuzzylite.hedge.Extremely fuzzylite.term.Binary` - `fuzzylite.hedge.Not fuzzylite.term.Binary` - `fuzzylite.hedge.Any fuzzylite.term.Binary` #### Concave Term - `fuzzylite.hedge.Seldom fuzzylite.term.Concave` - `fuzzylite.hedge.Somewhat fuzzylite.term.Concave` - `fuzzylite.hedge.Very fuzzylite.term.Concave` - `fuzzylite.hedge.Extremely fuzzylite.term.Concave` - `fuzzylite.hedge.Not fuzzylite.term.Concave` - `fuzzylite.hedge.Any fuzzylite.term.Concave` #### Ramp Term - `fuzzylite.hedge.Seldom fuzzylite.term.Ramp` - `fuzzylite.hedge.Somewhat fuzzylite.term.Ramp` - `fuzzylite.hedge.Very fuzzylite.term.Ramp` - `fuzzylite.hedge.Extremely fuzzylite.term.Ramp` - `fuzzylite.hedge.Not fuzzylite.term.Ramp` - `fuzzylite.hedge.Any fuzzylite.term.Ramp` #### Sigmoid Term - `fuzzylite.hedge.Seldom fuzzylite.term.Sigmoid` - `fuzzylite.hedge.Somewhat fuzzylite.term.Sigmoid` - `fuzzylite.hedge.Very fuzzylite.term.Sigmoid` - `fuzzylite.hedge.Extremely fuzzylite.term.Sigmoid` - `fuzzylite.hedge.Not fuzzylite.term.Sigmoid` - `fuzzylite.hedge.Any fuzzylite.term.Sigmoid` #### SShape - ZShape Term - `fuzzylite.hedge.Seldom fuzzylite.term.SShape - fuzzylite.hedge.Seldom fuzzylite.term.ZShape` - `fuzzylite.hedge.Somewhat fuzzylite.term.SShape - fuzzylite.hedge.Somewhat fuzzylite.term.ZShape` - `fuzzylite.hedge.Very fuzzylite.term.SShape - fuzzylite.hedge.Very fuzzylite.term.ZShape` - `fuzzylite.hedge.Extremely fuzzylite.term.SShape - fuzzylite.hedge.Extremely fuzzylite.term.ZShape` - `fuzzylite.hedge.Not fuzzylite.term.SShape - fuzzylite.hedge.Not fuzzylite.term.ZShape` - `fuzzylite.hedge.Any fuzzylite.term.SShape - fuzzylite.hedge.Any fuzzylite.term.ZShape` #### SShape Term - `fuzzylite.hedge.Seldom fuzzylite.term.SShape` - `fuzzylite.hedge.Somewhat fuzzylite.term.SShape` - `fuzzylite.hedge.Very fuzzylite.term.SShape` - `fuzzylite.hedge.Extremely fuzzylite.term.SShape` - `fuzzylite.hedge.Not fuzzylite.term.SShape` - `fuzzylite.hedge.Any fuzzylite.term.SShape` #### ZShape Term - `fuzzylite.hedge.Seldom fuzzylite.term.ZShape` - `fuzzylite.hedge.Somewhat fuzzylite.term.ZShape` - `fuzzylite.hedge.Very fuzzylite.term.ZShape` - `fuzzylite.hedge.Extremely fuzzylite.term.ZShape` - `fuzzylite.hedge.Not fuzzylite.term.ZShape` - `fuzzylite.hedge.Any fuzzylite.term.ZShape` ``` -------------------------------- ### Rule Loading Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/rule/Rule Loads the rule using an engine to identify and get references to input and output variables. ```APIDOC ## load ### Description Load the rule using the engine to identify and get references to the input and output variables. ### Method `load` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **engine** (Engine) - Required - engine that the rule (partially) controls ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Importer from_file Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/importer/Importer Reads and parses an engine configuration directly from a specified file path. Ensure the file contains a valid text representation of an engine. ```python from_file(path: Path | str) -> Engine ``` -------------------------------- ### Get the fuzzy value Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Activated Returns the fuzzy value formatted as {degree}/{name}, with an optional padding parameter. ```python fuzzy_value(padding: bool = False) -> Array[str_] ``` -------------------------------- ### Initialize Threshold Activation Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/Threshold Constructor for the Threshold activation method. ```python __init__(comparator: Comparator | str = GreaterThan, threshold: float = 0.0) -> None ``` -------------------------------- ### Get Rule Block Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/engine/Engine Retrieves a rule block by its name or index. Performance is optimal when using indices. ```APIDOC ## rule_block ### Description Finds the rule block of the given name or at the given index. Performance is O(1) when using indices and O(n) when using names. ### Method `rule_block(name_or_index: str | int)` ### Endpoint N/A (Method within an object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters - **name_or_index** (str | int) - Required - name or index of the rule block ### Request Example ```python rule_block = engine.rule_block("my_rule_block") # or rule_block = engine.rule_block(0) ``` ### Response #### Success Response (RuleBlock) - **RuleBlock** - The rule block object corresponding to the provided name or index. #### Response Example ```json { "name": "my_rule_block", "rules": [ // ... list of rules ... ] } ``` #### Errors - **ValueError**: when there is no rule block with the given name. - **IndexError**: when the index is out of range. ``` -------------------------------- ### Get Available Operators Dictionary Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/FunctionFactory Returns a dictionary mapping operator names to their corresponding Element objects. ```python operators() -> dict[str, Element] ``` -------------------------------- ### Load Engine from String Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/importer/FllImporter Creates an Engine object from a string describing the engine in FuzzyLite Language. ```APIDOC ## from_string ### Description Return the engine described using the FuzzyLite Language. ### Method ```python from_string(text: str) -> Engine ``` ### Parameters #### Path Parameters - **text** (str) - Required - engine described using the FuzzyLite Language ### Returns - **Engine** - engine described using the FuzzyLite Language ``` -------------------------------- ### Get Available Functions Dictionary Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/FunctionFactory Returns a dictionary mapping function names to their corresponding Element objects. ```python functions() -> dict[str, Element] ``` -------------------------------- ### Activation Method Configuration Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/Activation Methods to configure the activation method using space-separated parameters or retrieve current parameters. ```python configure(parameters: str) -> None ``` ```python parameters() -> str ``` -------------------------------- ### Benchmark Prepare Method in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/benchmark/Benchmark Prepares the engine and dataset for benchmarking. This typically involves loading and configuring them. ```python prepare() -> None ``` -------------------------------- ### GaussianProduct Configure Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/GaussianProduct Configuring a GaussianProduct term using a string of parameters. The expected format is 'mean_a standard_deviation_a mean_b standard_deviation_b [height]'. ```python configure(parameters: str) -> None: ``` -------------------------------- ### Get Operator Function Reference Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/activation Returns the function reference for the comparator operator. This is useful for dynamic operations. ```python operator: Callable[[Scalar, Scalar], bool | Array[bool_]] ``` -------------------------------- ### Settings Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/library/Settings Initializes the Settings object with specified floating-point type, decimal precision, tolerances, alias, logger, and factory manager. ```python __init__( float_type: Any = float64, decimals: int = 3, atol: float = 0.001, rtol: float = 0.0, alias: str = "fl", logger: Logger | None = None, factory_manager: FactoryManager | None = None, ) -> None ``` -------------------------------- ### Activation Methods Overview Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/activation This section provides an overview of the different activation methods available in pyfuzzylite. ```APIDOC ## Activation Methods Pyfuzzylite offers several activation methods to control how fuzzy rules are triggered based on their activation degrees. These methods determine which rules are considered active and are essential for the fuzzy inference process. ### Available Activation Methods: * **Highest**: Activates the rules with the highest activation degrees. * **Last**: Activates the first n rules (in reverse insertion order) whose activation degrees are greater than or equal to the threshold. * **Lowest**: Activates only the rules with the lowest activation degrees in ascending order. * **Proportional**: Activates rules using normalized activation degrees, where the sum of activation degrees equals one. * **Threshold**: Activates rules whose activation degrees satisfy a comparison operator and a threshold, deactivating the rest. ``` -------------------------------- ### Settings Factory Manager Property Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/library/Settings Get or set the factory manager for the library. This is essential for object creation and management. ```python factory_manager: FactoryManager ``` -------------------------------- ### Import Activation Method from FLL Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/importer Imports an activation method described in the FuzzyLite Language. ```python activation(fll: str) -> Activation | None ``` -------------------------------- ### Initialize InputVariable Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Constructor for creating an InputVariable instance. ```python __init__( name: str = "", description: str = "", enabled: bool = True, minimum: float = -inf, maximum: float = inf, lock_range: bool = False, terms: Iterable[Term] | None = None, ) -> None ``` -------------------------------- ### CloningFactory Get Item Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/CloningFactory Retrieves an object from the factory using its string key. Raises a KeyError if the key is not found. ```python __getitem__(key: str) -> T ``` -------------------------------- ### Operator Class Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/rule/Operator Documentation for the __init__ method of the Operator class. ```APIDOC ## __init__ ### Description Constructor for the Operator class, which represents a non-terminal node in an expression tree as a binary operator. ### Parameters - **name** (str) - Optional - Name of the operator (default: '') - **right** (Expression | None) - Optional - Right expression in the binary tree (default: None) - **left** (Expression | None) - Optional - Left expression in the binary tree (default: None) ### Request Example operator = Operator(name='and', left=expr1, right=expr2) ``` -------------------------------- ### Get Variable Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/engine/Engine Finds a variable by its name, searching through input and then output variables. For better performance, access variables by index. ```APIDOC ## variable ### Description Finds the variable by the name, iterating first over the input variables and then over the output variables. The cost of this method is O(n), where n is the number of variables in the engine. For better performance, get the variables by index. ### Method `variable(name: str)` ### Endpoint N/A (Method within an object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters - **name** (str) - Required - name of the input or output variable ### Request Example ```python input_var = engine.variable("temperature") output_var = engine.variable("output_level") ``` ### Response #### Success Response (Variable) - **Variable** - The variable object corresponding to the provided name. #### Response Example ```json { "name": "temperature", "range": [0, 100], "terms": [ // ... list of terms ... ] } ``` #### Errors - **ValueError**: when there is no variable by the given name. ``` -------------------------------- ### ZShape Membership Function Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Represents a Z-shaped membership function. It is defined by a start point, an end point, and an optional height. ```APIDOC ## ZShape Membership Function ### Description Edge Term that represents the ZShape membership function. Equation μ(x)={1if x≤sh−2h(x−se−s)2if s None ``` Constructor. Parameters: Name | Type | Description | Default ---|---|---|--- `name` | `str` | name of the Term | `''` `start` | `float` | start of the ZShape | `nan` `end` | `float` | end of the ZShape | `nan` `height` | `float` | height of the Term | `1.0` #### configure ``` configure(parameters: str) -> None ``` Configure the term with the parameters. Parameters: Name | Type | Description | Default ---|---|---|--- `parameters` | `str` | `start end [height]`. | _required_ #### is_monotonic ``` is_monotonic() -> bool ``` Return `True` because the term is monotonic. Returns: Type | Description ---|--- `bool` | `True` #### membership ``` membership(x: Scalar) -> Scalar ``` Computes the membership function evaluated at x. Parameters: Name | Type | Description | Default ---|---|---|--- `x` | `Scalar` | scalar | _required_ Returns: Type | Description ---|--- `Scalar` | μ(x)={1if x≤sh−2h(x−se−s)2if s str ``` Return the parameters of the term. Returns: Type | Description ---|--- `str` | `start end [height]`. #### tsukamoto ``` tsukamoto(y: Scalar) -> Scalar ``` Compute the tsukamoto value of the monotonic term for activation degree y. Equation y={1if x≤sh−2h(x−se−s)2if s Activation | None ``` -------------------------------- ### Initialize Proposition Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/rule/Proposition Constructor for the Proposition class. It takes an optional variable, a list of hedges, and a term to define the proposition. ```python __init__(variable: Variable | None = None, hedges: Iterable[Hedge] | None = None, term: Term | None = None) -> None ``` -------------------------------- ### Get Variable Range Magnitude Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Returns the difference between the maximum and minimum values of the variable. This indicates the total span of possible values. ```python drange: float ``` -------------------------------- ### First Activation Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/First Details on the 'First' activation method, which activates the first n rules based on a threshold. ```APIDOC ## First Activation Method ### Description Activates the first n rules (in insertion order) whose activation degrees are greater than or equal to the threshold. ### Method N/A (Class method) ### Endpoint N/A ### Parameters N/A ### Attributes #### `rules` (instance-attribute) - **rules**: `int` - The maximum number of rules to activate. #### `threshold` (instance-attribute) - **threshold**: `float` - The minimum activation degree required to activate a rule. ### Functions #### `__init__` - **Description**: Constructor for the First activation method. - **Parameters**: - `rules` (int): Maximum number of rules to activate. Default is 1. - `threshold` (float): Minimum activation degree required. Default is 0.0. #### `activate` - **Description**: Activates rules in a rule block based on the 'First' method's criteria. - **Parameters**: - `rule_block` (RuleBlock): The rule block to activate. Required. #### `configure` - **Description**: Configures the activation method with specified parameters. - **Parameters**: - `parameters` (str): A string containing the number of rules and threshold (e.g., "3 0.5"). Required. #### `parameters` - **Description**: Returns the configured number of rules and threshold. - **Returns**: - `str`: A string representing the number of rules and threshold. ``` -------------------------------- ### Get and Set Variable Value Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Accesses the current value of the variable. When 'lock_range' is true, the value will be clipped to the variable's defined range. ```python value: Scalar ``` -------------------------------- ### Get and Set Variable Range Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/variable Manages the minimum and maximum bounds of the variable. The setter takes a tuple of (minimum, maximum) to define the range. ```python range: tuple[float, float] ``` -------------------------------- ### Retrieve activation parameters Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/activation/First Returns the current number of rules and threshold as a string. ```python parameters() -> str ``` -------------------------------- ### GET /engine/input_values Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/engine Retrieves the current 2D array of input values for the engine, where columns represent input variables and rows represent values. ```APIDOC ## GET /engine/input_values ### Description Returns a 2D array of input values for each input variable. ### Method GET ### Response #### Success Response (200) - **input_values** (ScalarArray) - 2D array of input values (rows) for each input variable (columns). ``` -------------------------------- ### Initialize DefuzzifierFactory Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/factory/DefuzzifierFactory Constructor for the DefuzzifierFactory. No arguments are required. ```python __init__() -> None ``` -------------------------------- ### Initialize Binary Term Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Constructor for the Binary term. Initializes a binary membership function with a given name, start point, direction, and height. ```python __init__(name: str = '', start: float = nan, direction: float = nan, height: float = 1.0) -> None ``` -------------------------------- ### Settings Class Overview Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/library/Settings Provides an overview of the Settings class and its purpose within the pyfuzzylite library. ```APIDOC ## Settings ### Description Settings for the library. ### Attributes #### `_factory_manager` (instance-attribute) `_factory_manager = factory_manager` #### `alias` (instance-attribute) `alias = alias` #### `atol` (instance-attribute) `atol = atol` #### `debugging` (property, writable) `debugging: bool` Get/Set the library in debug mode. ##### Getter Returns: Type | Description ---|--- `bool` | whether the library is in debug mode ##### Setter Parameters: Name | Type | Description | Default ---|---|---|--- `value` | `bool` | set logging level to `DEBUG` if `true`, and to `ERROR` otherwise | _required_ #### `decimals` (instance-attribute) `decimals = decimals` #### `factory_manager` (property, writable) `factory_manager: FactoryManager` Get/Set the factory manager. ##### Getter Returns: Type | Description ---|--- `FactoryManager` | factory manager ##### Setter Parameters: Name | Type | Description | Default ---|---|---|--- `value` | `FactoryManager` | factory manager | _required_ #### `float_type` (instance-attribute) `float_type = float_type` #### `logger` (instance-attribute) `logger = logger or getLogger('fuzzylite')` #### `rtol` (instance-attribute) `rtol = rtol` ### Functions #### `__init__` ```python __init__( float_type: Any = float64, decimals: int = 3, atol: float = 0.001, rtol: float = 0.0, alias: str = "fl", logger: Logger | None = None, factory_manager: FactoryManager | None = None, ) -> None ``` Constructor. Parameters: Name | Type | Description | Default ---|---|---|--- `float_type` | `Any` | floating point type. | `float64` `decimals` | `int` | number of decimals. | `3` `atol` | `float` | absolute tolerance. | `0.001` `rtol` | `float` | relative tolerance. | `0.0` `alias` | `str` | alias to use when representing objects (ie, `__repr__()`). Cases: - fully qualified package when alias == "" (eg, `fuzzylite.term.Constant(name="A", height=1.0)`) - no prefixes when alias == "*" (eg, `Constant(name="A", height=1.0)`) - alias otherwise (eg, `{alias}.Constant(name="A", height=1.0)`) | `'fl'` `logger` | `Logger | None` | logger. | `None` `factory_manager` | `FactoryManager | None` | factory manager. | `None` #### `__repr__` ```python __repr__() -> str ``` Return code to construct the settings in Python. Returns: Type | Description ---|--- `str` | code to construct the settings in Python #### `context` ```python context( *, float_type: Any | None = None, decimals: int | None = None, atol: float | None = None, rtol: float | None = None, alias: str | None = None, logger: Logger | None = None, factory_manager: FactoryManager | None = None ) -> Generator[None, None, None] ``` Create a context with specific settings. Parameters: Name | Type | Description | Default ---|---|---|--- `float_type` | `Any | None` | floating point type | `None` `decimals` | `int | None` | number of decimals. | `None` `atol` | `float | None` | absolute tolerance. | `None` `rtol` | `float | None` | relative tolerance. | `None` `alias` | `str | None` | alias for the library. | `None` `logger` | `Logger | None` | logger. | `None` `factory_manager` | `FactoryManager | None` | factory manager. | `None` Returns: Type | Description ---|--- `None` | context with specific settings. ``` -------------------------------- ### Initialize Function Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/term Constructor for creating a Function term. ```python __init__( name: str = "", formula: str = "", engine: Engine | None = None, variables: dict[str, Scalar] | None = None, load: bool = False, ) -> None ``` -------------------------------- ### PiShape Class Documentation Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/PiShape Detailed documentation for the PiShape class, including its inheritance, equation, related terms, attributes, and methods. ```APIDOC ## PiShape ### Description Extended term that represents the Pi-shaped membership function. Equation: μ(x)=h(SShapeab(x)×ZShapecd(x)) where * h: height of the Term * a,b: bottom left and top left parameters of the PiShape * c,d: top right and bottom right parameters of the PiShape Related: * fuzzylite.term.SShape * fuzzylite.term.ZShape ### Attributes #### `bottom_left` instance-attribute ``` bottom_left = bottom_left ``` #### `bottom_right` instance-attribute ``` bottom_right = bottom_right ``` #### `top_left` instance-attribute ``` top_left = top_left ``` #### `top_right` instance-attribute ``` top_right = top_right ``` ### Functions #### `__init__` ```python __init__( name: str = "", bottom_left: float = nan, top_left: float = nan, top_right: float = nan, bottom_right: float = nan, height: float = 1.0, ) -> None ``` Constructor. Parameters: Name | Type | Description | Default ---|---|---|--- `name` | `str` | name of the Term | `''` `bottom_left` | `float` | bottom-left value of the PiShape | `nan` `top_left` | `float` | top-left value of the PiShape | `nan` `top_right` | `float` | top-right value of the PiShape | `nan` `bottom_right` | `float` | bottom-right value of the PiShape | `nan` `height` | `float` | height of the Term. | `1.0` #### `configure` ```python configure(parameters: str) -> None ``` Configure the term with the parameters. Parameters: Name | Type | Description | Default ---|---|---|--- `parameters` | `str` | `bottom_left top_left top_right bottom_right [height]`. | _required_ #### `membership` ```python membership(x: Scalar) -> Scalar ``` Computes the membership function evaluated at x. Parameters: Name | Type | Description | Default ---|---|---|--- `x` | `Scalar` | scalar | _required_ Returns: Type | Description ---|--- `Scalar` | μ(x)=h(SShapeab(x)×ZShapecd(x)) #### `parameters` ```python parameters() -> str ``` Return the parameters of the term. Returns: Type | Description ---|--- `str` | `bottom_left top_left top_right bottom_right [height]`. ``` -------------------------------- ### Get or set the activation degree Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Activated Access or modify the activation degree of the term. Non-finite values are automatically replaced with 0.0 for NaN/-inf and 1.0 for inf. ```python degree: Scalar ``` -------------------------------- ### Settings Debugging Property Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/library/Settings Get or set the library's debug mode. Setting to true enables DEBUG logging, while false sets it to ERROR. ```python debugging: bool ``` -------------------------------- ### Initialize InputVariable Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/variable/InputVariable Constructs an InputVariable with specified parameters. Use this to define input variables for your fuzzy logic system. ```python __init__(name: str = "", description: str = "", enabled: bool = True, minimum: float = -inf, maximum: float = inf, lock_range: bool = False, terms: Iterable[Term] | None = None) -> None ``` -------------------------------- ### Binary Term Attributes in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Binary Shows the instance attributes 'direction' and 'start' for the Binary Term. These are fundamental properties defining the term's behavior. ```python direction = direction ``` ```python start = start ``` -------------------------------- ### Initialize ConstructionFactory Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/factory Constructor for the ConstructionFactory class. ```python constructors = constructors or {} __init__(constructors: dict[str, type[T]] | None = None) -> None ``` -------------------------------- ### Export Activation Method Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/exporter/FllExporter Converts an Activation object to its FuzzyLite Language string representation. Requires an Activation object as input. ```python activation(activation: Activation | None) -> str ``` -------------------------------- ### Benchmark Class Method engine_and_data in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/benchmark/Benchmark A class method to create a fuzzy engine and load a dataset from a given example module. Useful for setting up benchmarks. ```python engine_and_data(example: ModuleType) -> tuple[Engine, ScalarArray] ``` -------------------------------- ### Retrieve Binary Term Parameters in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Binary Returns the current parameters of the Binary Term as a formatted string. The output string represents 'start direction [height]'. ```python parameters() -> str Return the parameters of the term. Returns: Type | Description ---|--- `str` | `start direction [height]`. ``` -------------------------------- ### Term Class Initialization Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Term Constructor for creating a new linguistic term instance. ```APIDOC ## __init__ ### Description Initializes a new instance of a linguistic term. ### Parameters - **name** (str) - Optional - Name of the term (default: '') - **height** (float) - Optional - Height of the term (default: 1.0) ### Request Example term = Term(name="example", height=1.0) ``` -------------------------------- ### Binary Term Constructor in pyfuzzylite Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/term/Binary The constructor for the Binary Term, allowing initialization with name, start position, direction, and height. Default values are provided for convenience. ```python __init__(name: str = '', start: float = nan, direction: float = nan, height: float = 1.0) -> None Constructor. Parameters: Name | Type | Description | Default ---|---|---|--- `name` | `str` | name of the Term | `''` `start` | `float` | start of the Binary | `nan` `direction` | `float` | direction of the Binary (-inf, inf) | `nan` `height` | `float` | height of the Term | `1.0` ``` -------------------------------- ### Rule Constructor Source: https://fuzzylite.github.io/pyfuzzylite/fuzzylite/__all__/rule Initializes a new Rule object with optional parameters for enabled status, weight, antecedent, and consequent. Defaults are provided for convenience. ```python __init__(enabled: bool = True, weight: float = 1.0, antecedent: Antecedent | None = None, consequent: Consequent | None = None) -> None ```