def main(): random_state = 42 np.random.seed(random_state) model_dir_path = './models' data_file_path = '../data/training_data' text_label_pairs = load_text_label_pairs(data_file_path, label_type='line_label') classifier = WordVecLstmSoftmax() classifier.load_model(model_dir_path=model_dir_path) shuffle(text_label_pairs) for i in range(20): text, label = text_label_pairs[i] print('Output: ', classifier.predict(sentence=text)) predicted_label = classifier.predict_class(text) print('Sentence: ', text) print('Predicted: ', predicted_label, 'Actual: ', label)
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 = WordVecLstmSoftmax() 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)