def compute_error(self, row):
        vals = row[:-1] # The dependent variables from the row
        y    = row[-1]  # The independent variable is the last item in the row

        # Compute the predicted value based on the linear model
        yhat = sum([b*x for (b,x) in zip(self.coef, vals)]) + self.intercept

        # Compute the square error of the prediction
        return (y - yhat) ** 2
dataset/ETHPy150Open bbengfort/hadoop-fundamentals/blog_regression/mapper.py/MSEMapper.compute_error/original