Tutorial by Examples

Function definition: def run_training(train_X, train_Y): Inputs variables: X = tf.placeholder(tf.float32, [m, n]) Y = tf.placeholder(tf.float32, [m, 1]) Weight and bias representation W = tf.Variable(tf.zeros([n, 1], dtype=np.float32), name="weight") b = tf.Variable(tf.zeros([...
def main(): train_X, train_Y = read_data() train_X = feature_normalize(train_X) run_training(train_X, train_Y) Note: remember review functions dependencies. read_data, feature_normalize and run_training
def feature_normalize(train_X): global mean, std mean = np.mean(train_X, axis=0) std = np.std(train_X, axis=0) return np.nan_to_num((train_X - mean) / std)
def read_data(): global m, n m = 50 n = 1 train_X = np.array( Internal data for the array ).astype('float32') train_Y = np.array( Internal data for the array ).astype('float32') return train_X, train_Y

Page 1 of 1