Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
356 views
in Artificial Intelligence (AI) by (119k points)
What are the different types of machine learning?

Please log in or register to answer this question.

2 Answers

0 votes
by (119k points)

There are three main types of machine learning:

  1. Supervised Learning: In this type, the model is trained on labeled data, where the input data is paired with the corresponding output or target values. The model learns to generalize from this labeled data and can make predictions on unseen data. Example algorithms include linear regression, decision trees, and support vector machines.

  2. Unsupervised Learning: Here, the model is trained on unlabeled data, meaning there are no predefined target values. The goal is to find patterns, structures, or relationships in the data. Clustering and dimensionality reduction techniques, such as k-means clustering and principal component analysis (PCA), are commonly used in unsupervised learning.

  3. Reinforcement Learning: This type involves training an agent to interact with an environment and learn optimal actions based on feedback in the form of rewards or punishments. The agent learns through trial and error, exploring different actions and observing the consequences. Reinforcement learning is often used in robotics, game playing, and autonomous systems.

0 votes
by (119k points)

a. Supervised Learning: In this type, the model learns from labeled training data, where each example has input features and corresponding target labels. Example code (Python - using scikit-learn library):

from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression

# Load the dataset
boston = datasets.load_boston()
X = boston.data
y = boston.target

# Split data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create and train the model
model = LinearRegression()
model.fit(X_train, y_train)

# Make predictions
y_pred = model.predict(X_test)
 

b. Unsupervised Learning: In this type, the model learns patterns and relationships in unlabeled data, without any predefined target labels. Example code (Python - using scikit-learn library):

from sklearn.cluster import KMeans
from sklearn import datasets

# Load the dataset
iris = datasets.load_iris()
X = iris.data

# Create and train the model
model = KMeans(n_clusters=3)
model.fit(X)

# Get cluster labels
labels = model.labels_
 

c. Reinforcement Learning: In this type, an agent learns to interact with an environment and make decisions to maximize rewards or minimize penalties. Example code (Python - using OpenAI Gym library):

import gym

# Create the environment
env = gym.make('CartPole-v1')

# Define agent's behavior
def policy(observation):
    # Implement your policy here
    # Example: move left if the pole is leaning left, move right otherwise
    if observation[2] < 0:
        action = 0  # move left
    else:
        action = 1  # move right
    return action

# Run the agent in the environment
observation = env.reset()
done = False
while not done:
    action = policy(observation)
    observation, reward, done, info = env.step(action)
 

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...