<jupyter_start><jupyter_text>Tutorial 3 - Standard membership functions This tutorial uses the fuzzy inference system developed in Tutorial 1.<jupyter_code>import os
import warnings

os.chdir('/workspaces/fuzzy-expert')
warnings.filterwarnings("ignore")<jupyter_output><empty_output><jupyter_text>Specification of the fuzzy variables with standard membership functions In the following code, fuzzy sets are specified using standard membership functions, which are described in the function reference section.Fuzzy sets in variables `score` and `ratio` are specified using the `smf` and `zmf` functions. Fuzzy sets for variables `credit` and `decision` are specified using the `trapmf` function.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

from fuzzy_expert.variable import FuzzyVariable

variables = {
    "score": FuzzyVariable(
        universe_range=(150, 200),
        terms={
            "High": ('smf', 175, 190),
            "Low": ('zmf', 155, 175),
        },
    ),
    "ratio": FuzzyVariable(
        universe_range=(0.1, 1),
        terms={
            "Goodr": ('zmf', 0.3, 0.42),
            "Badr": ('smf', 0.44, 0.7),
        },
    ),
    #
    "credit": FuzzyVariable(
        universe_range=(0, 10),
        terms={
            "Goodc": ('trapmf', 0, 0, 2, 5),
            "Badc":  ('trapmf', 5, 8, 10, 10),
        },
    ),
    #
    "decision": FuzzyVariable(
        universe_range=(0, 10),
        terms={
            "Approve": ('trapmf', 5, 8, 10, 10),
            "Reject": ('trapmf', 0, 0, 2, 5),
        },
    ),
}
variables['score'].plot()
variables['ratio'].plot()
variables['credit'].plot()
variables['decision'].plot()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14092777451556077, 'fraction_numerical': 0.03464474456840869, 'mean_word_length': 3.028368794326241, 'pattern_counts': {'":': 12, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '311221', 'license': 'MIT', 'n_tokens_mistral': 595, 'n_tokens_neox': 524, 'n_words': 152, 'path': 'sphinx/tutorials/tutorial-3.ipynb', 'repo_name': 'jdvelasq/fuzzy-expert', 'size': '1703'}