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
81 views
in Artificial Intelligence (AI) by (112k points)
What are Perceptrons in ML?

Please log in or register to answer this question.

1 Answer

0 votes
by (112k points)

Perceptrons are the building blocks of artificial neural networks. They are the simplest form of a neural network, consisting of a single artificial neuron or node. A perceptron takes multiple inputs, each multiplied by a corresponding weight, and passes the weighted sum through an activation function. The output of the perceptron is a binary value (0 or 1) based on whether the summed value exceeds a certain threshold.

Example code for a perceptron in Python:

import numpy as np

class Perceptron:
    def __init__(self, num_inputs, learning_rate=0.1):
        self.weights = np.zeros(num_inputs)
        self.bias = 0
        self.learning_rate = learning_rate

    def predict(self, inputs):
        weighted_sum = np.dot(inputs, self.weights) + self.bias
        return 1 if weighted_sum > 0 else 0

    def train(self, training_inputs, labels, num_epochs):
        for _ in range(num_epochs):
            for inputs, label in zip(training_inputs, labels):
                prediction = self.predict(inputs)
                update = self.learning_rate * (label - prediction)
                self.weights += update * inputs
                self.bias += update
 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 4, 2023 in Artificial Intelligence (AI) by kvdevika (112k points)
0 votes
1 answer

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

...