How to use the exoplanet.quadpotential._WeightedCovariance function in exoplanet

To help you get started, we’ve selected a few exoplanet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfm / exoplanet / exoplanet / quadpotential.py View on Github external
def update(self, sample, grad, tune):
        if not tune:
            return

        self._foreground_cov.add_sample(sample, weight=1)
        self._background_cov.add_sample(sample, weight=1)
        self._update_from_weightvar(self._foreground_cov)

        # Steps since previous update
        delta = self._n_samples - self._previous_update
        if delta >= self._adaptation_window:
            self._foreground_cov = self._background_cov
            self._background_cov = _WeightedCovariance(
                self._n, dtype=self.dtype
            )

            self._previous_update = self._n_samples
            if self._doubling:
                self._adaptation_window *= 2

        self._n_samples += 1
github dfm / exoplanet / exoplanet / quadpotential.py View on Github external
)

        if dtype is None:
            dtype = theano.config.floatX

        if initial_cov is None:
            initial_cov = np.eye(n, dtype=dtype)
            initial_weight = 1

        self.dtype = dtype
        self._n = n
        self._cov = np.array(initial_cov, dtype=self.dtype, copy=True)
        self._cov_theano = theano.shared(self._cov)
        self._chol = cholesky(self._cov, lower=True)
        self._chol_error = None
        self._foreground_cov = _WeightedCovariance(
            self._n, initial_mean, initial_cov, initial_weight, self.dtype
        )
        self._background_cov = _WeightedCovariance(self._n, dtype=self.dtype)
        self._n_samples = 0

        self._doubling = doubling
        self._adaptation_window = int(adaptation_window)
        self._previous_update = 0
github dfm / exoplanet / exoplanet / quadpotential.py View on Github external
dtype = theano.config.floatX

        if initial_cov is None:
            initial_cov = np.eye(n, dtype=dtype)
            initial_weight = 1

        self.dtype = dtype
        self._n = n
        self._cov = np.array(initial_cov, dtype=self.dtype, copy=True)
        self._cov_theano = theano.shared(self._cov)
        self._chol = cholesky(self._cov, lower=True)
        self._chol_error = None
        self._foreground_cov = _WeightedCovariance(
            self._n, initial_mean, initial_cov, initial_weight, self.dtype
        )
        self._background_cov = _WeightedCovariance(self._n, dtype=self.dtype)
        self._n_samples = 0

        self._doubling = doubling
        self._adaptation_window = int(adaptation_window)
        self._previous_update = 0