Fuzzy Cognitive Maps#
Fuzzy Cognitive Maps for Ex-Fuzzy Library
This module implements Fuzzy Cognitive Maps (FCMs), a soft computing technique that combines fuzzy logic with cognitive mapping for modeling complex systems with causal relationships. FCMs are particularly useful for decision making, scenario analysis, and understanding dynamic system behavior.
- Main Components:
FuzzyCognitiveMap: Core FCM class for creation and simulation
Dynamic simulation: Iterative state evolution and convergence analysis
Visualization tools: Network plotting and state trajectory visualization
Analysis functions: Equilibrium detection, periodic behavior identification
Threshold operations: Connection strength discretization and analysis
- Key Features:
Support for weighted causal relationships between concepts
Multiple activation functions (sigmoid, tanh, linear)
Dynamic simulation with convergence detection
Periodic behavior and limit cycle identification
Interactive visualization of FCM structure and dynamics
Integration with fuzzy rule systems for hybrid modeling
- Theoretical Background:
Fuzzy Cognitive Maps were originally developed by Bart Kosko and extend traditional cognitive maps by incorporating fuzzy logic principles. They represent concepts as nodes and causal relationships as weighted directed edges, enabling the modeling of complex feedback systems.
- Applications:
Decision support systems
Strategic planning and scenario analysis
Complex system modeling and simulation
Expert knowledge representation
Policy analysis and impact assessment
- ex_fuzzy.cognitive_maps.look_pattern_states(fcm, sim_steps, pattern_len, max_period_size)[source]#
Looks for the pattern states of the FCM when simulation is prolongued.
:param fcm : FuzzyCognitiveMap. The FCM to look for the attractor states. :param max_steps: int. The maximum number of steps to look for the attractor states. :param random_inits : int :returns: list of np.array. The attractor states found. None if none were found
- ex_fuzzy.cognitive_maps.study_attractors_FCM(fcm, max_steps, random_inits=10)[source]#
Looks for the attractor states of the FCM when simulation is prolongued.
:param fcm : FuzzyCognitiveMap. The FCM to look for the attractor states. :param max_steps: int. The maximum number of steps to look for the attractor states. :param random_inits : int :returns: list of np.array. The attractor states found. None if none were found
- ex_fuzzy.cognitive_maps.attractors_report(attractors)[source]#
Prints a report of the attractors found.
- Parameters:
attractors (dict[array, array]) – dict[np.array, np.array]. The attractors found.
- class ex_fuzzy.cognitive_maps.FuzzyCognitiveMap(connections, threshold=0.5)[source]#
Bases:
object
- __init__(connections, threshold=0.5)[source]#
Creates a fuzzy cognitive map.
- Parameters:
connections (np.array | pd.DataFrame) – np.array | pd.DataFrame. A square matrix with the connections between the concepts.
threshold (int) – int, optional. When simulating steps the state
will be trimmed using these threhold into the {0, 1, -1} values. The default is 0.5.