Answer is Machine learning

Aman Jaglan
5 min readMay 29, 2024

--

Who started this ?
In the early 1950s, Alan Turing published a seminal paper titled “Computing Machinery and Intelligence,” where he posed the question, “Can machines think?” This was a groundbreaking idea that laid the foundation for the field of artificial intelligence. Then, in 1957, Frank Rosenblatt developed the perceptron, an early neural network model capable of binary classification. This marked the beginning of machine learning, or at least the idea that machines can think and be trained. As computational power has increased, ideas in this field have become reality. Today, we have advanced AI systems capable of answering questions in a matter of seconds.

What is Machine learning ?

Machine learning is a field of artificial intelligence (AI) that focuses on creating systems that can learn from data and improve their performance over time without being explicitly programmed. Imagine you have a computer that can teach itself to recognize patterns, make decisions, and predict outcomes based on past experiences. That’s the essence of machine learning.

Types of Machine learning

  • Supervised Learning: The machine is given labeled data (for example, pictures labeled as cats or dogs) and learns to predict the labels for new data.
  • Unsupervised Learning: The machine is given unlabeled data and tries to find patterns or groupings on its own (for example, clustering customers based on their buying habits).
  • Reinforcement Learning: The machine learns by making decisions and receiving feedback in the form of rewards or penalties (for example, learning to play a game by getting points for good moves).

Supervised Learning

The algorithm learns from the training data by finding patterns that map inputs to the correct outputs. Once trained, the algorithm can predict the output for new, unseen data.

1. Linear Regression

Linear regression predicts continuous outcomes by fitting a linear equation to the observed data. It models the relationship between a dependent variable and one or more independent variables.

Equation: y=β0+β1x1+β2x2+…+βnxn+ϵ

Training: Minimizes the sum of squared differences between observed and predicted values using the Ordinary Least Squares method.

Applications:

  • Predicting house prices.
  • Forecasting sales.

Example: Predicting house prices based on size and location.

2. Logistic Regression

Logistic regression is used for binary classification problems, predicting the probability that a given input belongs to a particular class.

Equation: Uses the sigmoid function: P(y=1∣x)=11+e−(β0+β1x1+…+βnxn)

Training: Maximizes the likelihood of observed data using Maximum Likelihood Estimation.

Applications:

  • Spam detection.
  • Disease diagnosis.

Example: Classifying whether an email is spam based on keywords.

3. Decision Trees

Decision trees model decisions and their possible consequences in a tree-like structure for classification and regression tasks.

Structure: Nodes (decisions), branches (outcomes), and leaves (final predictions).

Training: Splits data at each node based on the feature that provides the highest information gain or lowest Gini impurity.

Applications:

  • Customer segmentation.
  • Predicting patient outcomes.

Example: Predicting whether a customer will buy a product based on age and income.

4. Support Vector Machines (SVM)

SVMs are used for classification and regression tasks, finding the optimal hyperplane that separates classes in the feature space.

Hyperplane: Maximizes the margin between classes.

Kernel Trick: Transforms data into higher-dimensional spaces for non-linear problems.

Applications:

  • Image classification.
  • Bioinformatics.

Example: Classifying handwritten digits based on pixel intensity features.

5. Neural Networks

Overview: Neural networks, inspired by the human brain, are used for various tasks, including classification and regression.

Structure: Layers of interconnected nodes (neurons) with input, hidden, and output layers.

Training: Adjusts weights through back propagation, minimizing error using gradient descent.

Applications:

  • Image and speech recognition.
  • Natural language processing.

Example: Recognizing objects in images by learning complex patterns from pixel data.

Unsupervised learning

1. K-Means Clustering

K-Means Clustering is a popular algorithm for partitioning a dataset into distinct groups (clusters) based on feature similarities.

  • Initialization: Select k initial centroids randomly.
  • Assignment: Assign each data point to the nearest centroid.
  • Update: Recalculate the centroids as the mean of the assigned points.
  • Iteration: Repeat the assignment and update steps until convergence (centroids no longer change significantly).

Applications:

  • Market segmentation.
  • Image compression.

Example: Grouping customers based on purchasing behavior to tailor marketing strategies.

2. Hierarchical Clustering

Hierarchical Clustering builds a tree-like structure of nested clusters by either merging or splitting existing clusters.

  • Agglomerative (bottom-up): Start with each data point as its own cluster and iteratively merge the closest pairs of clusters until only one cluster remains.
  • Divisive (top-down): Start with all data points in one cluster and iteratively split the clusters until each data point is its own cluster.

Applications:

  • Document clustering.
  • Gene expression analysis.

Example: Creating a taxonomy of articles based on their content.

3. Principal Component Analysis (PCA)

PCA is a dimensionality reduction technique that transforms data into a new coordinate system, highlighting the directions (principal components) with the most variance.

  • Standardization: Standardize the data to have a mean of zero and a standard deviation of one.
  • Covariance Matrix: Compute the covariance matrix of the data.
  • Eigenvectors and Eigenvalues: Calculate the eigenvectors and eigenvalues of the covariance matrix.
  • Projection: Project the data onto the eigenvectors to form the principal components.

Applications:

  • Data visualization.
  • Noise reduction.

Example: Reducing the dimensionality of a dataset with many features for easier visualization and analysis.

Reinforcement Learning

1. Q-Learning

Q-Learning is a value-based algorithm used to find the optimal action-selection policy for any given finite Markov Decision Process (MDP).

How It Works:

  • Q-Table: Maintains a table Q(s,a) that estimates the value (expected future rewards) of taking action aa in state ss.
  • Update Rule: The Q-values are updated using the Bellman equation:
  • Q( s,a ) ← Q ( s,a ) + α[ r + γ max⁡ a′ Q(s′,a′)−Q(s,a) ]
  • α is the learning rate, γ is the discount factor, r is the reward, and s′ is the next state.

Applications:

  • Game playing.
  • Robotics.

Example: Training an agent to play a game like Tic-Tac-Toe by learning the value of different moves through trial and error.

2. Deep Q-Networks (DQN)

Deep Q-Networks combine Q-Learning with deep neural networks to handle high-dimensional state spaces, such as those found in video games.

  • Neural Network: Uses a neural network to approximate the Q-values instead of a Q-table.
  • Experience Replay: Stores past experiences (state, action, reward, next state) in a replay buffer and samples mini-batches to train the network, breaking the correlation between consecutive experiences.
  • Target Network: Maintains a separate target network to stabilize training, updated periodically with the weights of the main network.

Applications:

  • Video game AI.
  • Autonomous driving.

Example: Training an agent to play Atari games, where the state is the raw pixel input of the game screen.

3. Policy Gradient Methods

Policy Gradient Methods directly optimize the policy (the probability distribution over actions) to maximize the expected cumulative reward.

  • Policy Network: Uses a neural network to represent the policy π(a∣s).
  • Objective Function: The objective is to maximize the expected return J(θ)=E[∑trt], where θ are the parameters of the policy network.
  • Gradient Ascent: The policy network is updated using gradient ascent on the objective function, often using the REINFORCE algorithm:
  • θ←θ+α∇θJ(θ)

Applications:

  • Continuous control tasks.
  • Financial trading.

Example: Training a robotic arm to perform tasks like picking and placing objects by directly optimizing the sequence of movements.

There are many more algorithms in machine learning, but these are sufficient to tackle any type of problem.

--

--

Aman Jaglan
Aman Jaglan

Written by Aman Jaglan

I talk about finance, product, technology, and data science.

No responses yet