Skip to main content
added 4 characters in body
Source Link
Siong Thye Goh
  • 3.1k
  • 2
  • 17
  • 23

My question is very basic. I am starting with ML and am working on the perceptron algorithm. I successfully computed the weights for this input data:

X = [[0.8, 0.1], [0.7, 0.2], [0.9, 0.3], [0.3, 0.8], [0.1, 0.7], [0.1, 0.9]]
Y = [-1, -1, -1, 1, 1, 1]

Output_weights = [-0.7, 0.5]

But I didn't take bias into account, i.e. I assumed the discriminator line goes through the origin. Now, let's say I add another point into my training set:

new_X = [4,4]
new_Y = [-1]

How do I proceed if I want to compute the bias as well? In the first iteration for example, I'd set default weights to [0,0]$[0,0]$, so I find the first point that is incorrectly classified.

Without bias, it is easy. I compute the dot product

0.8*0 + 0.1*0 = 0

should be -1$-1$, so it is incorrectly classified. I update the weights to:

[-0.8,-0.1]

However, taking bias into account, I get:

0.8*0 + 0.1*0 + bias 

Now, how do I update the weights and the bias? What is the procedure?

I have searched several tutorials like this or this but didn't find an answer. A link to some resource would help, too.

My question is very basic. I am starting with ML and am working on the perceptron algorithm. I successfully computed the weights for this input data:

X = [[0.8, 0.1], [0.7, 0.2], [0.9, 0.3], [0.3, 0.8], [0.1, 0.7], [0.1, 0.9]]
Y = [-1, -1, -1, 1, 1, 1]

Output_weights = [-0.7, 0.5]

But I didn't take bias into account, i.e. I assumed the discriminator line goes through the origin. Now, let's say I add another point into my training set:

new_X = [4,4]
new_Y = [-1]

How do I proceed if I want to compute the bias as well? In the first iteration for example, I'd set default weights to [0,0], so I find the first point that is incorrectly classified.

Without bias, it is easy. I compute the dot product

0.8*0 + 0.1*0 = 0

should be -1, so it is incorrectly classified. I update the weights to:

[-0.8,-0.1]

However, taking bias into account, I get:

0.8*0 + 0.1*0 + bias 

Now, how do I update the weights and the bias? What is the procedure?

I have searched several tutorials like this or this but didn't find an answer. A link to some resource would help, too.

My question is very basic. I am starting with ML and am working on the perceptron algorithm. I successfully computed the weights for this input data:

X = [[0.8, 0.1], [0.7, 0.2], [0.9, 0.3], [0.3, 0.8], [0.1, 0.7], [0.1, 0.9]]
Y = [-1, -1, -1, 1, 1, 1]

Output_weights = [-0.7, 0.5]

But I didn't take bias into account, i.e. I assumed the discriminator line goes through the origin. Now, let's say I add another point into my training set:

new_X = [4,4]
new_Y = [-1]

How do I proceed if I want to compute the bias as well? In the first iteration for example, I'd set default weights to $[0,0]$, so I find the first point that is incorrectly classified.

Without bias, it is easy. I compute the dot product

0.8*0 + 0.1*0 = 0

should be $-1$, so it is incorrectly classified. I update the weights to:

[-0.8,-0.1]

However, taking bias into account, I get:

0.8*0 + 0.1*0 + bias 

Now, how do I update the weights and the bias? What is the procedure?

I have searched several tutorials like this or this but didn't find an answer. A link to some resource would help, too.

Source Link
Jan Pisl
  • 205
  • 3
  • 13

How to find bias for perceptron algorithm?

My question is very basic. I am starting with ML and am working on the perceptron algorithm. I successfully computed the weights for this input data:

X = [[0.8, 0.1], [0.7, 0.2], [0.9, 0.3], [0.3, 0.8], [0.1, 0.7], [0.1, 0.9]]
Y = [-1, -1, -1, 1, 1, 1]

Output_weights = [-0.7, 0.5]

But I didn't take bias into account, i.e. I assumed the discriminator line goes through the origin. Now, let's say I add another point into my training set:

new_X = [4,4]
new_Y = [-1]

How do I proceed if I want to compute the bias as well? In the first iteration for example, I'd set default weights to [0,0], so I find the first point that is incorrectly classified.

Without bias, it is easy. I compute the dot product

0.8*0 + 0.1*0 = 0

should be -1, so it is incorrectly classified. I update the weights to:

[-0.8,-0.1]

However, taking bias into account, I get:

0.8*0 + 0.1*0 + bias 

Now, how do I update the weights and the bias? What is the procedure?

I have searched several tutorials like this or this but didn't find an answer. A link to some resource would help, too.