(self, X, f)
update
update
update
def tell(self, X, f):
        """update """
        mu = 1 if self.mu else int(len(f) / 4)
        idx = np.argsort(f)[:mu]
        zr = [self.zr[i] for i in idx]
        Z = [self.Z[i] for i in idx]
        X = [X[i] for i in idx]
        xmean = np.mean(X, axis=0)

        self.ps *= 1 - self.cs
        self.ps += (self.cs*(2-self.cs))**0.5 * mu**0.5 * np.mean(Z, axis=0)
        self.sigma *= np.exp((self.cs/self.damps) * (sum(self.ps**2)**0.5 / self.chiN - 1))
        if self.use_abs_sigma:
            self.sigmai *= np.exp((1/self.dampi) * (np.abs(self.ps) / self.chi1 - 1))
        else:
            self.sigmai *= np.exp((1.3/self.dampi/2) * (self.ps**2 - 1))

        self.pr *= 1 - self.csr
        self.pr += (self.csr*(2-self.csr))**0.5 * mu**0.5 * np.mean(zr)
        fac = 1
        if self.use_sign:
            fac = np.sign(self.pr)  # produces readaptations on the cigar
        else:
            self.pr = max([0, self.pr])
        if self.use_scalar_product:
            if np.sign(sum(self.r * (xmean - self.mean))) < 0: # and self.pr > 1:
            # if np.sign(sum(self.r * self.ps)) < 0:
                self.r *= -1
        if self.eta_r:
            self.r *= (1 - self.eta_r) * self.sigma_r
            self.r += fac * self.eta_r * mu**0.5 * (xmean - self.mean)
            self.r /= sum(self.r**2)**0.5
        if self.use_abs_sigma_r:
            self.sigma_r *= np.exp((1/self.dampsr) * ((self.pr**2)**0.5 / self.chi1 - 1))
        else:
            # this is worse on the cigar, where the direction vector(!) behaves strangely
            self.sigma_r *= np.exp((1/self.dampsr) * (self.pr**2 - 1) / 2)
        self.sigma_r = max([self.sigma * sum(self.sigmai**2)**0.5 / 3, self.sigma_r])
        # self.sigma_r = 0
        self.mean = xmean
def tell ( self , X , f ) : mu = 1 if self . mu else int ( len ( f ) / 4 ) idx = np . argsort ( f ) [ : mu ] zr = [ self . zr [ i ] for i in idx ] Z = [ self . Z [ i ] for i in idx ] X = [ X [ i ] for i in idx ] xmean = np . mean ( X , axis = 0 ) self . ps *= 1 - self . cs self . ps += ( self . cs * ( 2 - self . cs ) ) ** 0.5 * mu ** 0.5 * np . mean ( Z , axis = 0 ) self . sigma *= np . exp ( ( self . cs / self . damps ) * ( sum ( self . ps ** 2 ) ** 0.5 / self . chiN - 1 ) ) if self . use_abs_sigma : self . sigmai *= np . exp ( ( 1 / self . dampi ) * ( np . abs ( self . ps ) / self . chi1 - 1 ) ) else : self . sigmai *= np . exp ( ( 1.3 / self . dampi / 2 ) * ( self . ps ** 2 - 1 ) ) self . pr *= 1 - self . csr self . pr += ( self . csr * ( 2 - self . csr ) ) ** 0.5 * mu ** 0.5 * np . mean ( zr ) fac = 1 if self . use_sign : fac = np . sign ( self . pr ) # produces readaptations on the cigar else : self . pr = max ( [ 0 , self . pr ] ) if self . use_scalar_product : if np . sign ( sum ( self . r * ( xmean - self . mean ) ) ) < 0 : # and self.pr > 1: # if np.sign(sum(self.r * self.ps)) < 0: self . r *= - 1 if self . eta_r : self . r *= ( 1 - self . eta_r ) * self . sigma_r self . r += fac * self . eta_r * mu ** 0.5 * ( xmean - self . mean ) self . r /= sum ( self . r ** 2 ) ** 0.5 if self . use_abs_sigma_r : self . sigma_r *= np . exp ( ( 1 / self . dampsr ) * ( ( self . pr ** 2 ) ** 0.5 / self . chi1 - 1 ) ) else : # this is worse on the cigar, where the direction vector(!) behaves strangely self . sigma_r *= np . exp ( ( 1 / self . dampsr ) * ( self . pr ** 2 - 1 ) / 2 ) self . sigma_r = max ( [ self . sigma * sum ( self . sigmai ** 2 ) ** 0.5 / 3 , self . sigma_r ] ) # self.sigma_r = 0 self . mean = xmean