aresio / simpful

A friendly python library for fuzzy logic reasoning
Academic Free License v3.0
130 stars 33 forks source link

Probabilistic Inference #5

Closed NikhilNRS closed 4 years ago

NikhilNRS commented 4 years ago

Hi Marco,

Edit - This is an updated pull request matching as per your e-mail. As far as i can see however, those bugs were not introduced by my regex as they were not at all collecting words containing IS or is. They were looking around it.

I've added the probabilistic inference method. Currently it supports classification only (for n classes). Regression will be added during my second thesis. Other then that i've added the following components:

A method to add probabilistic rules 'FS.add_proba_rule()':

it works similarly to the normal add rule for the antecedent. For the consequent it extracts the probabilities and (implicitly) the number of classes.

A method to get the probabilities 'FS.get_probas()': as the name suggests this is just for oversight to get the probabilities from a parsed rule.

The methods probabilistic inference and mediate probabilistic is where the main calculations happen. The exact details of these are given in the corresponding docstrings.

No new dependencies were added and most of the calculations were done using numpy.

Various docstrings in the rule parsing file

I added a class to more easily add gaussians after clustering in the fuzzy_sets file. I will need this for my thesis.

Finally, i updated a readme file with an example we can discuss in our next meeting.

Best wishes,

Nikhil