RCGA

Task: create FCM based on one input

'rcga'

  • We propose an evolutionary approach, based on the algorithm, introduced by Stach Stach (2010). RCGA creates an FCM which concepts, after a predefined number of simulation steps, will have values close to the desired values. In order to do so, the user has to provide: the initial values of the concepts (can be multiple input vectors) structured as a NumPy array of shape(number of input vectors x number of concepts), the desired values of concepts after n steps, and the number of times steps as an integer. The algorithm will do its best to create the weight matrix which will maximize the fitness function - minimize the difference between obtained and desired values (error). The learning process stops if (i) fitness function is greater than the maximum fitness (default 0.999) or (ii) the number of generations is greater than the maximum number of generations (default 100000).
  • Step 1. Crossover

    'crossover'

    Step 2. Mutations

    Value of randomly chosen weight in the chromosome is being change into new value with the same sign

    Step 3. Selection

    Selection is the stage of a genetic algorithm in which individual genomes are chosen from a population for later breeding (using the crossover operator).

    Roulette wheel selection

    Selecting with weight probability, depending on the fitness of the individual gene Fitness values [1, 2, 3, 4], then the sum is (1 + 2 + 3 + 4 = 10). Therefore, you would want the probabilities or chances to be [1/10, 2/10, 3/10, 4/10] or [0.1, 0.2, 0.3, 0.4] The chosen one is taken for the crossover

    Tournament selection

    Winner of the tournament is being selected for the crossover two variants of the selection: with and without replacement

    Step 4. Fitness function

    Fitness is calculated as difference between concept values on each step of the simulation

    'crossover'

    For more information about the algorithms, please check out LEARNING AND AGGREGATION OF FUZZY COGNITIVE MAPS – AN EVOLUTIONARY APPROACH by Wojciech Stach

    2.2.1 Heart attack risk

    We used initial FCM presented in the article from arcticle

    Fuzzy cognitive map based approach for determining the risk of ischemic stroke Mahsa Khodadadi 1, Heidarali Shayanfar 2, Keivan Maghooli 3, Amir Hooshang Mazinan 1

    https://pubmed.ncbi.nlm.nih.gov/31778126/

    Do not worry about the empty plot, if you would run it in another IDE, such as VSCode, plot would interactivly display current fitness function