Skip to content

AndrewJBateman/angular-tensorflow-notes

Repository files navigation

⚡ Angular TensorFlow Notepad

  • Code to experiment with machine learning using Tensorflow.js, starting with recognising numbers. Tutorial code from Fireship (see ref in 'Inspiration') cloned then updated to Angular 13. All dependencies updated. Requires some fixes to work, due to updates. The plan is to use this to try new Tensorflow ideas.
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • "TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models."

📷 Screenshots

Example screenshot

📶 Technologies

💾 Setup

  • npm i to install dependenciesy

  • ng serve then navigate to port 4200.

💻 Code Examples

  • tba
 async trainNewModel() {
      // Define a model for linear regression.
    this.linearModel = tf.sequential();
    this.linearModel.add(tf.layers.dense({units: 1, inputShape: [1]}));

    // Prepare the model for training: Specify the loss and the optimizer.
    this.linearModel.compile({loss: 'meanSquaredError', optimizer: 'sgd'});


    // Training data, completely random stuff
    const xs = tf.tensor1d([3.2, 4.4, 5.5, 6.71, 6.98, 7.168, 9.779, 6.182, 7.59, 2.16, 7.042, 10.71, 5.313, 7.97, 5.654, 9.7, 3.11]);
    const ys = tf.tensor1d([1.6, 2.7, 2.9, 3.19, 1.684, 2.53, 3.366, 2.596, 2.53, 1.22, 2.87, 3.45, 1.65, 2.904, 2.42, 2.4, 1.31]);


    // Train
    await this.linearModel.fit(xs, ys)

    console.log('model trained')
  }

🆒 Features

  • to follow

📋 Status & To-Do List

  • Status: not compiling due to errors from tensorflow update to v3
  • To-Do: Correct: Namespace has no exported member, loadModel does not exist.., fromPixels does not exist.

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact

About

📋 Code to experiment with machine learning using Tensorflow.js, starting with recognising numbers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published