keras-team / keras-tuner

A Hyperparameter Tuning Library for Keras
https://keras.io/keras_tuner/
Apache License 2.0
2.85k stars 394 forks source link

HyperResNet with binary classification #784

Open ZviBaratz opened 1 year ago

ZviBaratz commented 1 year ago

Hi maintainers,

I am using HyperResNet for a binary classification problem, and ended up subclassing it to modify the last layer and loss to be suitable for binary classification rather than multi-class. I wondered whether this would make a welcome addition – if it would, I'd be happy to come up with a PR.

Thank you for all your marvelous work!

haifeng-jin commented 1 year ago

@ZviBaratz Usually for this use case, we would suggest using HyperResNet(include_top=False).

However, it is strange for HyperResNet to use multi-class settings for binary classification. We may want to add a condition if self.classes==2: to this part and add the binary case there.

Thank you for the issue! Let me know if you are still interested in contributing.

ZviBaratz commented 1 year ago

Hi @haifeng-jin, thank you for your response. I'd be happy to propose a PR (also for HyperXception, as it has the same issue). I'm a little busy in the next couple of weeks, but I'll try to come up with something whenever I free up a little bit. All the best :pray:

haifeng-jin commented 1 year ago

@ZviBaratz , Sure, Thank you! If it is common for both classes, we may try to extract a super class, or so-called mixin, to reuse the code.

ZviBaratz commented 1 year ago

Sorry, can't seem to be able to fit this in. Just updating in case anyone else is interested in taking this on.