Machine learning (often abbreviated to ML) is a field of artificial intelligence loosely defined as the study of programs and algorithms that allow computers to perform tasks without specific instructions.
A fairly typical “supervised learning” ML program works by creating a “model,” similar to a mathematical model, with inputs and outputs. It then accepts a batch of training data with inputs and actual outputs, and “trains” itself by tweaking parameters of the model in order to minimize the amount of error of the model. In other words, the program will change the model to try to make its output match the desired, “actual” output.
Here’s a quick analysis of TensorFlow.js:
A Node.js version of TensorFlow, tfjs-node, also exists and offers improved performance over the browser version.
One of my favorite features of TensorFlow.js is that it allows you to load pretrained models. That means you can use libraries like this one and include image classification and pose detection on your website without the need to train the model yourself.
TensorFlow.js also allows you to load models you’ve trained in the Python version of TensorFlow. That means you can write a model and train it using Python, then save it to a location available on the web and load it in your JS. This technique can significantly improve performance because you don’t have to train the model in the browser.
More and more, businesses are using machine learning to improve interactions with users. AI programs handle everything from self-driving cars to matchmaking in video games, chatbots like Siri and Alexa, and suggesting content for users. In the past, however, machine learning has been handled on back-end servers.
Here are some uses of ML (not all examples use TensorFlow.js) to fill your mind with possibilities:
A complete tutorial for TensorFlow.js is a little outside the scope of this article, but here are some really helpful resources:
As PWAs become more popular, we can expect to see more and more integrations with TensorFlow.js and on-device storage. Since TensorFlow.js allows you to save models, you could create a model that trains itself on each user to provide a personalized experience, and even works offline.
According to TensorFlow, a WebAssembly backend is in development as well, which should further improve performance.
Now that you’ve learned a little about TensorFlow.js, go make something with it! You’ll be surprised at what you can create after only a little while. If you’re stuck, look at the documentation and the many examples on GitHub.
Debugging code is always a tedious task. But the more you understand your errors, the easier it is to fix them.
ElectricSQL is a cool piece of software with immense potential. It gives developers the ability to build a true local-first application.
Leptos is an amazing Rust web frontend framework that makes it easier to build scalable, performant apps with beautiful, declarative UIs.
We spoke with Dom about his approach to balancing innovation with handling tech debt and to learn how he stays current with technology.