<commit_before>#
# Exponential natural evolution strategy optimizer: xNES
#
# This file is part of PINTS.
#  Copyright (c) 2017, University of Oxford.
#  For licensing information, see the LICENSE file distributed with the PINTS
#  software package.
#
# Some code in this file was adapted from Myokit (see http://myokit.org)
#
import pints
import numpy as np
import scipy
import scipy.linalg
import multiprocessing

class AdaptiveCovarianceMCMC(pints.MCMC):
    """
    Creates a chain of samples from a target distribution, using the adaptive
    covariance machine described in [1, 2].
        
    [1] Glasmachers, Schaul, Schmidhuber et al. (2010) Exponential natural
    evolution strategies.
    Proceedings of the 12th annual conference on Genetic and evolutionary
    computation
    
    [2] PyBrain: The Python machine learning library (http://pybrain.org)
    
    """
    def run(self):

        # Target acceptance rate
        acceptance_target = 0.25

        # Total number of iterations
        #TODO Allow changing before run() with method call
        iterations = 2000 * self._dimension

        # Number of iterations before adapation
        #TODO Allow changing before run() with method call
        adaptation = int(iterations / 2)

        # Number of iterations to discard as burn-in
        #TODO Allow changing before run() with method call
        burn_in = int(iterations / 2)

        # Thinning: Store only one sample per X
        #TODO Allow changing before run() with method call
        thinning = 4

        # Initial starting parameters
        mu = self._x0<commit_msg>Fixed docs for adaptive mcmc<commit_after>#
# Exponential natural evolution strategy optimizer: xNES
#
# This file is part of PINTS.
#  Copyright (c) 2017, University of Oxford.
#  For licensing information, see the LICENSE file distributed with the PINTS
#  software package.
#
# Some code in this file was adapted from Myokit (see http://myokit.org)
#
import pints
import numpy as np
import scipy
import scipy.linalg
import multiprocessing

class AdaptiveCovarianceMCMC(pints.MCMC):
    """
    Creates a chain of samples from a target distribution, using the adaptive
    covariance routine described in [1].
        
    [1] Uncertainty and variability in models of the cardiac action potential:
    Can we build trustworthy models?
    Johnstone, Chang, Bardenet, <NAME>, Gavaghan, Pathmanathan, Clayton,
    Mirams (2015) Journal of Molecular and Cellular Cardiology
    """
    def run(self):

        # Target acceptance rate
        acceptance_target = 0.25

        # Total number of iterations
        #TODO Allow changing before run() with method call
        iterations = 2000 * self._dimension

        # Number of iterations before adapation
        #TODO Allow changing before run() with method call
        adaptation = int(iterations / 2)

        # Number of iterations to discard as burn-in
        #TODO Allow changing before run() with method call
        burn_in = int(iterations / 2)

        # Thinning: Store only one sample per X
        #TODO Allow changing before run() with method call
        thinning = 4

        # Initial starting parameters
        mu = self._x0
{'fraction_non_alphanumeric': 0.060842433697347896, 'fraction_numerical': 0.014352574102964118, 'mean_word_length': 2.834928229665072, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2849779', 'n_tokens_mistral': 926, 'n_tokens_neox': 843, 'n_words': 369}