Denbergvanthijs / imbDRL

Imbalanced Classification with Deep Reinforcement Learning
Apache License 2.0
33 stars 12 forks source link

AIC and BIC #8

Closed iMac-ant closed 1 year ago

iMac-ant commented 1 year ago

Dear @Denbergvanthijs , is there any method to compute AIC and BIC indicators using your framework?

Denbergvanthijs commented 1 year ago

The easiest way would probably be to fork the repo and make some changes to the metrics.py file. Otherwise it might be possible to implement your own callback function but I'm not sure if the repo is set-up in the correct way for this.

iMac-ant commented 1 year ago

Dear @Denbergvanthijs thank you very much for your quick feedback. I recognize that my question was imprecise and try to rephrase it. According to the used paradigm, and given AIC = n math.log(mse) + (2num_params) and BIC = n math.log(mse) + (num_paramsmath.log(n)), where num_params is the number of the model parameters, n is number of samples within the training set, how it is possible to compute mse in the case of a RL-based classifier? Generally speaking a possible way to do this using binary classifier is to transform the binary classification problem into a regression one, allowing the mse computation. What is your idea about it?

Denbergvanthijs commented 1 year ago

Very interesting! The output layer of the network consist of two nodes, one for each class. The output of the network is the q value for each class. You could use decision_function() instead of network_predictions() from metrics.py to get the q values instead of the binary decision.

The next step is convert these scores in the range [0, 1] using softmax or to a single probability value for either one of the classes and do some wrangling to calculate the MSE.

I'm not really sure though if this is the way you want to go. You will have to make a few unusual steps to make it work.

iMac-ant commented 1 year ago

Dear @Denbergvanthijs thank you very much for your answer. Do you know if there is any RL-literature reference to the method that you suggested? Actually, I'm handling a Major Revision of a my scientific paper in which your framework has been used and cited. Therefore, it is paramount to motive each choice.

iMac-ant commented 1 year ago

Moreover, my main concern lies in the fact that an RL agent defines the task to be addressed according to the MDP setting, unlike traditional methods for which the transition between the two different tasks, i.e. binary classification and regression, occurs simply.

Denbergvanthijs commented 1 year ago

The method I suggested is just to make it work, not based on any research or literature. I'm not that familiar with AIC and BIC, so I can't help you there.

Please send me your research when you are done! I am very interested in your work!

iMac-ant commented 1 year ago

Of course @Denbergvanthijs. Today, the paper has been accepted. I think that in a couple of days, it will be online and I will post here the URL to point it.

iMac-ant commented 1 year ago

Dear @Denbergvanthijs you can find the article here: https://www.mdpi.com/2073-431X/12/6/118 .

Denbergvanthijs commented 1 year ago

Amazing work, congratulations on the publication! Thanks for the citation! Great to hear that my old code from an internship a few years back is still useful for your research!