MCPcopy
hub / github.com/tensorflow/tfjs-examples / buildMLPModel

Function buildMLPModel

jena-weather/models.js:109–119  ·  view source on GitHub ↗
(inputShape, kernelRegularizer, dropoutRate)

Source from the content-addressed store, hash-verified

107 * @returns {tf.LayersModel} A TensorFlow.js tf.LayersModel instance.
108 */
109export function buildMLPModel(inputShape, kernelRegularizer, dropoutRate) {
110 const model = tf.sequential();
111 model.add(tf.layers.flatten({inputShape}));
112 model.add(
113 tf.layers.dense({units: 32, kernelRegularizer, activation: 'relu'}));
114 if (dropoutRate > 0) {
115 model.add(tf.layers.dropout({rate: dropoutRate}));
116 }
117 model.add(tf.layers.dense({units: 1}));
118 return model;
119}
120
121/**
122 * Build a simpleRNN-based model for the temperature-prediction problem.

Callers 2

models_test.jsFile · 0.90
buildModelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected