-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# pylint: disable=missing-docstring | ||
|
||
import numpy | ||
|
||
def step_function(x): # pylint: disable=invalid-name | ||
return 1 if x >= 0 else 0 | ||
|
||
def perceptron_output(weights, bias, x): | ||
"""returns 1 if the perceptron 'fires', 0 if not""" | ||
calculation = numpy.dot(weights, x) + bias | ||
return step_function(calculation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters