def train(self, data): self.ind = len(data[0][0]) x_arrays = [] for idx in range(self.ind): x_arrays.append( scipy.array(misc.get_col(misc.get_col(data, 0), idx)) ) y_array = scipy.array(misc.get_col(data, 1)) v, success = scipy.optimize.leastsq( self.error, self.initial, args=tuple(x_arrays + [y_array]), warning = False, maxfev = 25 ) #print 'success?', success #print 'v=', v self.opt = v
def train(self, data): self.__data__ = copy.deepcopy(data) self.yhats = misc.get_col(self.__data__, 1) for i in range(self.iterations): self.__smooth__()