def __init__(self, verbose=False, path=None, resume=False, searcher_args=None, search_type=BayesianSearcher): """Initialize the instance. The classifier will be loaded from the files in 'path' if parameter 'resume' is True. Otherwise it would create a new one. Args: verbose: A boolean of whether the search process will be printed to stdout. path: A string. The path to a directory, where the intermediate results are saved. resume: A boolean. If True, the classifier will continue to previous work saved in path. Otherwise, the classifier will start a new search. searcher_args: A dictionary containing the parameters for the searcher's __init__ function. search_type: A constant denoting the type of hyperparameter search algorithm that must be used. """ super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = rand_temp_folder_generator() self.path = path ensure_dir(path) if resume: classifier = pickle_from_file(os.path.join(self.path, 'classifier')) self.__dict__ = classifier.__dict__ self.cnn = pickle_from_file(os.path.join(self.path, 'module')) else: self.y_encoder = None self.data_transformer = None self.verbose = verbose self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose, search_type)
def __init__(self, verbose=False, path=None, resume=False, searcher_args=None, search_type=BayesianSearcher): """Initialize the instance. The classifier will be loaded from the files in 'path' if parameter 'resume' is True. Otherwise it would create a new one. Args: verbose: A boolean of whether the search process will be printed to stdout. path: A string. The path to a directory, where the intermediate results are saved. resume: A boolean. If True, the classifier will continue to previous work saved in path. Otherwise, the classifier will start a new search. searcher_args: A dictionary containing the parameters for the searcher's __init__ function. search_type: A constant denoting the type of hyperparameter search algorithm that must be used. """ super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = rand_temp_folder_generator() self.path = path ensure_dir(path) if resume: classifier = pickle_from_file(os.path.join(self.path, 'classifier')) self.__dict__ = classifier.__dict__ self.cnn = pickle_from_file(os.path.join(self.path, 'module')) else: self.y_encoder = None self.data_transformer = None self.verbose = verbose self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose, search_type)
def __init__(self, verbose=False, path=None): """Initialize the instance. Args: verbose: A boolean of whether the search process will be printed to stdout. path: A string. The path to a directory, where the intermediate results are saved. """ super().__init__(verbose) if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, loss, metric, searcher_args=None, path=None, verbose=False, search_type=BayesianSearcher): self.searcher_args = searcher_args if searcher_args is not None else {} self.searcher = None self.path = path if path is not None else rand_temp_folder_generator() ensure_dir(self.path) if verbose: print('Saving Directory:', self.path) self.verbose = verbose self.loss = loss self.metric = metric self.generators = [] self.search_type = search_type
def __init__(self, loss, metric, searcher_args=None, path=None, verbose=False, search_type=BayesianSearcher): self.searcher_args = searcher_args if searcher_args is not None else {} self.searcher = None self.path = path if path is not None else rand_temp_folder_generator() ensure_dir(self.path) if verbose: print('Saving Directory:', self.path) self.verbose = verbose self.loss = loss self.metric = metric self.generators = [] self.search_type = search_type
def __init__(self, verbose=False, path=None): """Initialize the instance of the SingleModelSupervised class. Args: verbose: A boolean of whether the search process will be printed to stdout. (optional, default = False) path: A string. The path to a directory, where the intermediate results are saved. (optional, default = None) """ super().__init__(verbose) if path is None: path = rand_temp_folder_generator() self.path = path self.graph = None self.data_transformer = None
def __init__(self, graph, y_encoder, data_transformer, verbose=False, path=None): """Initialize the instance. Args: graph: The graph form of the learned model """ super(PortableDeepSupervised, self).__init__(graph, verbose) self.y_encoder = y_encoder self.data_transformer = data_transformer if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, y_encoder=OneHotEncoder, data_transformer_class=ImageDataTransformer, verbose=False, path=None): self.graph = None self.generator = None self.loss = classification_loss self.metric = Accuracy self.y_encoder = y_encoder() self.data_transformer_class = data_transformer_class self.data_transformer = None self.verbose = verbose if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, path=None, **kwargs): """ Initialization function for tabular supervised learner. """ super().__init__(**kwargs) self.is_trained = False self.clf = None self.objective = None self.tabular_preprocessor = None self.path = path if path is not None else rand_temp_folder_generator() ensure_dir(self.path) if self.verbose: print('Path:', path) self.save_filename = os.path.join(self.path, 'lgbm.txt') self.time_limit = None self.lgbm = None
def __init__(self, path=None, **kwargs): """ Initialization function for tabular supervised learner. """ super().__init__(**kwargs) self.is_trained = False self.clf = None self.objective = None self.tabular_preprocessor = None self.path = path if path is not None else rand_temp_folder_generator() ensure_dir(self.path) if self.verbose: print('Path:', path) self.save_filename = os.path.join(self.path, 'lgbm.txt') self.time_limit = None self.lgbm = None
def __init__(self, graph, y_encoder, data_transformer, verbose=False, path=None): """Initialize the instance. Args: graph: The graph form of the learned model. y_encoder: The encoder of the label. See example as OneHotEncoder data_transformer: A transformer class to process the data. See example as ImageDataTransformer. verbose: A boolean of whether the search process will be printed to stdout. path: A string. The path to a directory, where the intermediate results are saved. """ super(PortableDeepSupervised, self).__init__(graph, verbose) self.y_encoder = y_encoder self.data_transformer = data_transformer if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, y_encoder=OneHotEncoder, data_transformer_class=ImageDataTransformer, verbose=False, path=None): self.graph = None self.generator = None self.loss = classification_loss self.metric = Accuracy self.y_encoder = y_encoder() self.data_transformer_class = data_transformer_class self.data_transformer = None self.verbose = verbose if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, graph, y_encoder, data_transformer, verbose=False, path=None): """Initialize the instance. Args: graph: The graph form of the learned model. y_encoder: The encoder of the label. See example as OneHotEncoder data_transformer: A transformer class to process the data. See example as ImageDataTransformer. verbose: A boolean of whether the search process will be printed to stdout. path: A string. The path to a directory, where the intermediate results are saved. """ super(PortableDeepSupervised, self).__init__(graph, verbose) self.y_encoder = y_encoder self.data_transformer = data_transformer if path is None: path = rand_temp_folder_generator() self.path = path
def __init__(self, path=None): """ This constructor is supposed to initialize data members. Use triple quotes for function documentation. """ super().__init__() self.is_trained = False self.clf = None self.save_filename = None self.objective = 'multiclass' self.tabular_preprocessor = None if path is None: path = rand_temp_folder_generator() print('Path:', path) self.path = path self.time_limit = None self.datainfo = None
def test_rand_temp_folder_generator(_): path = rand_temp_folder_generator() assert path.find("tests/resources/temp/autokeras_") != -1 clean_dir(path)
def test_rand_temp_folder_generator(_): path = rand_temp_folder_generator() assert path.find("tests/resources/temp/autokeras_") != -1 clean_dir(path)