MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / generateXYData

Function generateXYData

polynomial-regression/index.js:226–235  ·  view source on GitHub ↗
(canvas, coeffs)

Source from the content-addressed store, hash-verified

224
225// Generate x-y data based on the size of the canvas.
226function generateXYData(canvas, coeffs) {
227 const data = [];
228 for (let x = -canvas.width / 2; x < canvas.width / 2;
229 x += canvas.width / 25) {
230 data.push([
231 x, coeffs[0] * x * x * x + coeffs[1] * x * x + coeffs[2] * x + coeffs[3]
232 ]);
233 }
234 return data;
235}
236
237// Fit a model and render the data and predictions.
238async function fitAndRender() {

Callers 1

fitAndRenderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected