Skip to content

Instantly share code, notes, and snippets.

@LiorB-D
Created July 15, 2022 10:36
Show Gist options
  • Save LiorB-D/6608c59efebfd2c8ad68b6d74ffa40fa to your computer and use it in GitHub Desktop.
Save LiorB-D/6608c59efebfd2c8ad68b6d74ffa40fa to your computer and use it in GitHub Desktop.
setupModel() {
// Create a sequential neural network
this.model = tf.sequential();
let hidden1 = tf.layers.dense({
units: 8,
activation: "relu",
inputDim: 5,
});
let outputLayer = tf.layers.dense({
units: 4,
activation: "sigmoid",
});
this.model.add(hidden1);
this.model.add(outputLayer);
//Compile
this.model.compile({
optimizer: "adam",
loss: "binaryCrossentropy"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment