Working nmf code and new function to calculate reconstruction error