loads input data size once to prevent repreated dic lookups
vectorized calculation of mean squared error