def test_regression_linear(self):
        # synthetic linear regression
        rega = RidgeRegression()
        filename = os.path.join(pyvision.__path__[0],'data','synthetic','regression.dat')
        reg_file = open(filename,'r')
        labels = []
        vectors = []
        for line in reg_file:
            datapoint = line.split()
            labels.append(float(datapoint[0]))
            vectors.append([float(datapoint[3]),float(datapoint[4]),float(datapoint[5])])

        for i in range(50):
            rega.addTraining(labels[i],vectors[i])
        rega.train()

        mse = 0.0
        table = Table()
        for i in range(50,len(labels)):
            p = rega.predict(vectors[i])
            e = p / labels[i]
            table.setElement(i,'truth',labels[i])
            table.setElement(i,'pred',p)
            table.setElement(i,'Residual',e)
            #print labels[i],p,e
            mse += e*e
            
        #print table
        #table.save('../../tmp.csv')
        
        mse = mse/(len(labels)-50)
        self.assertAlmostEqual(mse,0.24301122718491874,places=4)
dataset/ETHPy150Open bolme/pyvision/src/pyvision/vector/RidgeRegression.py/_TestKRR.test_regression_linear/operator `-` -> `/`