Ejemplo n.º 1
0
    def calculate_x_y(self):
        try:
            variables = np.load('Games/' + 'MLRxy.npz')
            self.x = variables['arr_0']  # init
            self.y = variables['arr_1']
            self.x_max = self.x.max(axis=0)
            self.x_min = self.x.min(axis=0)
        except:
            obj = MLR()
            obj.Extract()  # bring the independent variables (X)
            obj.Y()  # bring in the dependent variable (y)
            #total_attr = 13 # add all the 2nd dimensions of each attributes
            obj.X()  # combine all the independent variables to one
            self.x = obj.x  # init
            self.y = obj.y  # init
            self.x_max = self.x.max(axis=0)
            self.x_min = self.x.min(axis=0)

            obj.save()

        temp = np.ones(shape=(40, 1))
        self.x = np.concatenate(
            (self.x, temp), axis=1
        )  # 40 by 13+1 where last column has all value as ones... to obtain a constant-beta value

        return