def main(): random_state = 42 np.random.seed(random_state) data_dir_path = './data' model_dir_path = './models' report_dir_path = './reports' url_data = load_url_data(data_dir_path) text_model = extract_text_model(url_data['text']) batch_size = 64 epochs = 50 classifier = CnnLstmPredictor() history = classifier.fit(text_model=text_model, model_dir_path=model_dir_path, url_data=url_data, batch_size=batch_size, epochs=epochs) plot_and_save_history( history, CnnLstmPredictor.model_name, report_dir_path + '/' + CnnLstmPredictor.model_name + '-history.png')
def main(): data_dir_path = './data' model_dir_path = './models' predictor = LstmEmbedPredictor() predictor.load_model(model_dir_path) url_data = load_url_data(data_dir_path) count = 0 for url, label in zip(url_data['text'], url_data['label']): predicted_label = predictor.predict(url) print('predicted: ' + str(predicted_label) + ' actual: ' + str(label)) count += 1 if count > 20: break