DEV Community


Posted on • Originally published at on

TensorFlow.js 101

I’ve been interested in Machine Learning since I was learning to code. I didn’t know how I would get there, but I knew there was potential to solve the problems that I wanted to solve. It looked complicated, but I wanted to know more. I wanted to see how I could share in this part of the tech industry. I wanted to have a voice. And then I met Gant Laborde, and he opened up the world and wrote a book on it. So of course, I thought it would be a great idea to get out of my comfort zone and learn TensorFlow.js (TFJS) using Gant’s Learning TensorFlow.js, and I would take it up a notch, and embrace uncomfortable learning in public by livestreaming as I did.

My Twitch stream will run for 11 Tuesdays, from 1-2:30 EST. And I’m hoping to parallel each stream with a blogpost. Today’s post is Machine Learning (ML) and TFJS 101, and contains info from Ch. 1 of Learning TensorFlow.js.

What is ML?

It’s magic, of course! Well, not actually, but sometimes it feels like it. It’s a branch of Artificial Intelligence (AI) that uses data and algorithms to perform tasks faster than humanly possible.

At the most basic, ML is a way to label and analyze huge data sets.

ML allows us to take the biggest ideas we can dream up and turn the fiction into reality. For me, when I first discovered ML, I saw the medical opportunities. I saw a potential world where I wouldn’t have gone through medical trauma because ML could have predicted that my organs were going to rupture. A world where I wouldn’t have to fight to be taken seriously because the data predicted what would happen and precautions would have been taken to ensure I would have the care I needed before the trauma happened.

How? Through image recognition.

What is TFJS?

TensorFlow.js is a JavaScript framework for AI concepts, a software we can use to create machine learning models for desktop, web, mobile, and cloud.

“TF.js had unleashed the unlimited potential for front-end developers to harness the power of machine learning such as object detection, face detection, image classification, and sentimental analysis without relying on a backend server.”

Python is usually the language associated with data science, but TensorFlow.js brings the technology to frontend developers.

What are the prerequisites for learning TFJS?

Required: suspension of disbelief. Good to have: An understanding of JavaScript or a frontend framework.

The approach we’re going to take might feel like magic, and it might feel like we’re learning differently than other approaches. We’re going to dive in, get our hands dirty before we understand some deep concepts. We’ll build on these concepts and learn the vocabulary we need to talk about what we’re working on.

Stick with it. Things will click. Remember, we’ll be training machines to recognize patterns and solve problems. And we’ll be having some fun along the way. I might not have the answers to all the questions, but I’ll make sure we find the answers together.

Top Terms

Training : Using data reviews to attempt to improve a ML algorithm for better predictions.

Training Set : The dataset we show the algorithm to learn from.

Test Set : To see if our model can perform as we expect it to, we use a test set that’s never been seen. Our model won’t learn or train from this set.

Validation Set : Complicated and Complex tests can take a long time or require an expensive infrastructure. To create a quicker test before jumping into those, a validation set can be run first.

Tensors : Numerical holders of data. They’re an optimized data structure for AI/ML calculations.

Common Applications

  • Recommendation engines (If you like this song, check out this other one!)
  • Visual classifiers and identifiers (Identify if this is a healthy organ or a damaged organ)
  • Creators (music, writing, art)


  • It has significant support as it’s created and maintained by Google.
  • It’s online ready and can be run in the browser.
  • You can run it offline.
  • It works with a variety of data, across ML domains and platforms

Other Resources to check out

If you’re interested in TFJS or ML, this livestream is for you. I’m learning along the way and if you have questions, I’ll make sure we find the answers together. It makes me feel better to think we’ll be learning together. So we’ll be part of the unofficial Gant Laborde, Learning TFJS cohort together. Sounds perfect for a t-shirt giveaway, right?

Top comments (0)