'Fit smoothing spline trying to optimize GCV.
Try to find a bracketing interval for scipy.optimize.golden
based on bracket.
It is probably best to use target_df instead, as it is
sometimes difficult to find a bracketing interval.
INPUTS:
y       -- response variable
x       -- if None, uses self.x
df      -- target degrees of freedom
weights -- optional array of weights
tol     -- (relative) tolerance for convergence
brack   -- an initial guess at the bracketing interval
OUTPUTS: None
The smoothing spline is determined by self.coef,
subsequent calls of __call__ will be the smoothing spline.'

def fit_optimize_gcv(self, y, x=None, weights=None, tol=0.001, brack=((-100), 20)):

    def _gcv(pen, y, x):
        self.fit(y, x=x, pen=np.exp(pen))
        a = self.gcv()
        return a
    a = golden(_gcv, args=(y, x), brack=bracket, tol=tol)
