Skip to content
Payam Aminpour edited this page Aug 3, 2019 · 16 revisions

Welcome to the PyFCM wiki!


PyFCM (Python for Fuzzy Cognitive Mapping)

Mental models about complex systems can be elicited and represented as Fuzzy Cognitive Maps (FCM). These can be analyzed with regard to structure and dynamic behavior of the system. Moreover, FCMs (i.e. mental models) from individuals can be aggregated into a larger FCM that represents the collective knowledge of all contributors and thus provide a tool for "Wisdom of Crowds" effect.

Before we get started...

PyFCM is a set of Python scripts with .py extension. To run PyFCM you need to first install Python 3.

Install Python3.

Download the Anaconda Python3 installer from the one called Python 3.x 64-bit, unless you know you need something else. Run the installer and... All defaults are okay.

Generate your FCMs

You can build a graphical FCM using "Mental Modeler" online tool (recommended). However, there are other tools for building FCMs. We only need the excel format of adjacency matrix of each FCM, and "Mental Modeler" makes it easier to export graphical models to adjacency matrices in excel format.

  1. Go to
  2. From the top toolbar select "SOFTWARE"
  3. Click on "Use the online Mental Modeler Suite, including the Scenario tool (password required)"
  4. Username and Password are both "mentalmodeler"

After building your FCM, click on "Export XLS".

An excel file will be downloaded to your computer. Open the excel file and replace the blank cells with zeros.

Your Adjacency Matrix should look like Adjacency_Matrix_Example.xlsx which can be found in the package.

Save your adjacency matrix in a directory and then copy the directory path into the code, where the file location is required.

Download PyFCM

In order to use PyFCM, you must first download the code from GitHub. You will simply be downloading the git repository.

  1. Go to the GitHub page for PyFCM:
  2. Click on the button labeled "Clone or download" on the right side of the screen.
  3. A drop-down menu will appear-- click on "Download ZIP"
  4. This automatically downloads a compressed version of all of the PyFCM code.
  5. When the download is complete, open it.
  6. Once you open the download, you should see a single folder called "PyFCM-master". Drag this folder to your desktop (or where ever you would like to keep PyFCM on your computer.)
  7. Open the "PyFCM-master",and un-zip the "Codes" folder.

There are several folders in the Codes: (Aggregation_FCMs, Clustering_FCMs, Scenario_Analysis, Sensitivity_Analysis, Uncertainty_Analysis). Pick the needed one and open its script (not the using your Python 3 development environment (e.g. Spyder Python).

In addition, you would be able to run PyFCM through command line (see instruction for running PyFCM on command line from here).

PyFCM is lead by Payam Aminpour. Click here to visit his profile.

Email: &

Clone this wiki locally
You can’t perform that action at this time.