-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (31 loc) · 1011 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import numpy as np
import math
import matplotlib.pyplot as plt
def weightFunc(inputVal, weight):
return inputVal * weight
def computeNeuronOutput(inputs, inputWeigts):
print(inputs, len(inputs))
print(inputWeigts, len(inputWeigts))
if len(inputs) != len(inputWeigts):
raise ValueError("Arrays must have the same size")
result = 0
for index, inputVal in enumerate(inputs):
result += weightFunc(inputVal, inputWeigts[index])
result /= len(inputs)
return result
def main(argv=None):
output = computeNeuronOutput([1] * 20, [2] * 20)
print(output)
m = 5
epochs = 0
cost_history = []
cost_history.extend( range(1, 20) )
"""plt.plot(cost_history)
plt.title("The logistic regression cross-entropy cost function"
+ " value, \n"
+ str(m) + " examples, " + str(epochs) + " epochs.")
plt.xlabel("Epoch");
plt.ylabel("J(epoch)");
plt.show()"""
if __name__ == "__main__":
main()