Comments (9)
Hi there 👋 ,
thank you for your interest!
Could you clarify what you mean that currently only integers are possible? It should work with floating-point numbers without problems
julia> using FuzzyLogic
julia> mf = TriangularMF(1.0, 2.0, 3.0)
TriangularMF{Float64}(1.0, 2.0, 3.0)
julia> m2 = TriangularMF(1.1, 2.3, 4.5)
TriangularMF{Float64}(1.1, 2.3, 4.5)
julia> mf(1.1)
0.10000000000000009
julia> m2(1.1)
0.0
julia> m2(1.5)
0.3333333333333333
from fuzzylogic.jl.
from fuzzylogic.jl.
Hi, yes a screen-shot would be very helpful.
Meanwhile, if I had to try to guess your issue, I would guess you encountered the following
julia> mf = TriangularMF(1, 2.1, 3.1)
ERROR: MethodError: no method matching TriangularMF(::Int64, ::Float64, ::Float64)
Closest candidates are:
TriangularMF(::T, ::T, ::T) where T<:Real
@ FuzzyLogic ~/.julia/dev/FuzzyLogic/src/membership_functions.jl:63
the problem here is that for many membership functions it expects all parameters to be of the same type, so either all integers or all floats. In that case, you would have to type
mf = TriangularMF(1.0, 2.1, 3.1)
this philosophy (all of the same type) is common in statically typed languages. There would be three possible fixes of this
- Leave it as is, and document better the inputs should either be all floats or all integer
$^*$ - Support automatically promoting inputs, so that
TrinagularMF(1, 2.1 3.1)
would automatically becomeTriangularMF(1.0, 2.1, 3.1)
- Parametrize each membership function by the type of each parameter.
I can think of small drawbacks of each solution, so none is perfect.
julia> GeneralizedBellMF(1.0, 2, 3.0)
GeneralizedBellMF{Float64, Int64}(1.0, 2, 3.0)
The reason for this is the following: for other membership functions (triangular, gaussian, etc.) supporting mixed types is just a small short-cut, since one can always type TriangularMF(1.0, 2.1, 3.0)
without any drawback. Indeed, it's very likely that the integer will be promoted to float at the first operation of the inference pipeline.
In the case of the Generalized Bell MF, however, the second parameter is significantly different from the others. The first and third are, respectively, a variance and a mean, while the second one is an exponent. It's much more reasonable to expect an exponent to be integer and also float ^ integer
is much faster than float ^ float
, which is why for the generalized bell membership function I chose from the beginning to support different types
from fuzzylogic.jl.
(the close issue was a misclick, reopened ;) )
from fuzzylogic.jl.
from fuzzylogic.jl.
I don't see your attached screenshots unfortunately.
For now you should be able to overcome the problem by typing the integer as float (e.g. 1.0
instead of 1
), does this get you unblocked?
I'll try to update the user interface to be more friendly and accept mixed inputs in the upcoming days.
from fuzzylogic.jl.
from fuzzylogic.jl.
In an upcoming release, one will be able to automatically create membership functions with mixed precisions, like
GaussianMF(1, 2.0)
TriangularMF(2, 4.0, 5//1)
and the constructor will automatically handle the promotion for all membership functions. This however relies on new features of Julia 1.10, so will have to wait for it to be released. I will notify on this issue, once this is implemented.
Meanwhile, you can manually convert those to floats, e.g. writing GaussianMF(1.0, 2.5)
instead of GaussianMF(1, 2.5)
from fuzzylogic.jl.
from fuzzylogic.jl.
Related Issues (4)
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 fuzzylogic.jl.