defvectorize_sequences(sequences, dimension=10000): # Create an all-zero matrix of shape (len(sequences), dimension) results = np.zeros((len(sequences), dimension)) for i, sequence inenumerate(sequences): results[i, sequence] = 1.# set specific indices of results[i] to 1s return results
# Our vectorized training data x_train = vectorize_sequences(train_data) # Our vectorized test data x_test = vectorize_sequences(test_data) # Our vectorized labels y_train = np.asarray(train_labels).astype('float32') y_test = np.asarray(test_labels).astype('float32')
model = models.Sequential() model.add(layers.Dense(16, activation='relu', input_shape=(10000,))) model.add(layers.Dense(16, activation='relu')) model.add(layers.Dense(1, activation='sigmoid'))
安装过程进行到Setting up the package cache时会很慢,如果有杀毒软件,会更慢,另外安装过程可能会下载一些包,所以安装过程需要保持联网。稍等,进度条跑完就安装完成了。如果一直卡住不动,可以试下重启安装程序。重启安装程序时,它会提示安装位置非空,让你换一个安装位置,可以去删了那个文件夹。
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.