Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(async () => {
Load our csv file and get it into a properly shaped array of pairs likes...
[distanceA, forceB],
[distanceB, forceB],
var pairs = getPairsFromCSV();
Train the model using the data.
var model = tf.sequential();
model.add(tf.layers.dense({units: 1, inputShape: [1]}));
model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});
const xs = tf.tensor1d( => p[0] / 100));
const ys = tf.tensor1d( => p[1]));
console.log(`Training ${pairs.length}...`);
await, ys, {epochs: 100});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment