December 2017
Intermediate to advanced
536 pages
14h 23m
English
Here, we used TensorFlow ops Layers (Contrib) to build neural network layers. It made our work slightly easier as we were saved from declaring weights and biases for each layer separately. The work can be further simplified if we use an API like Keras. Here is the code for the same in Keras with TensorFlow as the backend:
#Network Parametersm = len(X_train)n = 3 # Number of featuresn_hidden = 20 # Number of hidden neurons # Hyperparametersbatch = 20eta = 0.01max_epoch = 100# Build Model model = Sequential() model.add(Dense(n_hidden, input_dim=n, activation='relu')) model.add(Dense(1, activation='sigmoid')) model.summary() # Summarize the model #Compile model model.compile(loss='mean_squared_error', optimizer='adam') #Fit the ...
Read now
Unlock full access