Comments (10)
Hi Theo
Thanks for your post and interesting article.
You are almost there! In fuzzylite,
Does that make sense?
Cheers
from help.
Hello,
If I'm not mistaken, the new equation is:
Which gives:
class Mean3Pi(fl.SNorm):
def compute(self, a: Scalar, b: Scalar) -> Scalar:
a = fl.scalar(a)
b = fl.scalar(b)
# for testing purpose
print("a: ", a, "\nb: ", b, "\n")
numerator = np.sqrt(a) * np.sqrt(b)
denominator = np.sqrt(a) * np.sqrt(b) + np.sqrt(1 - a) * np.sqrt(1- b)
return numerator / denominator
But in some cases there is "nan" in the values of
Those appear during the processing of the engine, so I'm thinking that maybe
Even when there's no "nan", the output variables has no value, both discrete and fuzzy (except in very rare cases).
I don't understand what could be the source this problem, I'll do some further testing.
Cheers
from help.
Hi,
The equations seem fine, but your problem is happening before the aggregation.
Would you like to share your engine in the fuzzylite language? I just want to check with QtFuzzyLite how your engine is working without the aggregation.
You could also get QtFuzzyLite at: https://fuzzylite.com/buy
from help.
Hello,
Sure, the code is available here: https://github.com/YamatoFr/FOG_computing_tasks_scheduling/tree/main/scripts/fuzzy
The engine and the code for the M3P are in fuzzyengine.py, the processing is done in fuzzyprocessing.py.
And here's the engine in the fuzzylite language:
Edit: there's a .fll file available too.
Engine: TaskOffloading
InputVariable: Bandwidth
enabled: true
range: 0.000 100.000
lock-range: false
term: bw_low Trapezoid 0.000 20.000 30.000 40.000
term: bw_medium Trapezoid 35.000 45.000 60.000 70.000
term: bw_high Trapezoid 65.000 75.000 90.000 100.000
InputVariable: Datasize
enabled: true
range: 0.000 600.000
lock-range: false
term: data_low Trapezoid 0.000 0.000 230.000 360.000
term: data_medium Trapezoid 250.000 350.000 470.000 590.000
term: data_high Trapezoid 450.000 540.000 600.000 600.000
InputVariable: Load
enabled: true
range: 0.000 100.000
lock-range: false
term: load_low Trapezoid 0.000 0.000 25.000 40.000
term: load_medium Trapezoid 35.000 45.000 60.000 70.000
term: load_high Trapezoid 65.000 80.000 100.000 100.000
InputVariable: Memory
enabled: true
range: 0.000 100.000
lock-range: false
term: mem_low Trapezoid 0.000 0.000 25.000 40.000
term: mem_medium Trapezoid 35.000 45.000 60.000 70.000
term: mem_high Trapezoid 65.000 80.000 100.000 100.000
InputVariable: NB_concurrent_users
enabled: true
range: 0.000 100.000
lock-range: false
term: user_low Trapezoid 0.000 0.000 25.000 40.000
term: user_medium Trapezoid 30.000 40.000 60.000 70.000
term: user_high Trapezoid 60.000 75.000 100.000 100.000
OutputVariable: Processing
enabled: true
range: 0.000 100.000
lock-range: false
aggregation: none
defuzzifier: Centroid 200
default: nan
lock-previous: false
term: local_processing Trapezoid 0.000 12.000 24.000 48.000
term: remote_processing Trapezoid 36.000 60.000 72.000 100.000
RuleBlock: Mamdani
enabled: true
conjunction: Minimum
disjunction: Maximum
implication: Minimum
activation: General
rule: if Bandwidth is bw_low then Processing is local_processing
rule: if Bandwidth is not bw_low and Datasize is not data_low then Processing is remote_processing
rule: if Bandwidth is not bw_low and Datasize is data_low and (Load is load_high or Memory is mem_low) then Processing is remote_processing
rule: if Bandwidth is not bw_low and Datasize is data_low and (NB_concurrent_users is user_low or Memory is mem_low) then Processing is remote_processing
rule: if Bandwidth is not bw_low and Datasize is data_low and NB_concurrent_users is not user_low and Memory is not mem_low and Load is load_low then Processing is local_processing
rule: if Bandwidth is not bw_low and Datasize is data_low and NB_concurrent_users is not user_low and Memory is not mem_low and Load is not load_low then Processing is remote_processing
from help.
Hi,
I think your problem could be that you are not setting the values of the input variables correctly.
Maybe create a Google Collab notebook and share the code that makes it fail?
Cheers.
from help.
Also, I noticed maybe a bug somewhere in your code, maybe unrelated to this issue:
if engine.output_variable("Processing").fuzzy_value() != nan:
you should compare nan
values using fl.Op.isnan(...)
.
And also, that fuzzy_value()
returns an array of strings.
from help.
Hi,
I've created a Colab notebook, I'll send the link to you via mail.
Cheers.
from help.
Hi, I took a look.
The problem is the numerator becoming zero, which happens whenever a or b are zero.
Also, the expansion of the equation may not be the solution for using fuzzylite. I did not read the article fully, but it may be the case that you need to do it differently. In fuzzylite, you need only a and b because of the way it is aggregated. See the following:
But the 3MeanPi may not work with this approach because
To summarise, I would do:
- Implement
class Aggregated3MeanPi(Aggregated):
. - Override
membership
to compute theMean3Pi
properly based on the number of activated terms - Skip any zero-degree activations.
It is a bit more complex than what you have done so far. I particularly don't know:
- how will you compute
$n$ when ignoring zero-degree activations (is$n$ affected?) - how will you order
$x$ ? Are the$x_i$ sorted by activation degree? Or by index in output variable?
I hope this helps.
from help.
Hello,
Thanks for the help, I've made some good progress thanks to you (new bugs/errors are still progress). I do have one last question, where should I call this new membership
function? Is it in the compute
function or elsewhere?
Cheers.
from help.
Cool. If you implemented the Aggregated class overriding the membership function, then you just need to set it in the output variable (eg output_variable.fuzzy = Aggregated3MeanPi(...)
; see
https://github.com/fuzzylite/pyfuzzylite/blob/0fc7c5747934b53b6a35ff830fcc02e8ae38196e/fuzzylite/variable.py#L379
)
Oh, by the way, on what I don't know that I mentioned before, you probably don't care about the order of x. I was confused that the exponent was related to the ordering, but it is just a constant.
from help.
Related Issues (13)
- Can Qt/FuzzyLite library be accessible in managed code (.NET application)? HOT 1
- Linking problem Visual Studio C++ HOT 1
- Surface plot HOT 1
- Documentation links to code not working HOT 1
- Issues about Outputs HOT 1
- Problem with unassigned input variables HOT 1
- Newbie trouble with building library with CMakeList HOT 2
- QtFuzzLite 6 Internal Error HOT 1
- 'not' and 'any' HOT 2
- "[file error] file <> could not be opened" when trying to import .fis HOT 5
- "[file error] file <> could not be opened" (update) HOT 7
- Problem with using output variable as input variable in C++ HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from help.