Skip to content

pyfuzzylite 8.0.1

Compare
Choose a tag to compare
@jcrada jcrada released this 11 Jan 00:28
· 24 commits to main since this release
aadb341

Version 8.0.1

Bug fixes

  • On Python 3.10|3.11: Removed Self type annotation from Benchmark because the typing_extensions module
    cannot be found
  • On Python 3.12: Explicitly increasing values of fl.Representation to avoid errors from new values

Version 8.0.0

Summary

New

  • integration with numpy means engines operate more efficiently thanks to vectorization, but the regular operation
    with Python float also works seamlessly
  • fuzzylite/types.py to store library annotation types
  • type fl.Scalar = float | numpy.Array replaces float everywhere vectorization can be used
    (see fuzzylite/types.py)
  • type fl.ScalarArray = numpy.Array[float] used in places where an array of floats is needed (
    see fuzzylite/types.py)
  • function fl.scalar to convert any argument to a fl.Scalar
  • function fl.array maps to np.array
  • function fl.to_float converts any argument to a float, which was the behaviour of fl.Op.scalar.
  • linguistic terms Arc and SemiEllipse
  • indexable components:
    • Engine: get variables or rule blocks by name using square brackets, eg, engine["light"].value
    • Variable: get terms by name using square brackets, eg, variable["low"].membership(value)
    • Factory: get constructors and objects by name using square brackets,
      eg, factory["Triangle"](), factory["sin"](3.14)
  • class Benchmark to benchmark engines
  • from __future__ import annotations in every file to use better type annotations
  • class library.Settings to configure general settings in singleton library.settings
  • class library.Representation to easily convert objects to Python code
  • documentation significantly improved and configured using mkdocs-material, available
    at: fuzzylite.github.io/pyfuzzylite
  • function __len__ in Variable, RuleBlock to get number of components with len(x),
    but also means that implicit boolean statements like if component will evaluate to False when
    component is None or len(component) == 0
  • tsukamoto functions Sigmoid.tsukamoto, SShape.tsukamoto, ZShape.tsukamoto
  • tests, tests and more tests, reaching 95% of code coverage

Changed

  • Requires Python >= 3.9
  • Dual license: GNU GPL and paid proprietary license for commercial purposes
  • All enum values are automatically assigned with enum.auto(), instead of manual assignments
  • Almost all classes redefine __repr__ to return the object as a Python constructor using the
    new fl.library.Representation class
  • Almost all classes redefine __str__ to return the equivalent FuzzyLite Language (if possible)
  • Many more tests and better structure for tests
  • Aggregation operator is now used in TakagiSugeno/Tsukamoto engines on activations of the same term
    (see tests/test_engine.py:test_takagi_sugeno_aggregation_operator)
  • Examples: all file names have been changed to snake_case, and engines wrapped in classes
  • Examples: all examples can be easily imported,
    eg from fuzzylite.examples.mamdani.obstacle_avoidance import ObstacleAvoidance
  • Documentation updated and format changed from doxygen to google style
  • library.settings for default absolute tolerance changed from 1e-5 to 1e-3 to match the default 3 decimals
  • Formatting: code line-width=100 instead of 88
  • Many functions now map or use to numpy functions to support vectorization
  • The following classes are now
    abstract: Activation, Defuzzifier, Exporter, Hedge, Importer, Norm, SNorm, TNorm, Expression
    and Term
  • IntegralDefuzzifiers are simpler, support vectorization, use numpy, and the default resolution is 1000
  • WeightedDefuzzifiers are simpler and use Aggregated.grouped_terms to iterate over the terms and aggregate them
    accordingly
  • Get components by name or index with Engine.input_variable(), Engine.output_variable() or Engine.rule_block()
  • PythonExporter exports code to Python using single-statement constructors
  • FldExporter uses vectorization to export datasets, so for now only works with the General activation method
  • Operators and functions in FunctionFactory map to their equivalent methods in numpy
  • Vectorization support in class activation.General, and
    modules defuzzifier, engine, hedge, norm, rule, term, variable
  • type Rule.triggered to an array of bools to support vectorization
  • type Rule.activation_degree to Scalar to support vectorization
  • renamed parameters of Op.scale from from_[minimum|maximum] to x_[min|max], and to_[minimum|maximum]
    to y_[min|max]
  • function Term.discretize uses Op.midpoints to discretize
  • function Term.discretize uses resolution = 10 instead of 100
  • function Aggregated.activation_degree to support vectorization, so now returns fl.Scalar
  • function fuzzy_value returns Array[np.str_] instead of str to account for vectorization
  • function highest_membership returns Activated | None instead of tuple[float, Term | None]

Removed

  • class library.Library removed and split into library.Settings and library.Information
  • singleton fl.lib. See library.py for settings
  • functions fl.isnan and fl.isinf moved to Op (use now: fl.Op.isnan, fl.Op.isinf)
  • function class_name
    from Activation, Defuzzifier, Exporter, Importer, ConstructionFactory, CloningFactory, Norm, Term;
    use Op.class_name instead
  • parameter decimals from function Op.str()
  • class Discrete.Pair
  • pyhamcrest dependency for tests

Bug fixes

  • Bug fix: Rule.antecedent and Rule.consequent instantiations in Rule constructor
  • Bug fix: Function.update_reference loads function if not loaded
  • Bug fix: function Term.tsukamoto uses the height in all monotonic terms
  • Bug fix: function Concave.tsukamoto uses parameter y instead of incorrectly
    computing membership(activation_degree)
  • Bug fix: function Ramp.tsukamoto uses height correctly