Machine Learning Using HTML
Machine Learning Using HTML
Tools Required –
· Browser – Google chrome/Firefox.
· Understanding of basic HTML.
THAT’S
IT!!! Learn Complete AI and Deep learning using HTML
No Need to INSTALL ANY TOOLS
OR LIBS !! 😊
Vedio#1: Linear Learning Using HTML
URL= <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.11.2"></script>
https://js.tensorflow.org/api/latest/
- API LIST
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.11.2"></script>
</head>
<body>
<b>X values</b>
<div id="v1"></div>
<b>Y values</b>
<div id="v2"></div>
<b>Perdicted
value</b>
<div id="output_field"></div>
</body>
<script>
async function learnLinear() {
// Define a
model for linear regression.
const xs = tf.tensor([1, 2, 3, 4]);
const ys = tf.tensor([1, 2, 3, 4]);
document.getElementById('v1').innerText =xs;
document.getElementById('v2').innerText =ys;;
const model = tf.sequential();
model.add(tf.layers.dense({ units: 1,
inputShape: [1] }));
model.compile({ loss: 'meanSquaredError', optimizer: 'sgd' });
// Generate
some synthetic data for training.
// Train the
model using the data.
model.fit(xs, ys, { epochs: 100
}).then(() => {
// Use the
model to do inference on a data point the model hasn't seen before:
document.getElementById('output_field').innerText =
model.predict(tf.tensor2d([5], [1,
1]));
// Open the
browser devtools to see the output
});
}
learnLinear();
</script>
</html>
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home