diff --git a/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py b/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py index 8e3c104268599f2a528e48244ca4aab50eea9f05..ad2282b2474b92108ed918c27d39e88fc3feb58b 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py @@ -3,7 +3,7 @@ import sys import matplotlib.pyplot as plt import numpy as np -from scipy.stats import randint +from scipy.stats import randint, uniform from sklearn.model_selection import RandomizedSearchCV @@ -38,6 +38,23 @@ def grid_search(dataset, classifier_name, views_indices=None, k_folds=None, n_it """Used to perfom gridsearch on the classifiers""" pass +class CustomUniform: + """Used as a distribution returning a float between loc and loc + scale.. + It can be used with a multiplier agrument to be able to perform more complex generation + for example 10 e -(float)""" + + def __init__(self, loc=0, state=1, multiplier=""): + self.uniform = uniform(loc, state) + self.multiplier = multiplier + + def rvs(self, random_state=None): + unif = self.uniform.rvs(random_state=random_state) + if self.multiplier == 'e-': + return 10 ** -unif + else: + return unif + + class CustomRandint: """Used as a distribution returning a integer between low and high-1. It can be used with a multiplier agrument to be able to perform more complex generation