July 2018
Intermediate to advanced
474 pages
13h 37m
English
The ability to test the final values of the weights and bias is now available to compute how well the cost function worked to compute a predicted and how it compared to the actual score.
The following script will create a loop through each individual and calculate a predicted gender score based on the weights (w1, w2) and the bias (b):
for i in range(len(data_array)): random_individual = data_array[i] height = random_individual[0] weight = random_individual[1] z = height*w1 + weight*w2 + b predictedGender=sigmoid(z) print("Individual #{} actual score: {} predicted score: {}".format(i+1,random_individual[2],predictedGender))
The output of the script can be seen in the following screenshot:
All 29 of the actual scores approximately ...
Read now
Unlock full access