""" completely connected layer""def __init__(selfnnnum_outputslimit=none)""" completely connected linear layer nn is neural network that the inputs come from num_outputs is the number of outputs the random initialization of parameters is in range [-limit,limit""layer __init__(selfnnnum_outputsif limit is nonelimit =math sqrt( /(self num_inputs+self num_outputs)self weights[ ][iis the weight between input and output self weights [[random uniform(-limitlimitif inf self num_inputs else for inf in range(self num_inputs+ )for outf in range(self num_outputs)self delta [[ for inf in range(self num_inputs+ )for outf in range(self num_outputs) def output_values(self,input_valuestraining=false)"""returns the outputs for the input values it remembers the values for the backprop note in self weights there is weight list for every outputso wts in self weights loops over the outputs the bias is the *lastvalue of each list in self weights ""self inputs input_values [ return [sum( *val for ( ,valin zip(wts,self inputs)for wts in self weights def backprop(self,errors)"""backpropagate the errorsupdating the weights and returning the error in its inputs ""input_errors [ ]*(self num_inputs+ for out in range(self num_outputs)for inp in range(self num_inputs+ )input_errors[inp+self weights[out][inperrors[outself delta[out][inp+self inputs[inperrors[outreturn input_errors[:- remove the error for the " def update(self)"""updates parameters after batch""batch_step_size self nn learning_rate self nn batch_size for out in range(self num_outputs)for inp in range(self num_inputs+ )self weights[out][inp-batch_step_size self delta[out][inpself delta[out][inp the standard activation function for hidden nodes is the relu version june