Machine Learning

Introduction

  • Machine learning is a tool of training of different kinds of model with different complexity. E.g: NLP , Computer vision, LLM

Type of Training (Strategies)

Supervised Learning

  • Trained with labelled data including input and expected output

  • Try to predict the next output

  • Mainly used for classifcation /prediction

Unsupervised Learning

  • Unlabelled data to feed to the model

  • Mainly used for clustering to separate data into dfferent groups and find out the relationship between them

Reinforcement Learning

  • Learn from user feedback and keep enhancing the policy to provide the more precise result

  • E.g: Recommendation system

Deep Learning (Framework)

  • In some of the case, it requires multiple factors for affecting the output. For example: Is pizza "good"? . The good definition can include multiple factors, E.g: pricing, branding, ingredients.

  • There is a overall score(weight) that decided whether it is "good" or not (the result), it is calculated by different nodes within the network

  • Each node is called neutron which is used for information processing

  • The more layer meaning the more complicated logic, the higher leaning curve to reproduce the output

Type of Network

1. Artificial Neural Networks (ANN)

Also called: Feedforward Networks or Multi-Layer Perceptrons (MLP).

This is the "Vanilla" version. It is the simplest architecture.

  • How it works: Information flows in one direction (Forward). It enters the input, goes through the hidden layers (math happens), and comes out the output. It has no memory of what happened 5 seconds ago.

  • Analogy: The Pizza Robot we discussed earlier. It looks at the ingredients right now and makes a decision.

  • Usage:

    • Simple Tabular Data: Predicting house prices based on square footage.

    • Simple Classification: Deciding if a loan applicant is "High Risk" or "Low Risk" based on their income numbers.

2. Convolutional Neural Networks (CNN)

The "Eyes" of AI.

This is the network designed specifically for Computer Vision.

  • Why ANNs fail here: An image has millions of pixels. A standard ANN gets overwhelmed by that much data.

  • How CNNs work: Instead of looking at every pixel at once, it uses a Filter (like a magnifying glass). It scans the image grid-by-grid to look for patterns (Lines -> Shapes -> Eyes -> Faces).

  • Analogy: Looking at a "Where's Waldo?" book. You scan your eyes across the page looking for specific patterns (red and white stripes).

  • Usage:

    • Face ID: Unlocking your iPhone.

    • Self-Driving Cars: Detecting lane lines and pedestrians.

    • Medical Imaging: Finding tumors in X-rays.

3. Recurrent Neural Networks (RNN) & Transformers

The "Memory" of AI.

These are the networks designed for Sequence Data (Text, Audio, Time).

  • Why ANNs fail here: Language depends on order.

    • Sentence A: "Dog bites Man."

    • Sentence B: "Man bites Dog."

    • These have the same words, but opposite meanings. A simple ANN can't tell the difference because it doesn't understand order.

A. The Old Way: RNN (Recurrent Neural Network)

  • How it works: It processes data one step at a time, but it has a "Feedback Loop." It remembers the word it just read and passes that memory to the next word.

  • The Flaw: They have short-term memory loss. By the time they finish a long paragraph, they forget the beginning.

B. The New Way: Transformers (The "T" in ChatGPT)

  • How it works: This is the architecture of LLMs. Instead of reading left-to-right, it reads the entire sentence at once. It uses a mechanism called "Self-Attention" to calculate how every word relates to every other word simultaneously.

  • Usage:

    • NLP: Translation (Google Translate), Chatbots (ChatGPT).

    • Speech: Siri/Alexa voice recognition.

    • Time Series: Predicting the Stock Market (looking at the history of prices to predict the future).

Deep learning & Strategies

  • Initially, the bot is stupid, each weight of factor are stupid and random, not be trustable

  • The strategies are to adjust the weight of node

  • The Supervised Adjustment: The Chef screams: "WRONG! This is labeled as 'BAD PIZZA'!"

    • The Logic: The framework calculates the Error (Difference between Robot's guess and the Chef's Label).

    • The Weight Change: The algorithm looks at the specific path that caused the error. It sees the "Pineapple" wire was active.

    • Action: It forcibly smashes the Pineapple Weight down immediately.

      • Old Weight: 0.5

      • New Weight: -2.0

    • Result: The robot learned instantly because the Chef told it exactly what the right answer was.

  • The Reinforcement Adjustment: The Robot eats the pizza. It tastes okay at first. One hour later, the Robot vomits.

    • The Signal: Negative Reward (-10 Points).

    • The Logic: The robot doesn't know exactly why it got sick. Was it the dough? The cheese? The pineapple?

      • It looks at what inputs were active recently. "Well, I ate Pineapple."

    • The Weight Change: It nudges the weight down slightly.

      • Old Weight: 0.5

      • New Weight: 0.4

    • The Loop: The robot has to eat 20 more pineapple pizzas and get sick 20 more times before the weight finally drops to -2.0.

Computer Vision

  • Similar with our eyes, used to identity the properties of image

  • The computer vision model is trained by CNN layer by layer, it can help us to identify the image by layers

Last updated