I'm currently trying out linear regression in tensorflow js. I'm inputting x-values into a predict function and getting y-values using dataSync(). Is there a way I can do this asynchronously so it's quicker? The x-values are inputted by plotting points on a canvas.
Here's a part of the code:
function setup() {
createCanvas(1000, 600);
canvas.style.border = '1px solid blue';
m = tf.variable(tf.scalar(random(0)));
b = tf.variable(tf.scalar(random(0)));
}
let ys = tf.tidy(() => predict(curveX));
let curveY = ys.dataSync();
ys.dispose();