if FLAGS.embed_status is False: init_embedding = None else: print('get initialized embedding...') init_embedding = embed.embedding #print("\nParameters:") #for attr, value in sorted(FLAGS.__flags.items(),reverse=True): # print("{}={}".format(attr.upper(), value)) #print("") print('load student data...') #load train data print('loading train data...') train_char_s, train_label_s = load_data.load_datas(config.TRAIN_DATA_UNI) #train_pred = get_pred_p.load_datas(config.TRAIN_DATA_UNI_PRED) # Build vocabulary print("Build vocabulary...") max_sentene_length = config.MAX_LEN #train_x_s, train_label_s, train_pred = build_bi_vocab.build_bi_vocabulary(train_char_s, train_label_s, train_pred, max_sentene_length, BI_GRAM) #load dev data print('loading dev data...') dev_char_s, dev_label_s = load_data.load_datas(config.DEV_DATA_UNI) dev_pred = get_pred_p.load_datas(config.DEV_DATA_UNI_PRED) #max_dev_sentene_length_s = max([len(x) for x in dev_char_s]) dev_x_s, dev_label_s, dev_pred = build_vocabulary.build_vocabulary( dev_char_s, dev_label_s, dev_pred, max_sentene_length)
''' fashion-mnist 数据集 进行基本分类 ''' import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib.pyplot as plt import load_data fashion_mnist = keras.datasets.fashion_mnist # (train_data, train_labels), (test_data, test_labels) = fashion_mnist.load_data() (train_images, train_labels), (test_images, test_labels) = load_data.load_datas() train_images = train_images / 255.0 test_images = test_images / 255.0 class_names = [ 'T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot' ] # print(train_images.shape) # plt.figure() # plt.imshow(train_images[0]) # plt.colorbar() # plt.grid(False) # plt.figure(figsize=(10,10)) # for i in range(25): # plt.subplot(5,5,i+1) # plt.xticks([]) # plt.yticks([])