def fit_line_type(self, training_data_dir_path, model_dir_path, batch_size=None, epochs=None, test_size=None, random_state=None): text_data_model = fit_text(training_data_dir_path, label_type='line_type') text_label_pairs = load_text_label_pairs(training_data_dir_path, label_type='line_type') if batch_size is None: batch_size = 64 if epochs is None: epochs = 20 history = self.line_label_classifier.fit( text_data_model=text_data_model, model_dir_path=os.path.join(model_dir_path, 'line_type'), text_label_pairs=text_label_pairs, batch_size=batch_size, epochs=epochs, test_size=test_size, random_state=random_state) return history
def main(): random_state = 42 np.random.seed(random_state) output_dir_path = './models' data_file_path = '../data/training_data' text_data_model = fit_text(data_file_path) text_label_pairs = load_text_label_pairs(data_file_path) classifier = WordVecCnn() batch_size = 64 epochs = 20 history = classifier.fit(text_data_model=text_data_model, model_dir_path=output_dir_path, text_label_pairs=text_label_pairs, batch_size=batch_size, epochs=epochs, test_size=0.3, random_state=random_state)