I'm studying Perceptron algorithm. Some books use this step function

1 if x>=0 else -1

where x is a dot product between the weights w and a sample x.

Other books use:

1 if x>=0 else 0

What are the practical differences between these step functions?


2 Answers 2


They have the same meaning in this context although during training using Rosenblatt update rule, the former may have great changes during each update. Perceptron is used for binary classification which means there are two possible classes to classify. If the result of inner product, here dot product, is greater than or equal to zero, the class of inputs will be the first class and if it's smaller than zero the class of inputs would be the other class. Perceptron just has one neuron. It's a simple linear classifier. The value of threshold is just important. Means that if the product is greater than zero, the input belongs to e.g. positive class and if is negative it belongs to negative class. The step functions and Rosenblatt update rule are not used any more. They have so much oscillation. Today networks learn using gradient descending algorithms which uses the concept of derivative.

When you progress, you will see that neural nets which use other activation functions like Sigmoid or Tanh are different. the former has 0.5 expected value and the latter has 0 expected value which causes the second learn so much faster. Although now a days ReLU is more popular among other activation functions.


I think that depends on how the next step in the algorithm is defined in the respective textbook(s). There might be slight differences.

Your if-statements can be interpreted as the following half-sentences,

"If there is a change in sign, [update the weights, if there isn't, do nothing"]


The second if statement reads:

"if the value is nonzero, [update the weights, otherwise do nothing.]"

Maybe your textbooks differ in how the parts between the [ ... ] are written.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.