Defuzzification Method

339 views
Skip to first unread message

Fabian

unread,
Jun 27, 2018, 4:44:43 AM6/27/18
to scikit-fuzzy
Dear Mr Warner,

I wonder whether it is possible to change the defuzzification-method within the new API. I understand your procedure described in 'The Tipping Problem - The Hard Way', where it says output = fuzz.defuzz(universe_1, aggregated, 'centroid').
But now I like to adapt the settings to the new API as described here .
Is there some way to specifiy the defuzz-method within one object?

Tank you for your help!

Ce ap

unread,
Nov 29, 2019, 2:04:23 AM11/29/19
to scikit-fuzzy
Dear Fabian,

I have the same problem. In https://groups.google.com/d/msg/scikit-fuzzy/ZdFHobxuLrs/upvbGtsMBAAJ explain how you can modify it but I haven´t been able yet. If you get I´d really appreciate it.

Thanks

JP B

unread,
Dec 13, 2019, 5:39:31 AM12/13/19
to scikit-fuzzy
Using the new API and would dearly love to also know if there is a clean way to change the defuzzification method (as I assume when using the new API there is no need to explicitly call defuzz, as the sim.compute returns the defuzzied output (according to the MF of the consequent, right?).

Would really appreciate support here,
Thanks!

JP B

unread,
Dec 18, 2019, 8:53:52 AM12/18/19
to scikit-fuzzy
Can anyone please suggest a solution to changing the defuzzification method (using new API)?

Many thanks, much appreciated

JP B

unread,
Dec 20, 2019, 6:58:27 AM12/20/19
to scikit-fuzzy
I think that link indicates a hacking of python file fuzzyvariable.py, which you should be able to find in /lib/site-packages/skfuzzy/control, and hack the __init__ method to change the value assignment of defuzzify_method. I've not yet seen any way to do this programmatically when creating new sim/control via new API, shame.


On Friday, November 29, 2019 at 8:04:23 AM UTC+1, Ce ap wrote:

JP B

unread,
Dec 20, 2019, 7:27:08 AM12/20/19
to scikit-fuzzy
Was able to hack my local version of skfuzzy relatively easily to pass the defuzz method dynically, done on creation of consequent, for example as follows:

self.diagnosis = ct.Consequent(np.arange(0, 200, 1), 'diagnosis', defuzzify_method='som')

then maintained __init__ of consequent in antecedent_consequent.py to add another named argument, wjhich is then passed when call to super to instantiate, as follows:
def __init__(self, universe, label, defuzzify_method='centroid'):
super(Consequent, self).__init__(universe, label, defuzzify_method)


So whatever defuzz method you pass in when creating the consequent will replace the default centroid.  Hope this helps someone.
Reply all
Reply to author
Forward
0 new messages