Docsity

Python basics for beginners, Study notes of Law

Toggle sidebar
bg1
Types of Machine Learning Algorithms
1.Supervised Learning
2.Unsupervised Learning
3.Semisupervised Learning
4.Reinforcement Learning
1.Supervised Learning
Supervised Machine Learning is a type of learning where the machine learns from labeled data. Think of
it like a student learning from a teacher who provides both the questions (inputs) and the correct answers
(outputs).
How It Works:
1.Learning from Past Data:
The algorithm is trained on labeled examples, where both the input and output are provided.
The machine learns the relationship between the inputs (X) and the outputs (Y).
Example: If we have a basket of fruits with labels (apple, banana, orange), the machine learns to
associate features (like color, shape, size) of fruits with their labels.
2.Mapping Function (Y = f(X)):
The relationship between input (X) and output (Y) can be expressed as a function, like Y = f(X),
where the machine learns to map inputs to outputs.
After learning from the data, it can predict the output for new, unseen data.
Example: If the input is a fruit with color = red, shape = round, the model predicts that it’s an
apple
Example
Imagine you have a basket filled with apples, bananas, and oranges.
You want to teach a machine to identify them based on certain features like color, size, and shape. 1.
Step 1: Train the model using labeled data.
oInput: Fruit features (e.g., color, shape, size).
oOutput: Correct labels (apple, banana, orange).
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Python basics for beginners and more Study notes Law in PDF only on Docsity!

Types of Machine Learning Algorithms 1.Supervised Learning 2.Unsupervised Learning 3.Semisupervised Learning 4.Reinforcement Learning 1.Supervised Learning Supervised Machine Learning is a type of learning where the machine learns from labeled data. Think of it like a student learning from a teacher who provides both the questions (inputs) and the correct answers (outputs). How It Works: 1.Learning from Past Data:  The algorithm is trained on labeled examples, where both the input and output are provided.  The machine learns the relationship between the inputs (X) and the outputs (Y).  Example: If we have a basket of fruits with labels (apple, banana, orange), the machine learns to associate features (like color, shape, size) of fruits with their labels. 2.Mapping Function (Y = f(X)):  The relationship between input (X) and output (Y) can be expressed as a function, like Y = f(X), where the machine learns to map inputs to outputs.  After learning from the data, it can predict the output for new, unseen data.  Example: If the input is a fruit with color = red, shape = round, the model predicts that it’s an apple Example Imagine you have a basket filled with apples, bananas, and oranges. You want to teach a machine to identify them based on certain features like color, size, and shape. 1.  Step 1: Train the model using labeled data. o Input: Fruit features (e.g., color, shape, size). o Output: Correct labels (apple, banana, orange).

 Step 2: The machine learns to map the input features to the correct fruit labels (mapping function: Y = f(X)).  Step 3: Now, if you give the machine a fruit with unknown features (e.g., color = yellow, shape = elongated), it will predict that it’s a banana. 2.Unsupervised Learning Unsupervised Learning is a type of machine learning where the model is trained using data that is neither labeled nor classified. This means the machine doesn’t have any predefined answers to learn from and must discover patterns or relationships in the data on its own. How Unsupervised Learning Works:1.No Labeled Data: o In unsupervised learning, there is no guidance or labels provided to the machine. It only has the data and must find patterns or groupings within it. o Example: If we give the machine images of fruits (like mangoes and oranges) without labels, it doesn't know what a mango or orange is. It must figure out how to group the fruits based on similarities like color, shape, or texture.  2.Finding Patterns and Grouping: o The machine looks for patterns, similarities, and differences in the data and creates groups or clusters. o Example: The machine might notice that all mangoes are yellow and oranges are orange, so it will group the images into two clusters based on color and shape.  3.Clustering: o Unsupervised learning works by creating clusters where similar data points are grouped together. o Example: If the machine is given a dataset of fruits, it could automatically create two clusters one for mangoes and one for oranges without knowing what these fruits are called. 3.Semisupervised Learning Semi-Supervised Learning is a type of machine learning that combines the strengths of supervised and unsupervised learning. It uses both labeled data (data with known answers) and unlabeled data (data

3.Trial and Error:  The agent starts with no knowledge and learns by trying different actions, observing the results, and adjusting its strategy.  Over time, the agent learns which actions lead to the highest rewards and which actions lead to penalties. Key Features of Reinforcement Learning: 1.Input (State):  The initial state from which the agent begins its learning.  Example: In the game, the starting point of the robot is the initial state. 2.Output (Action):  The action the agent can take in response to the current state.  Example: The robot can choose to move forward, turn left, or turn right based on the environment. 3.Training Process (Learning from Experience):  The agent learns by interacting with the environment and getting feedback.  It keeps adjusting its actions based on whether it receives a reward or penalty.  Example: If the robot’s action leads to a reward, it will try to repeat that action next time; if it leads to a penalty, it will try to avoid it. 4.Maximizing Reward:  The agent’s goal is to maximize its total reward over time, finding the best path to reach the final goal.  Example: The robot tries to find the best path to reach the diamond with the least number of hurdles (fires). Example: Reinforcement Learning in a Game Scenario:  A robot needs to reach a diamond (reward) while avoiding fires (penalties) in a game.  The robot starts at a random point and tries different paths.

 Right path = Reward (diamond), Wrong path = Penalty (fire).  The robot learns over time by repeating the process and adjusting its behavior to maximize rewards and avoid penalties.  Final Goal: The robot learns the best path to take in the game and successfully reaches the diamond, maximizing its total reward. Techniques in AI 1.Neural Networks 2.Machine learning 3.Deep learning 4.Natural language processing 5.Computer vision 6.Cognitive Computing 1.Neural Networks:

Machine Learning (ML) is a field of computer science that focuses on teaching machines to learn from data and make decisions on their own, without needing human instructions How Machine Learning Works: 1.Learning from Data:  ML algorithms analyze large sets of data to find patterns.  For example, an ML algorithm might look at thousands of images of cats and dogs, and learn to recognize the differences between them. 2.No Human Instructions Needed:  Instead of writing step-by-step rules for the machine, ML learns automatically from the data.  Example: If you want the machine to recognize a cat, you don’t need to tell it exactly what a cat looks like. Instead, you feed it data of cats and dogs, and the machine learns from the examples. 3.Improvement Over Time:  The machine improves by analyzing its errors and correcting them automatically.  Example: If it wrongly identifies a dog as a cat, it adjusts and tries again, getting better each time. 4.Making Better Decisions:  ML saves time and effort because it automates decision-making.  It can analyze data and make decisions more accurately than humans.  Example: In healthcare, ML can analyze medical data and predict diseases faster than doctors. 3.Deep learning Deep Learning (DL) is a powerful technique within Machine Learning (ML) that uses neural networks with many layers to process and learn from data. It is especially good at handling complex patterns in large datasets. How Deep Learning Works:

1.Neural Networks with Layers:  In Deep Learning, a neural network has multiple layers of processing units (also called nodes or neurons).  Each layer processes the data, learns patterns, and passes the results to the next layer.  Example: In image recognition, the first layer might detect edges, the next layer might recognize shapes, and further layers might identify objects

  1. Forward Propagation:  As the data moves through each layer, it gets processed and refined until it reaches the output layer.  This is called forward propagation, where the input data is passed through the network and results in the final output.  Example: In an image recognition task, forward propagation will take raw pixel data, process it layer by layer, and finally output a classification like "cat" or "dog."
  2. Backward Propagation:  Once the output is generated, the model checks if the result is accurate by calculating the error (the difference between predicted and actual results).  If the result is wrong, the weights (importance) of the nodes are updated and the error is sent back through the network to adjust the weights. This is called backward propagation.  Example: If the model misclassifies an image, backward propagation helps the model adjust its calculations to avoid the same mistake next time. 4.Training the Model:  The model learns from both the forward and backward propagation processes by adjusting weights, improving its accuracy with every iteration.  Example: Over time, with enough data, the model gets better at recognizing images or predicting outcomes Applications of Deep Learning:  Image Recognition  Speech Recognition 4.Natural language processing

 Example: In an image of a cat, computer vision might break it down into features like the shape of the ears, eyes, and whiskers. 2.Classifying and Learning:  The machine then uses patterns from many images to learn and classify objects (e.g., identifying a cat in an image).  Example: After processing many images of cats, the machine learns to identify common features like pointy ears and a small nose. 3.Making Decisions:  Based on what the machine has learned from past observations, it makes decisions about the current image or video it sees.  Example: If the machine sees a new image of a cat, it can correctly identify it by matching the features to what it has learned. Applications of Computer Vision:  Facial Recognition  Autonomous Vehicles  Retail Stores  Medicine  Financial Institutions 6.Cognitive Computing Cognitive Computing is a subfield of Artificial Intelligence (AI) designed to make machines think and respond in a human-like way. It mimics the way the human brain works by analyzing text, speech, images, or objects to understand and interact with the world. Applications of Cognitive Computing:  Virtual Assistants  Healthcare  Customer Service  Education