Closed gift-exe closed 1 year ago
what's up I have some remarks:
1. )
The annotation for the prior_space
in gaussianNB is not correct, the only valid values in the space are arraylike or None. Inotherwords the annotation ought to be:
prior_space: Iterable[Optional[Iterable[float]]] = (None, )
2.) I suggest you also change the space value of var_smoothing to (1e-10, 1e-6) instead of (1e-9, 1e-6)
3.)
In the BernoulliNBTuner class, the binarize
is float, but it can also be set to None. In this case you ought to make a new parameter space called set_binarize_space
which will be a bool space of True or False.
In the _sample_params
method, you sample from the set_binarize_space
(do not add this to the params dict). you then check whatever value was sampled and know when to use binarize or not.
like this:
set_binarize = trial.suggest_categorical("set_binarize", self.set_binarize_space)
if use_binarize:
params['binarize'] = trial.suggest_float("binarize", *self.binarize_space, log=False)
4.)
The annotation for class_prior_space
is correct, but you can make it more detailed like this:
class_prior_space: Iterable[Optional[Iterable[float]]]
This is same as the prior_space
for the GaussianNB and should apply to all other class_prior_space
attributes of other NBTuner classes.
Everything should be all good now
ps. all the test passed