# system library
import numpy as np

# user-library
import RegressionBase


# third-party library
from sklearn import linear_model
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import mean_squared_error



class RegressionLinReg(RegressionBase.RegressionBase):
    def __init__(self, isTrain):
        super(RegressionLinReg, self).__init__(isTrain)
        # data preprocessing
        #self.dataPreprocessing()

        # Create linear regression object
        self.regr = linear_model.LinearRegression()

    def dataPreprocessing(self):
        # due to the observation, standization does not help the optimization.
        # So do not use it!
        #self.Standardization()
        pass

    def training(self):
        # train the linear regression model
        self.regr.fit(self.X_train, self.y_train)

    def predict(self):
        # predict the test data
        self.y_pred = self.regr.predict(self.X_test)

        # print MSE
        mse = mean_squared_error(self.y_pred, self.y_test)
        print "MSE: {}".format(mse)

# system library
import numpy as np

# user-library
import RegressionBase


# third-party library
from sklearn import linear_model
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import mean_squared_error



class RegressionLinReg(RegressionBase.RegressionBase):
    def __init__(self, isTrain):
        super(RegressionLinReg, self).__init__(isTrain)
        # data preprocessing
        #self.dataPreprocessing()

        # Create linear regression object
        self.regr = linear_model.LinearRegression()

    def dataPreprocessing(self):
        # due to the observation, standization does not help the optimization.
        # So do not use it!
        #self.Standardization()
        pass

    def training(self):
        # train the linear regression model
        self.regr.fit(self.X_train, self.y_train)

    def predict(self):
        # predict the test data
        self.y_pred = self.regr.predict(self.X_test)

        # print MSE
        mse = mean_squared_error(self.y_pred, self.y_test)
        print "MSE: {}".format(mse)

# system library # user-library # third-party library # data preprocessing #self.dataPreprocessing() # Create linear regression object # due to the observation, standization does not help the optimization. # So do not use it! #self.Standardization() # train the linear regression model # predict the test data # print MSE