🎁 The Js-Craft Guide to React is now available with a 30% off discount!

Machine Learning vs Classic Programming

Some while ago I've tried to give a short explanation of what machine learning is, from the perspective of a Javascript developer.

Meanwhile, I've discovered this video below which gives such great insight into machine learning vs the standard way of programming:

It's going into more details, but the main idea for me was that a classic way of programming is to write a function that gets some input and calculates an output, while machine learning works by knowing multiple inputs and outputs, and based on that it can deduct the actual function behavior.

So let's say I need to write a Javascript program that computes the square of a number.

In a classic programming approach, we will first write the function:

const f = (x) => x*x

And later user it:

const value = readValueFromKeyboard()
const result = f(value)

javascript Machine Learning compared with Classic Programming

While in a machine learning approach we will do something like this:

const inputs = [1, 2, 3, 4 /* more values here */]
const outputs = [1, 4, 9, 16 /* more values here */]
const f = trainModel(inputs, outputs)

And when the model is ready use can use it as before:

const value = readValueFromKeyboard()
const result = f(value)

javascript Machine Learning compared with Classic Programming

They should be used together as both the classic programming and the machine learning approaches have their own class of problems to which they should be applied.

10 Javascript AI projects with Langchain & React

Not sure what to build? Dive in with these Javascript AI projects! Learn how to build LLM powered apps using Langchain.js and React! Connect your apps to LLMs such as OpenAI, create agents, use vector databases, or setup AI context.

10 Javascript AI projects with Langchain & React

Not sure what to build? Dive in with these Javascript AI projects! Learn how to build LLM powered apps using Langchain.js and React! Connect your apps to LLMs such as OpenAI, create agents, use vector databases, or setup AI context.


Leave a Reply

Your email address will not be published. Required fields are marked *

📘 The Guide to React Home Screencasts Best of Newsletter Search X

📘 - 10 Javascript AI projects with React and LangChain

Hi friend! Before you go, just wanted to let you know about the 10 Javascript AI projects ideas with React and LangChain FREE ebook.

One of the best ways to learn is by doing the work. Choose from these 10 project ideas and start working on topics such as:

  • How does LangChain work
  • Connecting to OpenAI LLM
  • Create AI Agents
  • Simple and Sequential Chains
  • Adding Memory (Chat Context)
  • Prompt Templates
  • Using OutputParsers and Tools for Agents
  • Work with Documents and more...

Keep building and see the new capabilities LLM models can add to your React app! Get all projects as an ebook right to your inbox!

X