added weight update to calculate error, to be changed when batchmode is used later