37章蝶ネクタイ――多層ネットワークBow Tie
制約
- 蝶ネクタイのような形状のネットワークで、少なくとも1つの隠れ層を持つ。
プログラム
1 from keras.models import Sequential 2 from keras.layers import Dense 3 import numpy as np 4 import sys, os, string 5 6 characters = string.printable 7 char_indices = dict((c, i) for i, c in enumerate(characters)) 8 indices_char = dict((i, c) for i, c in enumerate(characters)) 9 10 INPUT_VOCAB_SIZE = len(characters) 11 12 def encode_one_hot(line): 13 x = np.zeros((len(line), INPUT_VOCAB_SIZE)) 14 for i, c in enumerate(line): 15 index = char_indices[c] if c in characters else char_indices[' '] 16 x[i][index] = 1 17 return x 18 19 def decode_values(x): 20 s = [] ...
Get プログラミング文体練習 ―Pythonで学ぶ40のプログラミングスタイル now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.