Git Product home page Git Product logo

Comments (6)

thieu1995 avatar thieu1995 commented on May 18, 2024

@jacobkndy ,

Everything I said and did in the video is important. Please don't skip any part of it.
Watch this video: https://www.youtube.com/watch?v=auq7Na1Meus
at 59:40 - Using FPA optimizer instead of GWO optimizer (I even noted with the timestamp in video description)
You can use any algorithm in this library (PSO, WOA, SSA, whatever...) to solve this kind of problem.
That is the purpose of this library.
For other libraries, you have to design your own operators for each problem. But we don't do that here.
We just need to create an object of optimizer you want to use and call the function solve().

For the question about binary classification.
I don't know, you have to try every algorithm you want to and compare the results. Maybe PSO gives better results than GWO.
It also depends on your problem (your dataset)...

Just remember, no algorithm is better than all other algorithms in all problems (No-Free-Launch Theory). Or there will be no best algorithm in all problems.

from mealpy.

jkseven-art avatar jkseven-art commented on May 18, 2024

@thieu1995
You're right sir. this library suits to all kind of problems but I read somewhere that for using PSO algorithm in binary classification, we have to make it binary optimizer because it's a kind of non-binary algorithm. my question was that should I edit some part of code in order to get a binary PSO for this kind of problems or not? or maybe u think having "sigmoid" function as activation is enough?
Thank you for being there.

from mealpy.

thieu1995 avatar thieu1995 commented on May 18, 2024

@jacobkndy
I got you now. At first, I thought you are talking about the binary classification problem. But you are actually talking about binary PSO.
But still, you are misunderstanding between the problem and the optimizer. As I said, they are not related to each other.
Binary classification is a problem, if you use a neural network then its output is the probability of two classes (0 or 1).
To solve this problem with a neural network, they usually use a gradient-based optimizer like (adam, adelta,...) (continuous domain and continuous problem).

Binary PSO is just a way to represent a solution in form of a binary vector like [0, 0, 1]. For normal PSO, it is usually a real value vector like [0.1, -0.2, 1.5,...].
Binary used in Metaheuristic Algorithm is a term originally come from Genetic Algorithm. Because a Chromosome of a human's DNA sequence is represented by [g1, g2,..., gn] in which gi is a gene and coded by m bits (binary representation).
So they use this kind of representation for binary Genetic Algorithm only.
But for the continuous domain, they use a real value encoded mechanism like above.
https://prateek-mishra.medium.com/binary-genetic-algorithm-19936e755271
Other algorithms with the word Binary in front of them just like copy-paste the form of GA. And it is actually not good for their algorithm because they design their algorithm by the continuous operator (real value). But use binary representation to encode a solution.

So I suggest you don't do that. Just understand your problem is a discrete problem or the continuous problem. And select algorithms you want to use.
For example in my tutorial videos:

  • Mealpy replaces Gradient Descent of Neural Network is the continuous problem.
  • Mealpy optimizes hyper-parameter of Neural Network is mixed of discrete variables and continuous variables.

So forget about binary PSO, just use the normal algorithm for the continuous problem since this library is for the continuous problem. But It can also solve the discrete problem as I did with the example of hyper-parameter tuning.

I just google it.
image

from mealpy.

jkseven-art avatar jkseven-art commented on May 18, 2024

@thieu1995
I appreciate you. I take ur time a lot. actually I saw you in the video that using pima-indians-diabetes (which is a kind of binary classification) and thought that my dataset is like this. for example I have 12 feature (input) and one output which could be [0 or 1]. I know that my problem is a kind of discrete problem and for this reason I wanted to learn how to make binary PSO, but when I saw these videos and because my dataset was like "pima-indians-diabetes" so I guess maybe I can use PSO algorithm.
that's the story.
thanks for your time and your attention.

from mealpy.

thieu1995 avatar thieu1995 commented on May 18, 2024

@jacobkndy ,

As you said above, "I was looking for a metaheuristic algorithm to optimize neural network's weights". Your problem is continuous, not discrete.
Your variables (solutions) are continuous values from -1 to 1 (weights of network usually set from -1 to 1).

If you want to use metaheuristics to find the best hyper-parameter of the classification model. Then your problem can be a continuous problem, discrete problem, or mix between them, it depends on the parameter you choose is continuous or discrete.

I think I will close this issue now. I explained everything you need to know. May need to re-read some more times to get what did I say.

from mealpy.

jkseven-art avatar jkseven-art commented on May 18, 2024

from mealpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.