Gets root mse between the logarithms of the prediction and the truth.
420933
def get_rmse_log(net, X_train, y_train):
    """"""
    num_train = X_train.shape[0]
    clipped_preds = nd.clip(net(X_train), 1, float('inf'))
    return np.sqrt(2 * nd.sum(square_loss(
        nd.log(clipped_preds), nd.log(y_train))).asscalar() / num_train)
666113
protected double computeMseR() {
        double p_c;
        double mse_r = 0;

        for (int i = 0; i < this.classDistributions.length; i++) {
            p_c = (double) this.classDistributions[i] / (double) this.chunkSize;
            mse_r += p_c * ((1 - p_c) * (1 - p_c));
        }

        return mse_r;
    }
1161169
def y0astep():
    
    """

    global mp_b
    mp_b[:] = mp_inv_off_diag * np.sum((mp_S + mp_rho*(mp_DX+mp_U0)),
                                       axis=mp_axisM, keepdims=True)
496612
def root_mean_square(X):
    '''  '''
    segment_width = X.shape[1]
    return np.sqrt(np.sum(X * X, axis=1) / segment_width)
1097762
def log_conditional_likelihood(self, x):
        
        T, D = self.T, self.D_latent
        assert x.shape == (T, D)

        ll = 0
        for t in range(self.T):
            ll += self.local_log_likelihood(x[t], self.data[t], self.inputs[t])
        return ll
751253
def getDeltaLogLike(self, dlnl, upper=True):
        """"""
        mle_val = self.mle()
        # A little bit of paranoia to avoid zeros
        if mle_val <= 0.:
            mle_val = self._interp.xmin
        if mle_val <= 0.:
            mle_val = self._interp.x[1]
        log_mle = np.log10(mle_val)
        lnl_max = self.fn_mle()

        # This ultra-safe code to find an absolute maximum
        # fmax = self.fn_mle()
        # m = (fmax-self.interp.y > 0.1+dlnl) & (self.interp.x>self._mle)

        # if sum(m) == 0:
        #    xmax = self.interp.x[-1]*10
        # else:
        #    xmax = self.interp.x[m][0]

        # Matt has found that it is faster to use an interpolator
        # than an actual root-finder to find the root,
        # probably b/c of python overhead.
        # That would be something like this:
        # rf = lambda x: self._interp(x)+dlnl-lnl_max
        # return opt.brentq(rf,self._mle,self._interp.xmax,
        #                   xtol=1e-10*np.abs(self._mle))
        if upper:
            x = np.logspace(log_mle, np.log10(self._interp.xmax), 100)
            retVal = np.interp(dlnl, self.interp(x) - lnl_max, x)
        else:
            x = np.linspace(self._interp.xmin, self._mle, 100)
            retVal = np.interp(dlnl, self.interp(x)[::-1] - lnl_max, x[::-1])

        return retVal
1280121
def mles(self):
        
        mle_vals = np.ndarray((self._nx))
        for i in range(self._nx):
            mle_vals[i] = self._loglikes[i].mle()
        return mle_vals
17190
def log_env_gte(desired):
    
    return LOGLEVELS.get(check_log_env()) >= LOGLEVELS.get(desired, LOGLEVELS[TEST])
1187803
def hessian_local_log_likelihood(self, x):
        
        T, D = self.T, self.D_latent
        assert x.shape == (T, D)

        hfun = hessian(self.local_log_likelihood)
        H_diag = np.zeros((T, D, D))
        for t in range(T):
            H_diag[t] = hfun(x[t], self.data[t], self.inputs[t])
        return H_diag
717883
def get_root(self):
        """"""
        return get_result_class(self.__class__).objects.get(
            path=self.path[0:self.steplen])
1063410
def _deriv_logaddexp(x1, x2):
    """"""
    y1 = np.exp(x1)
    y2 = np.exp(x2)
    df_dx1 = y1 / (y1 + y2)
    df_dx2 = y2 / (y1 + y2)
    return np.vstack([df_dx1, df_dx2]).T
680082
def _root_mean_square_error(y, y_pred, w):
    """"""
    return np.sqrt(np.average(((y_pred - y) ** 2), weights=w))
617140
def get_root( self, **kwargs ):
        ''' 
        '''
        if self.parent == None:
            return self
        else:
            return self.parent.get_root( **kwargs )
201247
def _get_bmu(self, activations):
        """"""
        # If the neural gas is a recursive neural gas, we need reverse argsort.
        if self.argfunc == 'argmax':
            activations = -activations
        sort = np.argsort(activations, 1)
        return sort.argsort()
302967
def rgevolve_leadinglog(self, scale_out):
        
        self._check_initial()
        return rge.smeft_evolve_leadinglog(C_in=self.C_in,
                            scale_high=self.scale_high,
                            scale_in=self.scale_in,
                            scale_out=scale_out)
1054304
def mse(mean, estimator):
    
    return np.mean((np.asarray(estimator) - np.asarray(mean)) ** 2, axis=0)
1195638
def logsumexp(x):
    """"""
    max_x = np.max(x)
    return max_x + np.log(np.sum(np.exp(x - max_x)))