-
Notifications
You must be signed in to change notification settings - Fork 70
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
Question about food and best dragon update in DA algorithm. #10
Comments
Ok, I will have a look. Could you also provide the function you are trying to minimize and a sample of the dataset? |
I'm using this function, but I have made some changes inside the algorithms to record fitness values in order to plot them. But the logic behind every algorithm is untouched. The fitness I am using:
Accuracy function:
Sample of Ionosphere:
|
In other algorithms like GAO of GWO it works just fine, but in DA something related with how food is generated is minimizing every feature to zero. |
Please try using version 1.5.1 of pyMetaheuristic. I believe the issue has been resolved in this update. Should you encounter any further problems, do not hesitate to inform me. |
I have tested the new version and although the values are no longer minimised to zero, the food does not update and remains stuck at the same values iteration after iteration. I have uploaded in my TFG-Wrapped-Based-Metaheuristics-Feature-Selection repository the changes I introduced in the algorithms and everything necessary to be able to run the datasets. However, I sincerely believe that I have not altered any of the logic of the algorithm, in fact, the rest of the algorithms that I have modified work very well. I have to say that it is an initial version for a university work and it is not yet parameterised or modularised in a proper way. |
I would also like to know where the food and predator update operators come from, I have read the original paper and it only mentions that F_i = F_p - P, being F_i food source and F_p food position vector. Thanks for your attention and sorry if for the for the inconvenience if something I asked was bad formulated or incorrect. |
Kindly review the updates in pyMetaheuristic version 1.5.3. In this version, 'food position' has been designated as the reference point for the optimal solution, while 'predator position' signifies the location of the enemy. These adjustments were specifically made to accelerate the algorithm's convergence rate. However, it's important to emphasize that the fundamental logic of the algorithm remains unchanged. Despite these enhancements, it's worth noting that the Dragonfly Algorithm (DA) inherently requires a considerable number of iterations to achieve a satisfactory solution. |
I have refactored the DA code in version 1.5.4. Please check which one is better for you, 1.5.3 or 1.5.4 |
I will have a look in the next few hours, thanks! |
Working way better than before, it needed more iterations as you said, but it works. Also the code is cleaner (in my opinion) than before. Thanks for your time. |
I am working to minimise a function according to typical criteria in feature selection (a mix between accuracy and reduction rate).
I find that the DA algorithm is minimising all features to 0. I've been investigating, specifically in the 'update_food' function, when I get to the
if (dimensions == dragonflies.shape[1] - 2): for k in range(0, dragonflies.shape[1]-2): food_position[0,k] = np.clip(food_position[0,k] - dragonflies[i,k], min_values[k], max_values[k])
I'm seeing that the dragonfly and the food being subtracted have the same values. This makes the food all 0's, in the following iterations when multiplying 0 by Levy and adding it to the food[0,k] it is still 0. I don't know what makes the subtracted dragonfly exactly the same, what I do know is that it is marked as the best solution and doesn't come out of it again.It happens with many of the datasets I have tried.
The text was updated successfully, but these errors were encountered: