def fit(self, X, y):
    coef = [0.2, 0.4, 0.6, 0.8]
    golden1 = 0.618
    golden2 = (1 - golden1)
    ab_start = [(0.01, 0.3), (0.15, 0.56), (0.35, 0.75), (0.6, 0.9)]
    for it1 in range(10):
        for idx in range(4):
            (a, b) = ab_start[idx]
            coef[idx] = a
            la = self._loss(coef, X, y, idx)
            coef[idx] = b
            lb = self._loss(coef, X, y, idx)
            for it in range(20):
                if (la > lb):
                    a = (b - ((b - a) * golden1))
                    coef[idx] = a
                    la = self._loss(coef, X, y, idx)
                else:
                    b = (b - ((b - a) * golden2))
                    coef[idx] = b
                    lb = self._loss(coef, X, y, idx)
    self.coef_ = {'x': coef}
def fit(self, X, y):
    coef = [0.2, 0.4, 0.6, 0.8]
    golden1 = 0.618
    golden2 = (1 - golden1)
    ab_start = [(0.01, 0.3), (0.15, 0.56), (0.35, 0.75), (0.6, 0.9)]
    for it1 in range(10):
        for idx in range(4):
            (a, b) = ab_start[idx]
            coef[idx] = a
            la = self._loss(coef, X, y, idx)
            coef[idx] = b
            lb = self._loss(coef, X, y, idx)
            for it in range(20):
                if (la > lb):
                    a = (b - ((b - a) * golden1))
                    coef[idx] = a
                    la = self._loss(coef, X, y, idx)
                else:
                    b = (b - ((b - a) * golden2))
                    coef[idx] = b
                    lb = self._loss(coef, X, y, idx)
    self.coef_ = {'x': coef}