-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Target only a subset of input in rules #12
Comments
Hi! |
Thanks a lot |
Hi! Can you test the subset_rule branch? I did a modification and did the model presented in https://iopscience.iop.org/article/10.1088/1742-6596/1830/1/012008/pdf service = Dict( "poor" => TrapezoidalMF(0.0, 0.0, 2.0, 4.0),
"good" => TriangularMF(3., 5., 7.),
"excellent" => TrapezoidalMF(6., 8., 10., 10.))
food = Dict("rancid" => TrapezoidalMF(0., 0., 3., 6.),
"delicious" => TrapezoidalMF(4., 7., 10., 10.))
inputs = [service, food]
tip = Dict("cheap" => TrapezoidalMF(10., 10., 20., 30.),
"average" => TriangularMF(20., 30., 40.),
"generous" => TrapezoidalMF(30., 40, 50., 50.))
rule1 = Rule(["poor", "rancid"], "cheap", "MAX")
rule2 = Rule(["good", ""], "average")
rule3 = Rule(["excellent", "delicious"], "generous", "MAX")
rules = [rule1, rule2, rule3]
fis_tips = FISMamdani(inputs, tip, rules)
in_vals = [7., 8.]
println(eval_fis(fis_tips, in_vals) )
|
Thanks a lot, # Convert named tuple to array
inputs_names = [:service, :food]
r(val) = [haskey(val, i) ? getindex(val, i) : "" for i in inputs_names]
rule1 = Rule(r((service="poor", food = "rancid")), "cheap", "MAX")
rule2 = Rule(r((service="good",)), "average")
rule3 = Rule(r((service="excellent", food = "delicious")), "generous", "MAX")
rules = [rule1, rule2, rule3] I don't know if this syntax could be relevant for others? |
@pierrethiriet I created a new issue related to this modification in syntax, for now I will close this issue and merge the changes with master. |
I am currently moving from R to Julia. I am trying to test the Fuzzy.jl package and I have a small issue with the rule definition.
Is it possible to target only a subset of input in a rule?
In the following example, I a trying to reproduce the classical example of restaurant tip :
Rules:
So is there a way to avoid including food input for the rule2 ?
Thanks
The text was updated successfully, but these errors were encountered: