def __init__(self, verbose=False, path=None, resume=False, searcher_args=None): super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = temp_folder_generator() self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose) self.path = path if has_file(os.path.join(self.path, 'text_classifier')) and resume: classifier = pickle_from_file( os.path.join(self.path, 'text_classifier')) self.__dict__ = classifier.__dict__ else: self.y_encoder = None self.data_transformer = None self.verbose = verbose
def __init__(self, verbose=False, path=constant.DEFAULT_SAVE_PATH, resume=False, searcher_args=None): """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: An 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: An boolean. If True, the classifier will continue to previous work saved in path. Otherwise, the classifier will start a new search. """ if searcher_args is None: searcher_args = {} if has_file(os.path.join(path, 'classifier')) and resume: classifier = pickle_from_file(os.path.join(path, 'classifier')) self.__dict__ = classifier.__dict__ self.path = path else: self.y_encoder = None self.data_transformer = None self.verbose = verbose self.searcher = False self.path = path self.searcher_args = searcher_args ensure_dir(path)
def __init__(self, n_classes, input_shape, path, verbose): """Init Searcher class with n_classes, input_shape, path, verbose The Searcher will be loaded from file if it has been saved before. """ if has_file(os.path.join(path, "searcher")): searcher = pickle.load(open(os.path.join(path, 'searcher'), 'rb')) self.__dict__ = searcher.__dict__ else: self.n_classes = n_classes self.input_shape = input_shape self.verbose = verbose self.history_configs = [] self.history = [] self.path = path self.model_count = 0
def __init__(self, verbose=False, path=None, resume=False, searcher_args=None, augment=None): """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. augment: A boolean value indicating whether the data needs augmentation. If not define, then it will use the value of Constant.DATA_AUGMENTATION which is True by default. """ super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = temp_folder_generator() self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose) if augment is None: augment = Constant.DATA_AUGMENTATION if has_file(os.path.join(path, 'classifier')) and resume: classifier = pickle_from_file(os.path.join(path, 'classifier')) self.__dict__ = classifier.__dict__ self.path = path else: self.y_encoder = None self.data_transformer = None self.verbose = verbose self.searcher = False self.path = path self.searcher_args = searcher_args self.augment = augment ensure_dir(path)
def __init__(self, verbose=False, searcher_type=None, path=constant.DEFAULT_SAVE_PATH, resume=False): """Initialize the instance. The classifier will be loaded from file if the directory in 'path' has a saved classifier. Otherwise it would create a new one. """ if has_file(os.path.join(path, 'classifier')) and resume: classifier = pickle.load( open(os.path.join(path, 'classifier'), 'rb')) self.__dict__ = classifier.__dict__ else: self.y_encoder = None self.verbose = verbose self.searcher = False self.searcher_type = searcher_type self.path = path ensure_dir(path)
def __init__(self, verbose=False, path=None, resume=False, searcher_args=None, augment=None): """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. augment: A boolean value indicating whether the data needs augmentation. If not define, then it will use the value of Constant.DATA_AUGMENTATION which is True by default. """ super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = temp_folder_generator() if augment is None: augment = Constant.DATA_AUGMENTATION if has_file(os.path.join(path, 'classifier')) and resume: classifier = pickle_from_file(os.path.join(path, 'classifier')) self.__dict__ = classifier.__dict__ self.path = path else: self.y_encoder = None self.data_transformer = None self.verbose = verbose self.searcher = False self.path = path self.searcher_args = searcher_args self.augment = augment ensure_dir(path)
def __init__(self, verbose=False, path=None, resume=False, searcher_args=None): """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. """ super().__init__(verbose) if searcher_args is None: searcher_args = {} if path is None: path = temp_folder_generator() self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose) self.path = path if has_file(os.path.join(self.path, 'text_classifier')) and resume: classifier = pickle_from_file( os.path.join(self.path, 'text_classifier')) self.__dict__ = classifier.__dict__ else: self.y_encoder = None self.data_transformer = None self.verbose = verbose