VOOZH about

URL: https://www.analyticsvidhya.com/blog/2018/04/tensorflow-js-build-machine-learning-models-javascript/

⇱ TensorFlow.js - Now Build Machine Learning Models in JavaScript!


India's Most Futuristic AI Conference Is Back – Bigger, Sharper, Bolder

  • d
  • :
  • h
  • :
  • m
  • :
  • s

TensorFlow.js – Now Build Machine Learning Models in JavaScript!

Pranav Dar Last Updated : 02 Apr, 2018
2 min read

Overview

  • TensorFlow.js is an open source library that lets you build and train ML models in your browser
  • It’s available with GPU acceleration and also automaticlaly supports WebGL
  • You can import existing pre-trained models and also re-train entire existing ML models in the browser itself

Introduction

If you’re a JavaScript developers who’s new to the world of Machine Learning, or a Machine Learning practitioner who’s new to JavaScript, this latest release of TensorFlow will intrigue you.

TensorFlow.js is an open-source library that you can use to train and build machine learning models in your web browser, using JavaScript and APIs. If you’re familiar with Keras, the high level layers API will seem very familiar to you.

👁 Image

You might be wondering at this point what’s the advantage here of using a browser to build ML models.

Well, running a ML program in your browser means there is need to install any libraries or drivers! Open your browser page and you’re ready to build your model. It’s also available with GPU acceleration. Additionally, TensorFlow.js supports WebGL, a JavaScript API that is used for rendering 2D and 3D graphics within any browser.

You can also open the webpage on your mobile or tablet which will enable your model to take advantage of sensor data.

You can import an existing pre-trained model and TensorFlow.js converters will make it browser ready for you. You can also re-train existing ML models using “transfer learning to augment an existing model trained offline using a small amount of data collected in the browser using a technique called Image Retraining”. You can re-train the model very quickly and efficiently with this while only requiring a small amount of data.

How do I install TensorFlow.js?

It’s pretty straightforward. You can use it by installing in from NPM:

yarn add @tensorflow/tfjs
npm install @tensorflow/tfjs
Or from script:
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>

Check out the TensorFlow.js website and their GitHub page to read more about this release.

Our take on this

This is awesome news for folks who are familiar with JavaScript and are trying to carve their way in the ML world! It makes things a lot simpler for folks coming from a non-ML background who are looking to understand this field. The use cases for this are plenty. I highly encourage you to check out the demos on the official site which include a real-time performance on a piano by a neural network and playing the popular Pac-Man game using images trained in a browser.

TensorFlow.js is basically the successor of deeplearn.js. The major difference between the two is the TensorFlow.js includes a layers API and imports pre-trained models and can also re-train them. Also, you can work on almost any GPU but it will not be close to the speed you’ll get on CUDA.

Are you planning to use this for building your models? What do you think about this latest TensorFlow release? Let us know in the comments section below!

Subscribe to AVBytes here to get regular data science, machine learning and AI updates in your inbox!

Senior Editor at Analytics Vidhya.Data visualization practitioner who loves reading and delving deeper into the data science and machine learning arts. Always looking for new ways to improve processes using ML and AI.

Login to continue reading and enjoy expert-curated content.

Free Courses

Generative AI - A Way of Life

Explore Generative AI for beginners: create text and images, use top AI tools, learn practical skills, and ethics.

Getting Started with Large Language Models

Master Large Language Models (LLMs) with this course, offering clear guidance in NLP and model training made simple.

Building LLM Applications using Prompt Engineering

This free course guides you on building LLM apps, mastering prompt engineering, and developing chatbots with enterprise data.

Improving Real World RAG Systems: Key Challenges & Practical Solutions

Explore practical solutions, advanced retrieval strategies, and agentic RAG systems to improve context, relevance, and accuracy in AI-driven applications.

Microsoft Excel: Formulas & Functions

Master MS Excel for data analysis with key formulas, functions, and LookUp tools in this comprehensive course.

Responses From Readers

The detectorist

Hi, I am looking for an eample of an implementation of a time series inside a tensorflow.js. I am able to create tensor1d, 2d, 3d... but I don't know how to add time series into a tensor. Can you please write an example on your blog if you have expertise?

Sankirtan

Does tensorflow JS allows us to make models using CSV files?

123 1
Pranav Dar

Hi Sankirtan, Yes you should be able to use CSV files. Are you facing any error while doing this?

123 456

Flagship Programs

GenAI Pinnacle Program| GenAI Pinnacle Plus Program| AI/ML BlackBelt Program| Agentic AI Pioneer Program

Free Courses

Generative AI| DeepSeek| OpenAI Agent SDK| LLM Applications using Prompt Engineering| DeepSeek from Scratch| Stability.AI| SSM & MAMBA| RAG Systems using LlamaIndex| Building LLMs for Code| Python| Microsoft Excel| Machine Learning| Deep Learning| Mastering Multimodal RAG| Introduction to Transformer Model| Bagging & Boosting| Loan Prediction| Time Series Forecasting| Tableau| Business Analytics| Vibe Coding in Windsurf| Model Deployment using FastAPI| Building Data Analyst AI Agent| Getting started with OpenAI o3-mini| Introduction to Transformers and Attention Mechanisms

Popular Categories

AI Agents| Generative AI| Prompt Engineering| Generative AI Application| News| Technical Guides| AI Tools| Interview Preparation| Research Papers| Success Stories| Quiz| Use Cases| Listicles

Generative AI Tools and Techniques

GANs| VAEs| Transformers| StyleGAN| Pix2Pix| Autoencoders| GPT| BERT| Word2Vec| LSTM| Attention Mechanisms| Diffusion Models| LLMs| SLMs| Encoder Decoder Models| Prompt Engineering| LangChain| LlamaIndex| RAG| Fine-tuning| LangChain AI Agent| Multimodal Models| RNNs| DCGAN| ProGAN| Text-to-Image Models| DDPM| Document Question Answering| Imagen| T5 (Text-to-Text Transfer Transformer)| Seq2seq Models| WaveNet| Attention Is All You Need (Transformer Architecture) | WindSurf| Cursor

Popular GenAI Models

Llama 4| Llama 3.1| GPT 4.5| GPT 4.1| GPT 4o| o3-mini| Sora| DeepSeek R1| DeepSeek V3| Janus Pro| Veo 2| Gemini 2.5 Pro| Gemini 2.0| Gemma 3| Claude Sonnet 3.7| Claude 3.5 Sonnet| Phi 4| Phi 3.5| Mistral Small 3.1| Mistral NeMo| Mistral-7b| Bedrock| Vertex AI| Qwen QwQ 32B| Qwen 2| Qwen 2.5 VL| Qwen Chat| Grok 3

AI Development Frameworks

n8n| LangChain| Agent SDK| A2A by Google| SmolAgents| LangGraph| CrewAI| Agno| LangFlow| AutoGen| LlamaIndex| Swarm| AutoGPT

Data Science Tools and Techniques

Python| R| SQL| Jupyter Notebooks| TensorFlow| Scikit-learn| PyTorch| Tableau| Apache Spark| Matplotlib| Seaborn| Pandas| Hadoop| Docker| Git| Keras| Apache Kafka| AWS| NLP| Random Forest| Computer Vision| Data Visualization| Data Exploration| Big Data| Common Machine Learning Algorithms| Machine Learning| Google Data Science Agent
👁 Av Logo White

Continue your learning for FREE

Forgot your password?
👁 Av Logo White

Enter OTP sent to

Edit

Wrong OTP.

Enter the OTP

Resend OTP

Resend OTP in 45s

👁 Popup Banner
👁 AI Popup Banner