ashhadulislam / HBKUExplainAISpring2023

Building new algorithms for better feature extraction, optimization and explainability in AI
1 stars 3 forks source link

PSO optimization weights do not change #2

Open ashhadulislam opened 1 year ago

ashhadulislam commented 1 year ago

pbest value for all particles are same. PSO_optim_val

Issue detected and opened by Sara

ashhadulislam commented 1 year ago

This happens in cases when, after multiplying by the weights, all the result values become more than the threshold. For example, say we have 30 columns, each column is normalized between 0 and 1 However, when we multiply them with the weights, it may so happen that the resulting values go more than 1. In case of the breast cancer dataset, the weights ~(0,1) the features ~(0,1), however after multiplying and ADDING, the result values become all more than 1. However, the threshold is randomly selected between 0 and 1. Thus while grouping into more than and less than threshold, all results are going into the class "more than threshold".

Screen Shot 2023-04-01 at 8 05 46 PM

As can be seen in the figure, threshold is 0.037460517 while all the weights are more than 1.

Thus, solution is to normalize the results every time they are generated.

ashhadulislam commented 1 year ago

Also, this problem of same PSO threshold is seen in case of breast cancer dataset and not iris dataset. The reason is that as iris dataset has only 4 columns, after multiplication and addition the sum res is not more than 1.

ashhadulislam commented 1 year ago

Above solution works when we use only the train dataset. Now imagine you have only one row in your test dataset. You multiply it with the best weights and sum it up You get a value >1. Now, how are you going to normalize it?

ashhadulislam commented 1 year ago

One option is to use tanh function

Screen Shot 2023-04-01 at 9 11 17 PM