Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Machine Learning) ''' program perceptron with one output ''' import numpy as np class perceptron: def __init__(self, inputs): self.n_data = np.shape(inputs)[1] self.n_out = 1 self.weights

(Machine Learning)

''' program perceptron with one output ''' import numpy as np class perceptron: def __init__(self, inputs): self.n_data = np.shape(inputs)[1] self.n_out = 1 self.weights = np.random.rand(self.n_data + 1, self.n_out) * 0.1 - 0.05 ''' def ptron_train(): for data in range(n_data): # compute w dot x and apply activation. M is the number of features # for OR or XOR, it will be 2 activation[data] = 0 for m in range(M + 1): ''' if __name__ == '__main__': # OR gate data_or = np.array([[0,0,0], [0,1,1], [1,0,1], [1,1,1]]) print(data_or) print(np.shape(data_or)[0]) ptron_or = perceptron(data_or) print(ptron_or.weights)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

define what is meant by the term human resource management

Answered: 1 week ago