def load_data_and_labels():
articles = np.load('data/bin/all_articles.npy')
labels = np.load('data/bin/all_labels.npy')
articles = [clean_str(article) for article in articles]
# Map the actual labels to one hot labels
label_list = sorted(list(set(labels)))
one_hot = np.zeros((len(label_list), len(label_list)), int)
np.fill_diagonal(one_hot, 1)
label_dict = dict(zip(label_list, one_hot))
labels = one_hot_encode(labels, label_dict)
x_raw = articles
y_raw = labels
return x_raw, y_raw, label_list
评论列表
文章目录