partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
HMM.generate_synthetic_observation_trajectory
Generate a synthetic realization of observables. Parameters ---------- length : int Length of synthetic state trajectory to be generated. initial_Pi : np.array of shape (nstates,), optional, default=None The initial probability distribution, if samples are not to...
bhmm/hmm/generic_hmm.py
def generate_synthetic_observation_trajectory(self, length, initial_Pi=None): """Generate a synthetic realization of observables. Parameters ---------- length : int Length of synthetic state trajectory to be generated. initial_Pi : np.array of shape (nstates,), optio...
def generate_synthetic_observation_trajectory(self, length, initial_Pi=None): """Generate a synthetic realization of observables. Parameters ---------- length : int Length of synthetic state trajectory to be generated. initial_Pi : np.array of shape (nstates,), optio...
[ "Generate", "a", "synthetic", "realization", "of", "observables", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hmm/generic_hmm.py#L506-L545
[ "def", "generate_synthetic_observation_trajectory", "(", "self", ",", "length", ",", "initial_Pi", "=", "None", ")", ":", "# First, generate synthetic state trajetory.", "s_t", "=", "self", ".", "generate_synthetic_state_trajectory", "(", "length", ",", "initial_Pi", "=",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
HMM.generate_synthetic_observation_trajectories
Generate a number of synthetic realization of observables from this model. Parameters ---------- ntrajectories : int The number of trajectories to be generated. length : int Length of synthetic state trajectory to be generated. initial_Pi : np.array of sh...
bhmm/hmm/generic_hmm.py
def generate_synthetic_observation_trajectories(self, ntrajectories, length, initial_Pi=None): """Generate a number of synthetic realization of observables from this model. Parameters ---------- ntrajectories : int The number of trajectories to be generated. length :...
def generate_synthetic_observation_trajectories(self, ntrajectories, length, initial_Pi=None): """Generate a number of synthetic realization of observables from this model. Parameters ---------- ntrajectories : int The number of trajectories to be generated. length :...
[ "Generate", "a", "number", "of", "synthetic", "realization", "of", "observables", "from", "this", "model", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hmm/generic_hmm.py#L547-L589
[ "def", "generate_synthetic_observation_trajectories", "(", "self", ",", "ntrajectories", ",", "length", ",", "initial_Pi", "=", "None", ")", ":", "O", "=", "list", "(", ")", "# observations", "S", "=", "list", "(", ")", "# state trajectories", "for", "trajectory...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
nb_to_python
convert notebook to python script
docs/sphinxext/notebook_sphinxext.py
def nb_to_python(nb_path): """convert notebook to python script""" exporter = python.PythonExporter() output, resources = exporter.from_filename(nb_path) return output
def nb_to_python(nb_path): """convert notebook to python script""" exporter = python.PythonExporter() output, resources = exporter.from_filename(nb_path) return output
[ "convert", "notebook", "to", "python", "script" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/docs/sphinxext/notebook_sphinxext.py#L107-L111
[ "def", "nb_to_python", "(", "nb_path", ")", ":", "exporter", "=", "python", ".", "PythonExporter", "(", ")", "output", ",", "resources", "=", "exporter", ".", "from_filename", "(", "nb_path", ")", "return", "output" ]
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
nb_to_html
convert notebook to html
docs/sphinxext/notebook_sphinxext.py
def nb_to_html(nb_path): """convert notebook to html""" exporter = html.HTMLExporter(template_file='full') output, resources = exporter.from_filename(nb_path) header = output.split('<head>', 1)[1].split('</head>',1)[0] body = output.split('<body>', 1)[1].split('</body>',1)[0] # http://imgur.com...
def nb_to_html(nb_path): """convert notebook to html""" exporter = html.HTMLExporter(template_file='full') output, resources = exporter.from_filename(nb_path) header = output.split('<head>', 1)[1].split('</head>',1)[0] body = output.split('<body>', 1)[1].split('</body>',1)[0] # http://imgur.com...
[ "convert", "notebook", "to", "html" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/docs/sphinxext/notebook_sphinxext.py#L113-L143
[ "def", "nb_to_html", "(", "nb_path", ")", ":", "exporter", "=", "html", ".", "HTMLExporter", "(", "template_file", "=", "'full'", ")", "output", ",", "resources", "=", "exporter", ".", "from_filename", "(", "nb_path", ")", "header", "=", "output", ".", "sp...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.p_obs
Returns the output probabilities for an entire trajectory and all hidden states Parameters ---------- obs : ndarray((T), dtype=int) a discrete trajectory of length T Return ------ p_o : ndarray (T,N) the probability of generating the symbol at ti...
bhmm/output_models/discrete.py
def p_obs(self, obs, out=None): """ Returns the output probabilities for an entire trajectory and all hidden states Parameters ---------- obs : ndarray((T), dtype=int) a discrete trajectory of length T Return ------ p_o : ndarray (T,N) ...
def p_obs(self, obs, out=None): """ Returns the output probabilities for an entire trajectory and all hidden states Parameters ---------- obs : ndarray((T), dtype=int) a discrete trajectory of length T Return ------ p_o : ndarray (T,N) ...
[ "Returns", "the", "output", "probabilities", "for", "an", "entire", "trajectory", "and", "all", "hidden", "states" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L130-L157
[ "def", "p_obs", "(", "self", ",", "obs", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "self", ".", "_output_probabilities", "[", ":", ",", "obs", "]", ".", "T", "# out /= np.sum(out, axis=1)[:,None]", "return", "self", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.estimate
Maximum likelihood estimation of output model given the observations and weights Parameters ---------- observations : [ ndarray(T_k) ] with K elements A list of K observation trajectories, each having length T_k weights : [ ndarray(T_k, N) ] with K elements A li...
bhmm/output_models/discrete.py
def estimate(self, observations, weights): """ Maximum likelihood estimation of output model given the observations and weights Parameters ---------- observations : [ ndarray(T_k) ] with K elements A list of K observation trajectories, each having length T_k ...
def estimate(self, observations, weights): """ Maximum likelihood estimation of output model given the observations and weights Parameters ---------- observations : [ ndarray(T_k) ] with K elements A list of K observation trajectories, each having length T_k ...
[ "Maximum", "likelihood", "estimation", "of", "output", "model", "given", "the", "observations", "and", "weights" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L159-L215
[ "def", "estimate", "(", "self", ",", "observations", ",", "weights", ")", ":", "# sizes", "N", ",", "M", "=", "self", ".", "_output_probabilities", ".", "shape", "K", "=", "len", "(", "observations", ")", "# initialize output probability matrix", "self", ".", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.sample
Sample a new set of distribution parameters given a sample of observations from the given state. The internal parameters are updated. Parameters ---------- observations : [ numpy.array with shape (N_k,) ] with nstates elements observations[k] are all observations associate...
bhmm/output_models/discrete.py
def sample(self, observations_by_state): """ Sample a new set of distribution parameters given a sample of observations from the given state. The internal parameters are updated. Parameters ---------- observations : [ numpy.array with shape (N_k,) ] with nstates elemen...
def sample(self, observations_by_state): """ Sample a new set of distribution parameters given a sample of observations from the given state. The internal parameters are updated. Parameters ---------- observations : [ numpy.array with shape (N_k,) ] with nstates elemen...
[ "Sample", "a", "new", "set", "of", "distribution", "parameters", "given", "a", "sample", "of", "observations", "from", "the", "given", "state", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L217-L251
[ "def", "sample", "(", "self", ",", "observations_by_state", ")", ":", "from", "numpy", ".", "random", "import", "dirichlet", "N", ",", "M", "=", "self", ".", "_output_probabilities", ".", "shape", "# nstates, nsymbols", "for", "i", ",", "obs_by_state", "in", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.generate_observation_from_state
Generate a single synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. Returns ------- observation : float A single observation from the given state...
bhmm/output_models/discrete.py
def generate_observation_from_state(self, state_index): """ Generate a single synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. Returns ------- ...
def generate_observation_from_state(self, state_index): """ Generate a single synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. Returns ------- ...
[ "Generate", "a", "single", "synthetic", "observation", "data", "from", "a", "given", "state", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L253-L283
[ "def", "generate_observation_from_state", "(", "self", ",", "state_index", ")", ":", "# generate random generator (note that this is inefficient - better use one of the next functions", "import", "scipy", ".", "stats", "gen", "=", "scipy", ".", "stats", ".", "rv_discrete", "(...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.generate_observations_from_state
Generate synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. nobs : int The number of observations to generate. Returns ------- observation...
bhmm/output_models/discrete.py
def generate_observations_from_state(self, state_index, nobs): """ Generate synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. nobs : int The numbe...
def generate_observations_from_state(self, state_index, nobs): """ Generate synthetic observation data from a given state. Parameters ---------- state_index : int Index of the state from which observations are to be generated. nobs : int The numbe...
[ "Generate", "synthetic", "observation", "data", "from", "a", "given", "state", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L285-L315
[ "def", "generate_observations_from_state", "(", "self", ",", "state_index", ",", "nobs", ")", ":", "import", "scipy", ".", "stats", "gen", "=", "scipy", ".", "stats", ".", "rv_discrete", "(", "values", "=", "(", "range", "(", "self", ".", "_nsymbols", ")",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
DiscreteOutputModel.generate_observation_trajectory
Generate synthetic observation data from a given state sequence. Parameters ---------- s_t : numpy.array with shape (T,) of int type s_t[t] is the hidden state sampled at time t Returns ------- o_t : numpy.array with shape (T,) of type dtype o_t[...
bhmm/output_models/discrete.py
def generate_observation_trajectory(self, s_t, dtype=None): """ Generate synthetic observation data from a given state sequence. Parameters ---------- s_t : numpy.array with shape (T,) of int type s_t[t] is the hidden state sampled at time t Returns ...
def generate_observation_trajectory(self, s_t, dtype=None): """ Generate synthetic observation data from a given state sequence. Parameters ---------- s_t : numpy.array with shape (T,) of int type s_t[t] is the hidden state sampled at time t Returns ...
[ "Generate", "synthetic", "observation", "data", "from", "a", "given", "state", "sequence", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L317-L378
[ "def", "generate_observation_trajectory", "(", "self", ",", "s_t", ",", "dtype", "=", "None", ")", ":", "if", "dtype", "is", "None", ":", "dtype", "=", "np", ".", "int32", "# Determine number of samples to generate.", "T", "=", "s_t", ".", "shape", "[", "0",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
set_implementation
Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"]
bhmm/hidden/api.py
def set_implementation(impl): """ Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"] """ global __impl__ if impl.lower() == 'python': __impl__ = __IMPL_PYTHON__ elif impl.lower() == 'c': __impl__ = __IMPL_C__ e...
def set_implementation(impl): """ Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"] """ global __impl__ if impl.lower() == 'python': __impl__ = __IMPL_PYTHON__ elif impl.lower() == 'c': __impl__ = __IMPL_C__ e...
[ "Sets", "the", "implementation", "of", "this", "module" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L44-L62
[ "def", "set_implementation", "(", "impl", ")", ":", "global", "__impl__", "if", "impl", ".", "lower", "(", ")", "==", "'python'", ":", "__impl__", "=", "__IMPL_PYTHON__", "elif", "impl", ".", "lower", "(", ")", "==", "'c'", ":", "__impl__", "=", "__IMPL_...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
forward
Compute P( obs | A, B, pi ) and all forward coefficients. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observation at time t given hidden state i pi : ...
bhmm/hidden/api.py
def forward(A, pobs, pi, T=None, alpha_out=None): """Compute P( obs | A, B, pi ) and all forward coefficients. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability...
def forward(A, pobs, pi, T=None, alpha_out=None): """Compute P( obs | A, B, pi ) and all forward coefficients. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability...
[ "Compute", "P", "(", "obs", "|", "A", "B", "pi", ")", "and", "all", "forward", "coefficients", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L65-L96
[ "def", "forward", "(", "A", ",", "pobs", ",", "pi", ",", "T", "=", "None", ",", "alpha_out", "=", "None", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "forward", "(", "A", ",", "pobs", ",", "pi", ",", "T", "=", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
backward
Compute all backward coefficients. With scaling! Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observation at time t given hidden state i T : int, optio...
bhmm/hidden/api.py
def backward(A, pobs, T=None, beta_out=None): """Compute all backward coefficients. With scaling! Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observat...
def backward(A, pobs, T=None, beta_out=None): """Compute all backward coefficients. With scaling! Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observat...
[ "Compute", "all", "backward", "coefficients", ".", "With", "scaling!" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L99-L125
[ "def", "backward", "(", "A", ",", "pobs", ",", "T", "=", "None", ",", "beta_out", "=", "None", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "backward", "(", "A", ",", "pobs", ",", "T", "=", "T", ",", "beta_out", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
state_probabilities
Calculate the (T,N)-probabilty matrix for being in state i at time t. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((T,N), dtype = float), optional, default = None beta[t,i] is th...
bhmm/hidden/api.py
def state_probabilities(alpha, beta, T=None, gamma_out=None): """ Calculate the (T,N)-probabilty matrix for being in state i at time t. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((...
def state_probabilities(alpha, beta, T=None, gamma_out=None): """ Calculate the (T,N)-probabilty matrix for being in state i at time t. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((...
[ "Calculate", "the", "(", "T", "N", ")", "-", "probabilty", "matrix", "for", "being", "in", "state", "i", "at", "time", "t", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L133-L188
[ "def", "state_probabilities", "(", "alpha", ",", "beta", ",", "T", "=", "None", ",", "gamma_out", "=", "None", ")", ":", "# get summation helper - we use matrix multiplication with 1's because it's faster than the np.sum function (yes!)", "global", "ones_size", "if", "ones_si...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
state_counts
Sum the probabilities of being in state i to time t Parameters ---------- gamma : ndarray((T,N), dtype = float), optional, default = None gamma[t,i] is the probabilty at time t to be in state i ! T : int number of time steps Returns ------- count : numpy.array shape (N) ...
bhmm/hidden/api.py
def state_counts(gamma, T, out=None): """ Sum the probabilities of being in state i to time t Parameters ---------- gamma : ndarray((T,N), dtype = float), optional, default = None gamma[t,i] is the probabilty at time t to be in state i ! T : int number of time steps Returns ...
def state_counts(gamma, T, out=None): """ Sum the probabilities of being in state i to time t Parameters ---------- gamma : ndarray((T,N), dtype = float), optional, default = None gamma[t,i] is the probabilty at time t to be in state i ! T : int number of time steps Returns ...
[ "Sum", "the", "probabilities", "of", "being", "in", "state", "i", "to", "time", "t" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L191-L211
[ "def", "state_counts", "(", "gamma", ",", "T", ",", "out", "=", "None", ")", ":", "return", "np", ".", "sum", "(", "gamma", "[", "0", ":", "T", "]", ",", "axis", "=", "0", ",", "out", "=", "out", ")" ]
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
transition_counts
Sum for all t the probability to transition from state i to state j. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((T,N), dtype = float), optional, default = None beta[t,i] is the...
bhmm/hidden/api.py
def transition_counts(alpha, beta, A, pobs, T=None, out=None): """ Sum for all t the probability to transition from state i to state j. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((...
def transition_counts(alpha, beta, A, pobs, T=None, out=None): """ Sum for all t the probability to transition from state i to state j. Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. beta : ndarray((...
[ "Sum", "for", "all", "t", "the", "probability", "to", "transition", "from", "state", "i", "to", "state", "j", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L214-L248
[ "def", "transition_counts", "(", "alpha", ",", "beta", ",", "A", ",", "pobs", ",", "T", "=", "None", ",", "out", "=", "None", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "transition_counts", "(", "alpha", ",", "beta",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
viterbi
Estimate the hidden pathway of maximum likelihood using the Viterbi algorithm. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observation at time t given hid...
bhmm/hidden/api.py
def viterbi(A, pobs, pi): """ Estimate the hidden pathway of maximum likelihood using the Viterbi algorithm. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability f...
def viterbi(A, pobs, pi): """ Estimate the hidden pathway of maximum likelihood using the Viterbi algorithm. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability f...
[ "Estimate", "the", "hidden", "pathway", "of", "maximum", "likelihood", "using", "the", "Viterbi", "algorithm", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L251-L274
[ "def", "viterbi", "(", "A", ",", "pobs", ",", "pi", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "viterbi", "(", "A", ",", "pobs", ",", "pi", ",", "dtype", "=", "config", ".", "dtype", ")", "elif", "__impl__", "=="...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
sample_path
Sample the hidden pathway S from the conditional distribution P ( S | Parameters, Observations ) Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. A : ndarray((N,N), dtype = float) transition matrix...
bhmm/hidden/api.py
def sample_path(alpha, A, pobs, T=None): """ Sample the hidden pathway S from the conditional distribution P ( S | Parameters, Observations ) Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. A : ndarra...
def sample_path(alpha, A, pobs, T=None): """ Sample the hidden pathway S from the conditional distribution P ( S | Parameters, Observations ) Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. A : ndarra...
[ "Sample", "the", "hidden", "pathway", "S", "from", "the", "conditional", "distribution", "P", "(", "S", "|", "Parameters", "Observations", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L277-L302
[ "def", "sample_path", "(", "alpha", ",", "A", ",", "pobs", ",", "T", "=", "None", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "sample_path", "(", "alpha", ",", "A", ",", "pobs", ",", "T", "=", "T", ",", "dtype", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
logger
Retrieves the logger instance associated to the given name. :param name: The name of the logger instance. :type name: str :param pattern: The associated pattern. :type pattern: str :param date_format: The date format to be used in the pattern. :type date_format: str :param handler: The logg...
bhmm/util/logger.py
def logger(name='BHMM', pattern='%(asctime)s %(levelname)s %(name)s: %(message)s', date_format='%H:%M:%S', handler=logging.StreamHandler(sys.stdout)): """ Retrieves the logger instance associated to the given name. :param name: The name of the logger instance. :type name: str :param patt...
def logger(name='BHMM', pattern='%(asctime)s %(levelname)s %(name)s: %(message)s', date_format='%H:%M:%S', handler=logging.StreamHandler(sys.stdout)): """ Retrieves the logger instance associated to the given name. :param name: The name of the logger instance. :type name: str :param patt...
[ "Retrieves", "the", "logger", "instance", "associated", "to", "the", "given", "name", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/logger.py#L25-L50
[ "def", "logger", "(", "name", "=", "'BHMM'", ",", "pattern", "=", "'%(asctime)s %(levelname)s %(name)s: %(message)s'", ",", "date_format", "=", "'%H:%M:%S'", ",", "handler", "=", "logging", ".", "StreamHandler", "(", "sys", ".", "stdout", ")", ")", ":", "_logger...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler.sample
Sample from the BHMM posterior. Parameters ---------- nsamples : int The number of samples to generate. nburn : int, optional, default=0 The number of samples to discard to burn-in, following which `nsamples` will be generated. nthin : int, optional, defa...
bhmm/estimators/bayesian_sampling.py
def sample(self, nsamples, nburn=0, nthin=1, save_hidden_state_trajectory=False, call_back=None): """Sample from the BHMM posterior. Parameters ---------- nsamples : int The number of samples to generate. nburn : int, optional, default=0 Th...
def sample(self, nsamples, nburn=0, nthin=1, save_hidden_state_trajectory=False, call_back=None): """Sample from the BHMM posterior. Parameters ---------- nsamples : int The number of samples to generate. nburn : int, optional, default=0 Th...
[ "Sample", "from", "the", "BHMM", "posterior", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L206-L263
[ "def", "sample", "(", "self", ",", "nsamples", ",", "nburn", "=", "0", ",", "nthin", "=", "1", ",", "save_hidden_state_trajectory", "=", "False", ",", "call_back", "=", "None", ")", ":", "# Run burn-in.", "for", "iteration", "in", "range", "(", "nburn", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._update
Update the current model using one round of Gibbs sampling.
bhmm/estimators/bayesian_sampling.py
def _update(self): """Update the current model using one round of Gibbs sampling. """ initial_time = time.time() self._updateHiddenStateTrajectories() self._updateEmissionProbabilities() self._updateTransitionMatrix() final_time = time.time() elapsed_ti...
def _update(self): """Update the current model using one round of Gibbs sampling. """ initial_time = time.time() self._updateHiddenStateTrajectories() self._updateEmissionProbabilities() self._updateTransitionMatrix() final_time = time.time() elapsed_ti...
[ "Update", "the", "current", "model", "using", "one", "round", "of", "Gibbs", "sampling", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L265-L277
[ "def", "_update", "(", "self", ")", ":", "initial_time", "=", "time", ".", "time", "(", ")", "self", ".", "_updateHiddenStateTrajectories", "(", ")", "self", ".", "_updateEmissionProbabilities", "(", ")", "self", ".", "_updateTransitionMatrix", "(", ")", "fina...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._updateHiddenStateTrajectories
Sample a new set of state trajectories from the conditional distribution P(S | T, E, O)
bhmm/estimators/bayesian_sampling.py
def _updateHiddenStateTrajectories(self): """Sample a new set of state trajectories from the conditional distribution P(S | T, E, O) """ self.model.hidden_state_trajectories = list() for trajectory_index in range(self.nobs): hidden_state_trajectory = self._sampleHiddenStateT...
def _updateHiddenStateTrajectories(self): """Sample a new set of state trajectories from the conditional distribution P(S | T, E, O) """ self.model.hidden_state_trajectories = list() for trajectory_index in range(self.nobs): hidden_state_trajectory = self._sampleHiddenStateT...
[ "Sample", "a", "new", "set", "of", "state", "trajectories", "from", "the", "conditional", "distribution", "P", "(", "S", "|", "T", "E", "O", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L279-L287
[ "def", "_updateHiddenStateTrajectories", "(", "self", ")", ":", "self", ".", "model", ".", "hidden_state_trajectories", "=", "list", "(", ")", "for", "trajectory_index", "in", "range", "(", "self", ".", "nobs", ")", ":", "hidden_state_trajectory", "=", "self", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._sampleHiddenStateTrajectory
Sample a hidden state trajectory from the conditional distribution P(s | T, E, o) Parameters ---------- o_t : numpy.array with dimensions (T,) observation[n] is the nth observation dtype : numpy.dtype, optional, default=numpy.int32 The dtype to to use for returne...
bhmm/estimators/bayesian_sampling.py
def _sampleHiddenStateTrajectory(self, obs, dtype=np.int32): """Sample a hidden state trajectory from the conditional distribution P(s | T, E, o) Parameters ---------- o_t : numpy.array with dimensions (T,) observation[n] is the nth observation dtype : numpy.dtype, o...
def _sampleHiddenStateTrajectory(self, obs, dtype=np.int32): """Sample a hidden state trajectory from the conditional distribution P(s | T, E, o) Parameters ---------- o_t : numpy.array with dimensions (T,) observation[n] is the nth observation dtype : numpy.dtype, o...
[ "Sample", "a", "hidden", "state", "trajectory", "from", "the", "conditional", "distribution", "P", "(", "s", "|", "T", "E", "o", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L289-L327
[ "def", "_sampleHiddenStateTrajectory", "(", "self", ",", "obs", ",", "dtype", "=", "np", ".", "int32", ")", ":", "# Determine observation trajectory length", "T", "=", "obs", ".", "shape", "[", "0", "]", "# Convenience access.", "A", "=", "self", ".", "model",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._updateEmissionProbabilities
Sample a new set of emission probabilites from the conditional distribution P(E | S, O)
bhmm/estimators/bayesian_sampling.py
def _updateEmissionProbabilities(self): """Sample a new set of emission probabilites from the conditional distribution P(E | S, O) """ observations_by_state = [self.model.collect_observations_in_state(self.observations, state) for state in range(self.model.nstat...
def _updateEmissionProbabilities(self): """Sample a new set of emission probabilites from the conditional distribution P(E | S, O) """ observations_by_state = [self.model.collect_observations_in_state(self.observations, state) for state in range(self.model.nstat...
[ "Sample", "a", "new", "set", "of", "emission", "probabilites", "from", "the", "conditional", "distribution", "P", "(", "E", "|", "S", "O", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L329-L335
[ "def", "_updateEmissionProbabilities", "(", "self", ")", ":", "observations_by_state", "=", "[", "self", ".", "model", ".", "collect_observations_in_state", "(", "self", ".", "observations", ",", "state", ")", "for", "state", "in", "range", "(", "self", ".", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._updateTransitionMatrix
Updates the hidden-state transition matrix and the initial distribution
bhmm/estimators/bayesian_sampling.py
def _updateTransitionMatrix(self): """ Updates the hidden-state transition matrix and the initial distribution """ # TRANSITION MATRIX C = self.model.count_matrix() + self.prior_C # posterior count matrix # check if we work with these options if self.reversible...
def _updateTransitionMatrix(self): """ Updates the hidden-state transition matrix and the initial distribution """ # TRANSITION MATRIX C = self.model.count_matrix() + self.prior_C # posterior count matrix # check if we work with these options if self.reversible...
[ "Updates", "the", "hidden", "-", "state", "transition", "matrix", "and", "the", "initial", "distribution" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L337-L369
[ "def", "_updateTransitionMatrix", "(", "self", ")", ":", "# TRANSITION MATRIX", "C", "=", "self", ".", "model", ".", "count_matrix", "(", ")", "+", "self", ".", "prior_C", "# posterior count matrix", "# check if we work with these options", "if", "self", ".", "rever...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
BayesianHMMSampler._generateInitialModel
Initialize using an MLHMM.
bhmm/estimators/bayesian_sampling.py
def _generateInitialModel(self, output_model_type): """Initialize using an MLHMM. """ logger().info("Generating initial model for BHMM using MLHMM...") from bhmm.estimators.maximum_likelihood import MaximumLikelihoodEstimator mlhmm = MaximumLikelihoodEstimator(self.observations,...
def _generateInitialModel(self, output_model_type): """Initialize using an MLHMM. """ logger().info("Generating initial model for BHMM using MLHMM...") from bhmm.estimators.maximum_likelihood import MaximumLikelihoodEstimator mlhmm = MaximumLikelihoodEstimator(self.observations,...
[ "Initialize", "using", "an", "MLHMM", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/bayesian_sampling.py#L371-L380
[ "def", "_generateInitialModel", "(", "self", ",", "output_model_type", ")", ":", "logger", "(", ")", ".", "info", "(", "\"Generating initial model for BHMM using MLHMM...\"", ")", "from", "bhmm", ".", "estimators", ".", "maximum_likelihood", "import", "MaximumLikelihood...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
ensure_dtraj
r"""Makes sure that dtraj is a discrete trajectory (array of int)
bhmm/util/types.py
def ensure_dtraj(dtraj): r"""Makes sure that dtraj is a discrete trajectory (array of int) """ if is_int_vector(dtraj): return dtraj elif is_list_of_int(dtraj): return np.array(dtraj, dtype=int) else: raise TypeError('Argument dtraj is not a discrete trajectory - only list o...
def ensure_dtraj(dtraj): r"""Makes sure that dtraj is a discrete trajectory (array of int) """ if is_int_vector(dtraj): return dtraj elif is_list_of_int(dtraj): return np.array(dtraj, dtype=int) else: raise TypeError('Argument dtraj is not a discrete trajectory - only list o...
[ "r", "Makes", "sure", "that", "dtraj", "is", "a", "discrete", "trajectory", "(", "array", "of", "int", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/types.py#L160-L169
[ "def", "ensure_dtraj", "(", "dtraj", ")", ":", "if", "is_int_vector", "(", "dtraj", ")", ":", "return", "dtraj", "elif", "is_list_of_int", "(", "dtraj", ")", ":", "return", "np", ".", "array", "(", "dtraj", ",", "dtype", "=", "int", ")", "else", ":", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
ensure_dtraj_list
r"""Makes sure that dtrajs is a list of discrete trajectories (array of int)
bhmm/util/types.py
def ensure_dtraj_list(dtrajs): r"""Makes sure that dtrajs is a list of discrete trajectories (array of int) """ if isinstance(dtrajs, list): # elements are ints? then wrap into a list if is_list_of_int(dtrajs): return [np.array(dtrajs, dtype=int)] else: for i...
def ensure_dtraj_list(dtrajs): r"""Makes sure that dtrajs is a list of discrete trajectories (array of int) """ if isinstance(dtrajs, list): # elements are ints? then wrap into a list if is_list_of_int(dtrajs): return [np.array(dtrajs, dtype=int)] else: for i...
[ "r", "Makes", "sure", "that", "dtrajs", "is", "a", "list", "of", "discrete", "trajectories", "(", "array", "of", "int", ")" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/types.py#L172-L185
[ "def", "ensure_dtraj_list", "(", "dtrajs", ")", ":", "if", "isinstance", "(", "dtrajs", ",", "list", ")", ":", "# elements are ints? then wrap into a list", "if", "is_list_of_int", "(", "dtrajs", ")", ":", "return", "[", "np", ".", "array", "(", "dtrajs", ",",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
connected_sets
Computes the connected sets of C. C : count matrix mincount_connectivity : float Minimum count which counts as a connection. strong : boolean True: Seek strongly connected sets. False: Seek weakly connected sets.
bhmm/estimators/_tmatrix_disconnected.py
def connected_sets(C, mincount_connectivity=0, strong=True): """ Computes the connected sets of C. C : count matrix mincount_connectivity : float Minimum count which counts as a connection. strong : boolean True: Seek strongly connected sets. False: Seek weakly connected sets. """ ...
def connected_sets(C, mincount_connectivity=0, strong=True): """ Computes the connected sets of C. C : count matrix mincount_connectivity : float Minimum count which counts as a connection. strong : boolean True: Seek strongly connected sets. False: Seek weakly connected sets. """ ...
[ "Computes", "the", "connected", "sets", "of", "C", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L28-L43
[ "def", "connected_sets", "(", "C", ",", "mincount_connectivity", "=", "0", ",", "strong", "=", "True", ")", ":", "import", "msmtools", ".", "estimation", "as", "msmest", "Cconn", "=", "C", ".", "copy", "(", ")", "Cconn", "[", "np", ".", "where", "(", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
closed_sets
Computes the strongly connected closed sets of C
bhmm/estimators/_tmatrix_disconnected.py
def closed_sets(C, mincount_connectivity=0): """ Computes the strongly connected closed sets of C """ n = np.shape(C)[0] S = connected_sets(C, mincount_connectivity=mincount_connectivity, strong=True) closed = [] for s in S: mask = np.zeros(n, dtype=bool) mask[s] = True if C[...
def closed_sets(C, mincount_connectivity=0): """ Computes the strongly connected closed sets of C """ n = np.shape(C)[0] S = connected_sets(C, mincount_connectivity=mincount_connectivity, strong=True) closed = [] for s in S: mask = np.zeros(n, dtype=bool) mask[s] = True if C[...
[ "Computes", "the", "strongly", "connected", "closed", "sets", "of", "C" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L46-L56
[ "def", "closed_sets", "(", "C", ",", "mincount_connectivity", "=", "0", ")", ":", "n", "=", "np", ".", "shape", "(", "C", ")", "[", "0", "]", "S", "=", "connected_sets", "(", "C", ",", "mincount_connectivity", "=", "mincount_connectivity", ",", "strong",...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
nonempty_set
Returns the set of states that have at least one incoming or outgoing count
bhmm/estimators/_tmatrix_disconnected.py
def nonempty_set(C, mincount_connectivity=0): """ Returns the set of states that have at least one incoming or outgoing count """ # truncate to states with at least one observed incoming or outgoing count. if mincount_connectivity > 0: C = C.copy() C[np.where(C < mincount_connectivity)] = 0 ...
def nonempty_set(C, mincount_connectivity=0): """ Returns the set of states that have at least one incoming or outgoing count """ # truncate to states with at least one observed incoming or outgoing count. if mincount_connectivity > 0: C = C.copy() C[np.where(C < mincount_connectivity)] = 0 ...
[ "Returns", "the", "set", "of", "states", "that", "have", "at", "least", "one", "incoming", "or", "outgoing", "count" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L59-L65
[ "def", "nonempty_set", "(", "C", ",", "mincount_connectivity", "=", "0", ")", ":", "# truncate to states with at least one observed incoming or outgoing count.", "if", "mincount_connectivity", ">", "0", ":", "C", "=", "C", ".", "copy", "(", ")", "C", "[", "np", "....
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
estimate_P
Estimates full transition matrix for general connectivity structure Parameters ---------- C : ndarray count matrix reversible : bool estimate reversible? fixed_statdist : ndarray or None estimate with given stationary distribution maxiter : int Maximum number of ...
bhmm/estimators/_tmatrix_disconnected.py
def estimate_P(C, reversible=True, fixed_statdist=None, maxiter=1000000, maxerr=1e-8, mincount_connectivity=0): """ Estimates full transition matrix for general connectivity structure Parameters ---------- C : ndarray count matrix reversible : bool estimate reversible? fixed_sta...
def estimate_P(C, reversible=True, fixed_statdist=None, maxiter=1000000, maxerr=1e-8, mincount_connectivity=0): """ Estimates full transition matrix for general connectivity structure Parameters ---------- C : ndarray count matrix reversible : bool estimate reversible? fixed_sta...
[ "Estimates", "full", "transition", "matrix", "for", "general", "connectivity", "structure" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L68-L123
[ "def", "estimate_P", "(", "C", ",", "reversible", "=", "True", ",", "fixed_statdist", "=", "None", ",", "maxiter", "=", "1000000", ",", "maxerr", "=", "1e-8", ",", "mincount_connectivity", "=", "0", ")", ":", "import", "msmtools", ".", "estimation", "as", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
transition_matrix_partial_rev
Maximum likelihood estimation of transition matrix which is reversible on parts Partially-reversible estimation of transition matrix. Maximizes the likelihood: .. math: P_S &=& arg max prod_{S, :} (p_ij)^c_ij \\ \Pi_S P_{S,S} &=& \Pi_S P_{S,S} where the product runs over all elements of t...
bhmm/estimators/_tmatrix_disconnected.py
def transition_matrix_partial_rev(C, P, S, maxiter=1000000, maxerr=1e-8): """Maximum likelihood estimation of transition matrix which is reversible on parts Partially-reversible estimation of transition matrix. Maximizes the likelihood: .. math: P_S &=& arg max prod_{S, :} (p_ij)^c_ij \\ \...
def transition_matrix_partial_rev(C, P, S, maxiter=1000000, maxerr=1e-8): """Maximum likelihood estimation of transition matrix which is reversible on parts Partially-reversible estimation of transition matrix. Maximizes the likelihood: .. math: P_S &=& arg max prod_{S, :} (p_ij)^c_ij \\ \...
[ "Maximum", "likelihood", "estimation", "of", "transition", "matrix", "which", "is", "reversible", "on", "parts" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L126-L190
[ "def", "transition_matrix_partial_rev", "(", "C", ",", "P", ",", "S", ",", "maxiter", "=", "1000000", ",", "maxerr", "=", "1e-8", ")", ":", "# test input", "assert", "np", ".", "array_equal", "(", "C", ".", "shape", ",", "P", ".", "shape", ")", "# cons...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
enforce_reversible_on_closed
Enforces transition matrix P to be reversible on its closed sets.
bhmm/estimators/_tmatrix_disconnected.py
def enforce_reversible_on_closed(P): """ Enforces transition matrix P to be reversible on its closed sets. """ import msmtools.analysis as msmana n = np.shape(P)[0] Prev = P.copy() # treat each weakly connected set separately sets = closed_sets(P) for s in sets: I = np.ix_(s, s) ...
def enforce_reversible_on_closed(P): """ Enforces transition matrix P to be reversible on its closed sets. """ import msmtools.analysis as msmana n = np.shape(P)[0] Prev = P.copy() # treat each weakly connected set separately sets = closed_sets(P) for s in sets: I = np.ix_(s, s) ...
[ "Enforces", "transition", "matrix", "P", "to", "be", "reversible", "on", "its", "closed", "sets", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L193-L209
[ "def", "enforce_reversible_on_closed", "(", "P", ")", ":", "import", "msmtools", ".", "analysis", "as", "msmana", "n", "=", "np", ".", "shape", "(", "P", ")", "[", "0", "]", "Prev", "=", "P", ".", "copy", "(", ")", "# treat each weakly connected set separa...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
is_reversible
Returns if P is reversible on its weakly connected sets
bhmm/estimators/_tmatrix_disconnected.py
def is_reversible(P): """ Returns if P is reversible on its weakly connected sets """ import msmtools.analysis as msmana # treat each weakly connected set separately sets = connected_sets(P, strong=False) for s in sets: Ps = P[s, :][:, s] if not msmana.is_transition_matrix(Ps): ...
def is_reversible(P): """ Returns if P is reversible on its weakly connected sets """ import msmtools.analysis as msmana # treat each weakly connected set separately sets = connected_sets(P, strong=False) for s in sets: Ps = P[s, :][:, s] if not msmana.is_transition_matrix(Ps): ...
[ "Returns", "if", "P", "is", "reversible", "on", "its", "weakly", "connected", "sets" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L212-L226
[ "def", "is_reversible", "(", "P", ")", ":", "import", "msmtools", ".", "analysis", "as", "msmana", "# treat each weakly connected set separately", "sets", "=", "connected_sets", "(", "P", ",", "strong", "=", "False", ")", "for", "s", "in", "sets", ":", "Ps", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
stationary_distribution
Simple estimator for stationary distribution for multiple strongly connected sets
bhmm/estimators/_tmatrix_disconnected.py
def stationary_distribution(P, C=None, mincount_connectivity=0): """ Simple estimator for stationary distribution for multiple strongly connected sets """ # can be replaced by msmtools.analysis.stationary_distribution in next msmtools release from msmtools.analysis.dense.stationary_vector import stationary_...
def stationary_distribution(P, C=None, mincount_connectivity=0): """ Simple estimator for stationary distribution for multiple strongly connected sets """ # can be replaced by msmtools.analysis.stationary_distribution in next msmtools release from msmtools.analysis.dense.stationary_vector import stationary_...
[ "Simple", "estimator", "for", "stationary", "distribution", "for", "multiple", "strongly", "connected", "sets" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/estimators/_tmatrix_disconnected.py#L229-L251
[ "def", "stationary_distribution", "(", "P", ",", "C", "=", "None", ",", "mincount_connectivity", "=", "0", ")", ":", "# can be replaced by msmtools.analysis.stationary_distribution in next msmtools release", "from", "msmtools", ".", "analysis", ".", "dense", ".", "station...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
SampledGaussianHMM.means_samples
r""" Samples of the Gaussian distribution means
bhmm/hmm/gaussian_hmm.py
def means_samples(self): r""" Samples of the Gaussian distribution means """ res = np.empty((self.nsamples, self.nstates, self.dimension), dtype=config.dtype) for i in range(self.nsamples): for j in range(self.nstates): res[i, j, :] = self._sampled_hmms[i].means[j] ...
def means_samples(self): r""" Samples of the Gaussian distribution means """ res = np.empty((self.nsamples, self.nstates, self.dimension), dtype=config.dtype) for i in range(self.nsamples): for j in range(self.nstates): res[i, j, :] = self._sampled_hmms[i].means[j] ...
[ "r", "Samples", "of", "the", "Gaussian", "distribution", "means" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hmm/gaussian_hmm.py#L67-L73
[ "def", "means_samples", "(", "self", ")", ":", "res", "=", "np", ".", "empty", "(", "(", "self", ".", "nsamples", ",", "self", ".", "nstates", ",", "self", ".", "dimension", ")", ",", "dtype", "=", "config", ".", "dtype", ")", "for", "i", "in", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
SampledGaussianHMM.sigmas_samples
r""" Samples of the Gaussian distribution standard deviations
bhmm/hmm/gaussian_hmm.py
def sigmas_samples(self): r""" Samples of the Gaussian distribution standard deviations """ res = np.empty((self.nsamples, self.nstates, self.dimension), dtype=config.dtype) for i in range(self.nsamples): for j in range(self.nstates): res[i, j, :] = self._sampled_hmms...
def sigmas_samples(self): r""" Samples of the Gaussian distribution standard deviations """ res = np.empty((self.nsamples, self.nstates, self.dimension), dtype=config.dtype) for i in range(self.nsamples): for j in range(self.nstates): res[i, j, :] = self._sampled_hmms...
[ "r", "Samples", "of", "the", "Gaussian", "distribution", "standard", "deviations" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hmm/gaussian_hmm.py#L91-L97
[ "def", "sigmas_samples", "(", "self", ")", ":", "res", "=", "np", ".", "empty", "(", "(", "self", ".", "nsamples", ",", "self", ".", "nstates", ",", "self", ".", "dimension", ")", ",", "dtype", "=", "config", ".", "dtype", ")", "for", "i", "in", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
_guess_output_type
Suggests a HMM model type based on the observation data Uses simple rules in order to decide which HMM model type makes sense based on observation data. If observations consist of arrays/lists of integer numbers (irrespective of whether the python type is int or float), our guess is 'discrete'. If obse...
bhmm/api.py
def _guess_output_type(observations): """ Suggests a HMM model type based on the observation data Uses simple rules in order to decide which HMM model type makes sense based on observation data. If observations consist of arrays/lists of integer numbers (irrespective of whether the python type is int o...
def _guess_output_type(observations): """ Suggests a HMM model type based on the observation data Uses simple rules in order to decide which HMM model type makes sense based on observation data. If observations consist of arrays/lists of integer numbers (irrespective of whether the python type is int o...
[ "Suggests", "a", "HMM", "model", "type", "based", "on", "the", "observation", "data" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L23-L67
[ "def", "_guess_output_type", "(", "observations", ")", ":", "from", "bhmm", ".", "util", "import", "types", "as", "_types", "o1", "=", "_np", ".", "array", "(", "observations", "[", "0", "]", ")", "# CASE: vector of int? Then we want a discrete HMM", "if", "_typ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
lag_observations
r""" Create new trajectories that are subsampled at lag but shifted Given a trajectory (s0, s1, s2, s3, s4, ...) and lag 3, this function will generate 3 trajectories (s0, s3, s6, ...), (s1, s4, s7, ...) and (s2, s5, s8, ...). Use this function in order to parametrize a MLE at lag times larger than 1 witho...
bhmm/api.py
def lag_observations(observations, lag, stride=1): r""" Create new trajectories that are subsampled at lag but shifted Given a trajectory (s0, s1, s2, s3, s4, ...) and lag 3, this function will generate 3 trajectories (s0, s3, s6, ...), (s1, s4, s7, ...) and (s2, s5, s8, ...). Use this function in order to...
def lag_observations(observations, lag, stride=1): r""" Create new trajectories that are subsampled at lag but shifted Given a trajectory (s0, s1, s2, s3, s4, ...) and lag 3, this function will generate 3 trajectories (s0, s3, s6, ...), (s1, s4, s7, ...) and (s2, s5, s8, ...). Use this function in order to...
[ "r", "Create", "new", "trajectories", "that", "are", "subsampled", "at", "lag", "but", "shifted" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L70-L94
[ "def", "lag_observations", "(", "observations", ",", "lag", ",", "stride", "=", "1", ")", ":", "obsnew", "=", "[", "]", "for", "obs", "in", "observations", ":", "for", "shift", "in", "range", "(", "0", ",", "lag", ",", "stride", ")", ":", "obs_lagged...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
gaussian_hmm
Initializes a 1D-Gaussian HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix means : ndarray(nstates, ) Means of Gaussian output distributions sigmas : ndarray(nstates, ) Standard deviatio...
bhmm/api.py
def gaussian_hmm(pi, P, means, sigmas): """ Initializes a 1D-Gaussian HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix means : ndarray(nstates, ) Means of Gaussian output distributions sigma...
def gaussian_hmm(pi, P, means, sigmas): """ Initializes a 1D-Gaussian HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix means : ndarray(nstates, ) Means of Gaussian output distributions sigma...
[ "Initializes", "a", "1D", "-", "Gaussian", "HMM" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L97-L127
[ "def", "gaussian_hmm", "(", "pi", ",", "P", ",", "means", ",", "sigmas", ")", ":", "from", "bhmm", ".", "hmm", ".", "gaussian_hmm", "import", "GaussianHMM", "from", "bhmm", ".", "output_models", ".", "gaussian", "import", "GaussianOutputModel", "# count states...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
discrete_hmm
Initializes a discrete HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix pout : ndarray(nstates,nsymbols) Output matrix from hidden states to observable symbols pi : ndarray(nstates, ) Fi...
bhmm/api.py
def discrete_hmm(pi, P, pout): """ Initializes a discrete HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix pout : ndarray(nstates,nsymbols) Output matrix from hidden states to observable symbols...
def discrete_hmm(pi, P, pout): """ Initializes a discrete HMM Parameters ---------- pi : ndarray(nstates, ) Initial distribution. P : ndarray(nstates,nstates) Hidden transition matrix pout : ndarray(nstates,nsymbols) Output matrix from hidden states to observable symbols...
[ "Initializes", "a", "discrete", "HMM" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L130-L158
[ "def", "discrete_hmm", "(", "pi", ",", "P", ",", "pout", ")", ":", "from", "bhmm", ".", "hmm", ".", "discrete_hmm", "import", "DiscreteHMM", "from", "bhmm", ".", "output_models", ".", "discrete", "import", "DiscreteOutputModel", "# initialize output model", "out...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
init_hmm
Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. output : str, optional, default=None Output model type from [None, 'gaussia...
bhmm/api.py
def init_hmm(observations, nstates, lag=1, output=None, reversible=True): """Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. ou...
def init_hmm(observations, nstates, lag=1, output=None, reversible=True): """Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. ou...
[ "Use", "a", "heuristic", "scheme", "to", "generate", "an", "initial", "model", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L161-L199
[ "def", "init_hmm", "(", "observations", ",", "nstates", ",", "lag", "=", "1", ",", "output", "=", "None", ",", "reversible", "=", "True", ")", ":", "# select output model type", "if", "output", "is", "None", ":", "output", "=", "_guess_output_type", "(", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
init_gaussian_hmm
Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. Examples -------- Generate initial model for a gaussian output model. ...
bhmm/api.py
def init_gaussian_hmm(observations, nstates, lag=1, reversible=True): """ Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. Exam...
def init_gaussian_hmm(observations, nstates, lag=1, reversible=True): """ Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. Exam...
[ "Use", "a", "heuristic", "scheme", "to", "generate", "an", "initial", "model", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L202-L227
[ "def", "init_gaussian_hmm", "(", "observations", ",", "nstates", ",", "lag", "=", "1", ",", "reversible", "=", "True", ")", ":", "from", "bhmm", ".", "init", "import", "gaussian", "if", "lag", ">", "1", ":", "observations", "=", "lag_observations", "(", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
init_discrete_hmm
Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arrays of length T_i with observation data nstates : int The number of states. lag : int Lag time at which the observations should be counted. reversi...
bhmm/api.py
def init_discrete_hmm(observations, nstates, lag=1, reversible=True, stationary=True, regularize=True, method='connect-spectral', separate=None): """Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arr...
def init_discrete_hmm(observations, nstates, lag=1, reversible=True, stationary=True, regularize=True, method='connect-spectral', separate=None): """Use a heuristic scheme to generate an initial model. Parameters ---------- observations : list of ndarray((T_i)) list of arr...
[ "Use", "a", "heuristic", "scheme", "to", "generate", "an", "initial", "model", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L231-L305
[ "def", "init_discrete_hmm", "(", "observations", ",", "nstates", ",", "lag", "=", "1", ",", "reversible", "=", "True", ",", "stationary", "=", "True", ",", "regularize", "=", "True", ",", "method", "=", "'connect-spectral'", ",", "separate", "=", "None", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
estimate_hmm
r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs Parameters ---------- observations : list of numpy arrays representing temporal data `observations[i]` is a 1d numpy array corresponding to the observed trajectory index `i` nstates : int The number ...
bhmm/api.py
def estimate_hmm(observations, nstates, lag=1, initial_model=None, output=None, reversible=True, stationary=False, p=None, accuracy=1e-3, maxit=1000, maxit_P=100000, mincount_connectivity=1e-2): r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs...
def estimate_hmm(observations, nstates, lag=1, initial_model=None, output=None, reversible=True, stationary=False, p=None, accuracy=1e-3, maxit=1000, maxit_P=100000, mincount_connectivity=1e-2): r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs...
[ "r", "Estimate", "maximum", "-", "likelihood", "HMM" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L309-L372
[ "def", "estimate_hmm", "(", "observations", ",", "nstates", ",", "lag", "=", "1", ",", "initial_model", "=", "None", ",", "output", "=", "None", ",", "reversible", "=", "True", ",", "stationary", "=", "False", ",", "p", "=", "None", ",", "accuracy", "=...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
bayesian_hmm
r""" Bayesian HMM based on sampling the posterior Generic maximum-likelihood estimation of HMMs Parameters ---------- observations : list of numpy arrays representing temporal data `observations[i]` is a 1d numpy array corresponding to the observed trajectory index `i` estimated_hmm : HMM ...
bhmm/api.py
def bayesian_hmm(observations, estimated_hmm, nsample=100, reversible=True, stationary=False, p0_prior='mixed', transition_matrix_prior='mixed', store_hidden=False, call_back=None): r""" Bayesian HMM based on sampling the posterior Generic maximum-likelihood estimation of HMMs Parameters ...
def bayesian_hmm(observations, estimated_hmm, nsample=100, reversible=True, stationary=False, p0_prior='mixed', transition_matrix_prior='mixed', store_hidden=False, call_back=None): r""" Bayesian HMM based on sampling the posterior Generic maximum-likelihood estimation of HMMs Parameters ...
[ "r", "Bayesian", "HMM", "based", "on", "sampling", "the", "posterior" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L375-L470
[ "def", "bayesian_hmm", "(", "observations", ",", "estimated_hmm", ",", "nsample", "=", "100", ",", "reversible", "=", "True", ",", "stationary", "=", "False", ",", "p0_prior", "=", "'mixed'", ",", "transition_matrix_prior", "=", "'mixed'", ",", "store_hidden", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
logsumexp
Computes the sum of arr assuming arr is in the log domain. Returns log(sum(exp(arr))) while minimizing the possibility of over/underflow. Examples -------- >>> import numpy as np >>> from sklearn.utils.extmath import logsumexp >>> a = np.arange(10) >>> np.log(np.sum(np.exp(a))) 9....
bhmm/_external/sklearn/utils.py
def logsumexp(arr, axis=0): """Computes the sum of arr assuming arr is in the log domain. Returns log(sum(exp(arr))) while minimizing the possibility of over/underflow. Examples -------- >>> import numpy as np >>> from sklearn.utils.extmath import logsumexp >>> a = np.arange(10) >...
def logsumexp(arr, axis=0): """Computes the sum of arr assuming arr is in the log domain. Returns log(sum(exp(arr))) while minimizing the possibility of over/underflow. Examples -------- >>> import numpy as np >>> from sklearn.utils.extmath import logsumexp >>> a = np.arange(10) >...
[ "Computes", "the", "sum", "of", "arr", "assuming", "arr", "is", "in", "the", "log", "domain", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/_external/sklearn/utils.py#L112-L135
[ "def", "logsumexp", "(", "arr", ",", "axis", "=", "0", ")", ":", "arr", "=", "np", ".", "rollaxis", "(", "arr", ",", "axis", ")", "# Use the max to normalize, as with the log this is what accumulates", "# the less errors", "vmax", "=", "arr", ".", "max", "(", ...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
_ensure_sparse_format
Convert a sparse matrix to a given format. Checks the sparse format of spmatrix and converts if necessary. Parameters ---------- spmatrix : scipy sparse matrix Input to validate and convert. accept_sparse : string, list of string or None (default=None) String[s] representing allow...
bhmm/_external/sklearn/utils.py
def _ensure_sparse_format(spmatrix, accept_sparse, dtype, order, copy, force_all_finite): """Convert a sparse matrix to a given format. Checks the sparse format of spmatrix and converts if necessary. Parameters ---------- spmatrix : scipy sparse matrix Input to va...
def _ensure_sparse_format(spmatrix, accept_sparse, dtype, order, copy, force_all_finite): """Convert a sparse matrix to a given format. Checks the sparse format of spmatrix and converts if necessary. Parameters ---------- spmatrix : scipy sparse matrix Input to va...
[ "Convert", "a", "sparse", "matrix", "to", "a", "given", "format", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/_external/sklearn/utils.py#L137-L199
[ "def", "_ensure_sparse_format", "(", "spmatrix", ",", "accept_sparse", ",", "dtype", ",", "order", ",", "copy", ",", "force_all_finite", ")", ":", "if", "accept_sparse", "is", "None", ":", "raise", "TypeError", "(", "'A sparse matrix was passed, but dense '", "'data...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
check_array
Input validation on an array, list, sparse matrix or similar. By default, the input is converted to an at least 2nd numpy array. If the dtype of the array is object, attempt converting to float, raising on failure. Parameters ---------- array : object Input object to check / convert. ...
bhmm/_external/sklearn/utils.py
def check_array(array, accept_sparse=None, dtype="numeric", order=None, copy=False, force_all_finite=True, ensure_2d=True, allow_nd=False, ensure_min_samples=1, ensure_min_features=1): """Input validation on an array, list, sparse matrix or similar. By default, the input is conv...
def check_array(array, accept_sparse=None, dtype="numeric", order=None, copy=False, force_all_finite=True, ensure_2d=True, allow_nd=False, ensure_min_samples=1, ensure_min_features=1): """Input validation on an array, list, sparse matrix or similar. By default, the input is conv...
[ "Input", "validation", "on", "an", "array", "list", "sparse", "matrix", "or", "similar", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/_external/sklearn/utils.py#L229-L329
[ "def", "check_array", "(", "array", ",", "accept_sparse", "=", "None", ",", "dtype", "=", "\"numeric\"", ",", "order", "=", "None", ",", "copy", "=", "False", ",", "force_all_finite", "=", "True", ",", "ensure_2d", "=", "True", ",", "allow_nd", "=", "Fal...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
beta_confidence_intervals
Compute confidence intervals of beta distributions. Parameters ---------- ci_X : numpy.array Computed confidence interval estimate from `ntrials` experiments ntrials : int The number of trials that were run. ci : float, optional, default=0.95 Confidence interval to report (e...
bhmm/util/analysis.py
def beta_confidence_intervals(ci_X, ntrials, ci=0.95): """ Compute confidence intervals of beta distributions. Parameters ---------- ci_X : numpy.array Computed confidence interval estimate from `ntrials` experiments ntrials : int The number of trials that were run. ci : flo...
def beta_confidence_intervals(ci_X, ntrials, ci=0.95): """ Compute confidence intervals of beta distributions. Parameters ---------- ci_X : numpy.array Computed confidence interval estimate from `ntrials` experiments ntrials : int The number of trials that were run. ci : flo...
[ "Compute", "confidence", "intervals", "of", "beta", "distributions", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/analysis.py#L23-L64
[ "def", "beta_confidence_intervals", "(", "ci_X", ",", "ntrials", ",", "ci", "=", "0.95", ")", ":", "# Compute low and high confidence interval for symmetric CI about mean.", "ci_low", "=", "0.5", "-", "ci", "/", "2", "ci_high", "=", "0.5", "+", "ci", "/", "2", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
empirical_confidence_interval
Compute specified symmetric confidence interval for empirical sample. Parameters ---------- sample : numpy.array The empirical samples. interval : float, optional, default=0.95 Size of desired symmetric confidence interval (0 < interval < 1) e.g. 0.68 for 68% confidence interval...
bhmm/util/analysis.py
def empirical_confidence_interval(sample, interval=0.95): """ Compute specified symmetric confidence interval for empirical sample. Parameters ---------- sample : numpy.array The empirical samples. interval : float, optional, default=0.95 Size of desired symmetric confidence int...
def empirical_confidence_interval(sample, interval=0.95): """ Compute specified symmetric confidence interval for empirical sample. Parameters ---------- sample : numpy.array The empirical samples. interval : float, optional, default=0.95 Size of desired symmetric confidence int...
[ "Compute", "specified", "symmetric", "confidence", "interval", "for", "empirical", "sample", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/analysis.py#L67-L110
[ "def", "empirical_confidence_interval", "(", "sample", ",", "interval", "=", "0.95", ")", ":", "# Sort sample in increasing order.", "sample", "=", "np", ".", "sort", "(", "sample", ")", "# Determine sample size.", "N", "=", "len", "(", "sample", ")", "# Compute l...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
generate_latex_table
Generate a LaTeX column-wide table showing various computed properties and uncertainties. Parameters ---------- conf : float confidence interval. Use 0.68 for 1 sigma, 0.95 for 2 sigma etc.
bhmm/util/analysis.py
def generate_latex_table(sampled_hmm, conf=0.95, dt=1, time_unit='ms', obs_name='force', obs_units='pN', caption='', outfile=None): """ Generate a LaTeX column-wide table showing various computed properties and uncertainties. Parameters ---------- conf : float confi...
def generate_latex_table(sampled_hmm, conf=0.95, dt=1, time_unit='ms', obs_name='force', obs_units='pN', caption='', outfile=None): """ Generate a LaTeX column-wide table showing various computed properties and uncertainties. Parameters ---------- conf : float confi...
[ "Generate", "a", "LaTeX", "column", "-", "wide", "table", "showing", "various", "computed", "properties", "and", "uncertainties", "." ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/analysis.py#L113-L236
[ "def", "generate_latex_table", "(", "sampled_hmm", ",", "conf", "=", "0.95", ",", "dt", "=", "1", ",", "time_unit", "=", "'ms'", ",", "obs_name", "=", "'force'", ",", "obs_units", "=", "'pN'", ",", "caption", "=", "''", ",", "outfile", "=", "None", ")"...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
confidence_interval
Computes the mean and alpha-confidence interval of the given sample set Parameters ---------- data : ndarray a 1D-array of samples alpha : float in [0,1] the confidence level, i.e. percentage of data included in the interval Returns ------- [m,l,r] where m is the me...
bhmm/util/statistics.py
def confidence_interval(data, alpha): """ Computes the mean and alpha-confidence interval of the given sample set Parameters ---------- data : ndarray a 1D-array of samples alpha : float in [0,1] the confidence level, i.e. percentage of data included in the interval ...
def confidence_interval(data, alpha): """ Computes the mean and alpha-confidence interval of the given sample set Parameters ---------- data : ndarray a 1D-array of samples alpha : float in [0,1] the confidence level, i.e. percentage of data included in the interval ...
[ "Computes", "the", "mean", "and", "alpha", "-", "confidence", "interval", "of", "the", "given", "sample", "set" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/statistics.py#L34-L75
[ "def", "confidence_interval", "(", "data", ",", "alpha", ")", ":", "if", "alpha", "<", "0", "or", "alpha", ">", "1", ":", "raise", "ValueError", "(", "'Not a meaningful confidence level: '", "+", "str", "(", "alpha", ")", ")", "# compute mean", "m", "=", "...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
confidence_interval_arr
r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first index is a sample index, the remaining indexes ar...
bhmm/util/statistics.py
def confidence_interval_arr(data, conf=0.95): r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first...
def confidence_interval_arr(data, conf=0.95): r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first...
[ "r", "Computes", "element", "-", "wise", "confidence", "intervals", "from", "a", "sample", "of", "ndarrays" ]
bhmm/bhmm
python
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/statistics.py#L108-L151
[ "def", "confidence_interval_arr", "(", "data", ",", "conf", "=", "0.95", ")", ":", "if", "conf", "<", "0", "or", "conf", ">", "1", ":", "raise", "ValueError", "(", "'Not a meaningful confidence level: '", "+", "str", "(", "conf", ")", ")", "# list or 1D-arra...
9804d18c2ddb684fb4d90b544cc209617a89ca9a
train
Connection.status
Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actions sent to the server. * the count of action...
umapi_client/connection.py
def status(self, remote=False): """ Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actio...
def status(self, remote=False): """ Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actio...
[ "Return", "the", "connection", "status", "both", "locally", "and", "remotely", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L164-L201
[ "def", "status", "(", "self", ",", "remote", "=", "False", ")", ":", "if", "remote", ":", "components", "=", "urlparse", ".", "urlparse", "(", "self", ".", "endpoint", ")", "try", ":", "result", "=", "self", ".", "session", ".", "get", "(", "componen...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection.query_single
Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL components :param query_params: optional dictionary of query options :return: the found object (a dictionary), which is em...
umapi_client/connection.py
def query_single(self, object_type, url_params, query_params=None): # type: (str, list, dict) -> dict """ Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL componen...
def query_single(self, object_type, url_params, query_params=None): # type: (str, list, dict) -> dict """ Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL componen...
[ "Query", "for", "a", "single", "object", ".", ":", "param", "object_type", ":", "string", "query", "type", "(", "e", ".", "g", ".", "users", "or", "groups", ")", ":", "param", "url_params", ":", "required", "list", "of", "strings", "to", "provide", "as...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L203-L235
[ "def", "query_single", "(", "self", ",", "object_type", ",", "url_params", ",", "query_params", "=", "None", ")", ":", "# type: (str, list, dict) -> dict", "# Server API convention (v2) is that the pluralized object type goes into the endpoint", "# but the object type is the key in t...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection.query_multiple
Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type: either "user" or "group") :param page: numeric page (0-based) of results to get (up to 200 in a page) :param url_params: optional lis...
umapi_client/connection.py
def query_multiple(self, object_type, page=0, url_params=None, query_params=None): # type: (str, int, list, dict) -> tuple """ Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type...
def query_multiple(self, object_type, page=0, url_params=None, query_params=None): # type: (str, int, list, dict) -> tuple """ Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type...
[ "Query", "for", "a", "page", "of", "objects", ".", "Defaults", "to", "the", "(", "0", "-", "based", ")", "first", "page", ".", "Sadly", "the", "sort", "order", "is", "undetermined", ".", ":", "param", "object_type", ":", "string", "constant", "query", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L237-L291
[ "def", "query_multiple", "(", "self", ",", "object_type", ",", "page", "=", "0", ",", "url_params", "=", "None", ",", "query_params", "=", "None", ")", ":", "# type: (str, int, list, dict) -> tuple", "# As of 2017-10-01, we are moving to to different URLs for user and user-...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection.execute_single
Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands sent earlier in this command's batch), specify a True value for the immed...
umapi_client/connection.py
def execute_single(self, action, immediate=False): """ Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands se...
def execute_single(self, action, immediate=False): """ Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands se...
[ "Execute", "a", "single", "action", "(", "containing", "commands", "on", "a", "single", "object", ")", ".", "Normally", "since", "actions", "are", "batched", "so", "as", "to", "be", "most", "efficient", "about", "execution", "but", "if", "you", "want", "th...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L293-L310
[ "def", "execute_single", "(", "self", ",", "action", ",", "immediate", "=", "False", ")", ":", "return", "self", ".", "execute_multiple", "(", "[", "action", "]", ",", "immediate", "=", "immediate", ")" ]
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection.execute_multiple
Execute multiple Actions (each containing commands on a single object). Normally, the actions are sent for execution immediately (possibly preceded by earlier queued commands), but if you are going for maximum efficiency you can set immeediate=False which will cause the connection to wait ...
umapi_client/connection.py
def execute_multiple(self, actions, immediate=True): """ Execute multiple Actions (each containing commands on a single object). Normally, the actions are sent for execution immediately (possibly preceded by earlier queued commands), but if you are going for maximum efficiency yo...
def execute_multiple(self, actions, immediate=True): """ Execute multiple Actions (each containing commands on a single object). Normally, the actions are sent for execution immediately (possibly preceded by earlier queued commands), but if you are going for maximum efficiency yo...
[ "Execute", "multiple", "Actions", "(", "each", "containing", "commands", "on", "a", "single", "object", ")", ".", "Normally", "the", "actions", "are", "sent", "for", "execution", "immediately", "(", "possibly", "preceded", "by", "earlier", "queued", "commands", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L319-L384
[ "def", "execute_multiple", "(", "self", ",", "actions", ",", "immediate", "=", "True", ")", ":", "# throttling part 1: split up each action into smaller actions, as needed", "# optionally split large lists of groups in add/remove commands (if action supports it)", "split_actions", "=",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection._execute_batch
Execute a single batch of Actions. For each action that has a problem, we annotate the action with the error information for that action, and we return the number of successful actions in the batch. :param actions: the list of Action objects to be executed :return: count of succe...
umapi_client/connection.py
def _execute_batch(self, actions): """ Execute a single batch of Actions. For each action that has a problem, we annotate the action with the error information for that action, and we return the number of successful actions in the batch. :param actions: the list of Action...
def _execute_batch(self, actions): """ Execute a single batch of Actions. For each action that has a problem, we annotate the action with the error information for that action, and we return the number of successful actions in the batch. :param actions: the list of Action...
[ "Execute", "a", "single", "batch", "of", "Actions", ".", "For", "each", "action", "that", "has", "a", "problem", "we", "annotate", "the", "action", "with", "the", "error", "information", "for", "that", "action", "and", "we", "return", "the", "number", "of"...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L386-L412
[ "def", "_execute_batch", "(", "self", ",", "actions", ")", ":", "wire_form", "=", "[", "a", ".", "wire_dict", "(", ")", "for", "a", "in", "actions", "]", "if", "self", ".", "test_mode", ":", "result", "=", "self", ".", "make_call", "(", "\"/action/%s?t...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Connection.make_call
Make a single UMAPI call with error handling and retry on temporary failure. :param path: the string endpoint path for the call :param body: (optional) list of dictionaries to be serialized into the request body :return: the requests.result object (on 200 response), raise error otherwise
umapi_client/connection.py
def make_call(self, path, body=None, delete=False): """ Make a single UMAPI call with error handling and retry on temporary failure. :param path: the string endpoint path for the call :param body: (optional) list of dictionaries to be serialized into the request body :return: the...
def make_call(self, path, body=None, delete=False): """ Make a single UMAPI call with error handling and retry on temporary failure. :param path: the string endpoint path for the call :param body: (optional) list of dictionaries to be serialized into the request body :return: the...
[ "Make", "a", "single", "UMAPI", "call", "with", "error", "handling", "and", "retry", "on", "temporary", "failure", ".", ":", "param", "path", ":", "the", "string", "endpoint", "path", "for", "the", "call", ":", "param", "body", ":", "(", "optional", ")",...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L414-L477
[ "def", "make_call", "(", "self", ",", "path", ",", "body", "=", "None", ",", "delete", "=", "False", ")", ":", "if", "body", ":", "request_body", "=", "json", ".", "dumps", "(", "body", ")", "def", "call", "(", ")", ":", "return", "self", ".", "s...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
paginate
Paginate through all results of a UMAPI query :param query: a query method from a UMAPI instance (callable as a function) :param org_id: the organization being queried :param max_pages: the max number of pages to collect before returning (default all) :param max_records: the max number of records to col...
umapi_client/legacy.py
def paginate(query, org_id, max_pages=maxsize, max_records=maxsize): """ Paginate through all results of a UMAPI query :param query: a query method from a UMAPI instance (callable as a function) :param org_id: the organization being queried :param max_pages: the max number of pages to collect before...
def paginate(query, org_id, max_pages=maxsize, max_records=maxsize): """ Paginate through all results of a UMAPI query :param query: a query method from a UMAPI instance (callable as a function) :param org_id: the organization being queried :param max_pages: the max number of pages to collect before...
[ "Paginate", "through", "all", "results", "of", "a", "UMAPI", "query", ":", "param", "query", ":", "a", "query", "method", "from", "a", "UMAPI", "instance", "(", "callable", "as", "a", "function", ")", ":", "param", "org_id", ":", "the", "organization", "...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L186-L211
[ "def", "paginate", "(", "query", ",", "org_id", ",", "max_pages", "=", "maxsize", ",", "max_records", "=", "maxsize", ")", ":", "page_count", "=", "0", "record_count", "=", "0", "records", "=", "[", "]", "while", "page_count", "<", "max_pages", "and", "r...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
make_call
Make a single UMAPI call with error handling and server-controlled throttling. (Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry) :param query: a query method from a UMAPI instance (callable as a function) :param org_id: the organization being queried :param pa...
umapi_client/legacy.py
def make_call(query, org_id, page): """ Make a single UMAPI call with error handling and server-controlled throttling. (Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry) :param query: a query method from a UMAPI instance (callable as a function) :param org_...
def make_call(query, org_id, page): """ Make a single UMAPI call with error handling and server-controlled throttling. (Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry) :param query: a query method from a UMAPI instance (callable as a function) :param org_...
[ "Make", "a", "single", "UMAPI", "call", "with", "error", "handling", "and", "server", "-", "controlled", "throttling", ".", "(", "Adapted", "from", "sample", "code", "at", "https", ":", "//", "www", ".", "adobe", ".", "io", "/", "products", "/", "userman...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L214-L257
[ "def", "make_call", "(", "query", ",", "org_id", ",", "page", ")", ":", "wait_time", "=", "0", "num_attempts", "=", "0", "while", "num_attempts", "<", "retry_max_attempts", ":", "if", "wait_time", ">", "0", ":", "sleep", "(", "wait_time", ")", "wait_time",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.do
Here for compatibility with legacy clients only - DO NOT USE!!! This is sort of mix of "append" and "insert": it puts commands in the list, with some half smarts about which commands go at the front or back. If you add multiple commands to the back in one call, they will get added sorted by comm...
umapi_client/legacy.py
def do(self, **kwargs): """ Here for compatibility with legacy clients only - DO NOT USE!!! This is sort of mix of "append" and "insert": it puts commands in the list, with some half smarts about which commands go at the front or back. If you add multiple commands to the back in ...
def do(self, **kwargs): """ Here for compatibility with legacy clients only - DO NOT USE!!! This is sort of mix of "append" and "insert": it puts commands in the list, with some half smarts about which commands go at the front or back. If you add multiple commands to the back in ...
[ "Here", "for", "compatibility", "with", "legacy", "clients", "only", "-", "DO", "NOT", "USE!!!", "This", "is", "sort", "of", "mix", "of", "append", "and", "insert", ":", "it", "puts", "commands", "in", "the", "list", "with", "some", "half", "smarts", "ab...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L62-L83
[ "def", "do", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# add \"create\" / \"add\" / \"removeFrom\" first", "for", "k", ",", "v", "in", "list", "(", "six", ".", "iteritems", "(", "kwargs", ")", ")", ":", "if", "k", ".", "startswith", "(", "\"create...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.split
Split this action into an equivalent list of actions, each of which have at most max_commands commands. :param max_commands: max number of commands allowed in any action :return: the list of commands created from this one
umapi_client/api.py
def split(self, max_commands): """ Split this action into an equivalent list of actions, each of which have at most max_commands commands. :param max_commands: max number of commands allowed in any action :return: the list of commands created from this one """ a_prior = A...
def split(self, max_commands): """ Split this action into an equivalent list of actions, each of which have at most max_commands commands. :param max_commands: max number of commands allowed in any action :return: the list of commands created from this one """ a_prior = A...
[ "Split", "this", "action", "into", "an", "equivalent", "list", "of", "actions", "each", "of", "which", "have", "at", "most", "max_commands", "commands", ".", ":", "param", "max_commands", ":", "max", "number", "of", "commands", "allowed", "in", "any", "actio...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L44-L58
[ "def", "split", "(", "self", ",", "max_commands", ")", ":", "a_prior", "=", "Action", "(", "*", "*", "self", ".", "frame", ")", "a_prior", ".", "commands", "=", "list", "(", "self", ".", "commands", ")", "self", ".", "split_actions", "=", "[", "a_pri...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.append
Add commands at the end of the sequence. Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match the order in which the args were specified. Thus, if you care about specific ordering, you must make multiple calls to append in that order. Luckily, append returns...
umapi_client/api.py
def append(self, **kwargs): """ Add commands at the end of the sequence. Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match the order in which the args were specified. Thus, if you care about specific ordering, you must make multiple calls t...
def append(self, **kwargs): """ Add commands at the end of the sequence. Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match the order in which the args were specified. Thus, if you care about specific ordering, you must make multiple calls t...
[ "Add", "commands", "at", "the", "end", "of", "the", "sequence", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L67-L81
[ "def", "append", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "kwargs", ")", ":", "self", ".", "commands", ".", "append", "(", "{", "k", ":", "v", "}", ")", "return", "self" ]
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.insert
Insert commands at the beginning of the sequence. This is provided because certain commands have to come first (such as user creation), but may be need to beadded after other commands have already been specified. Later calls to insert put their commands before those in the earlier calls...
umapi_client/api.py
def insert(self, **kwargs): """ Insert commands at the beginning of the sequence. This is provided because certain commands have to come first (such as user creation), but may be need to beadded after other commands have already been specified. Later calls to insert put ...
def insert(self, **kwargs): """ Insert commands at the beginning of the sequence. This is provided because certain commands have to come first (such as user creation), but may be need to beadded after other commands have already been specified. Later calls to insert put ...
[ "Insert", "commands", "at", "the", "beginning", "of", "the", "sequence", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L83-L100
[ "def", "insert", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "kwargs", ")", ":", "self", ".", "commands", ".", "insert", "(", "0", ",", "{", "k", ":", "v", "}", ")", "return", "sel...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.report_command_error
Report a server error executing a command. We keep track of the command's position in the command list, and we add annotation of what the command was, to the error. :param error_dict: The server's error dict for the error encountered
umapi_client/api.py
def report_command_error(self, error_dict): """ Report a server error executing a command. We keep track of the command's position in the command list, and we add annotation of what the command was, to the error. :param error_dict: The server's error dict for the error encounter...
def report_command_error(self, error_dict): """ Report a server error executing a command. We keep track of the command's position in the command list, and we add annotation of what the command was, to the error. :param error_dict: The server's error dict for the error encounter...
[ "Report", "a", "server", "error", "executing", "a", "command", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L102-L115
[ "def", "report_command_error", "(", "self", ",", "error_dict", ")", ":", "error", "=", "dict", "(", "error_dict", ")", "error", "[", "\"command\"", "]", "=", "self", ".", "commands", "[", "error_dict", "[", "\"step\"", "]", "]", "error", "[", "\"target\"",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.execution_errors
Return a list of commands that encountered execution errors, with the error. Each dictionary entry gives the command dictionary and the error dictionary :return: list of commands that gave errors, with their error information
umapi_client/api.py
def execution_errors(self): """ Return a list of commands that encountered execution errors, with the error. Each dictionary entry gives the command dictionary and the error dictionary :return: list of commands that gave errors, with their error information """ if self.s...
def execution_errors(self): """ Return a list of commands that encountered execution errors, with the error. Each dictionary entry gives the command dictionary and the error dictionary :return: list of commands that gave errors, with their error information """ if self.s...
[ "Return", "a", "list", "of", "commands", "that", "encountered", "execution", "errors", "with", "the", "error", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L117-L128
[ "def", "execution_errors", "(", "self", ")", ":", "if", "self", ".", "split_actions", ":", "# throttling split this action, get errors from the split", "return", "[", "dict", "(", "e", ")", "for", "s", "in", "self", ".", "split_actions", "for", "e", "in", "s", ...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
Action.maybe_split_groups
Check if group lists in add/remove directives should be split and split them if needed :param max_groups: Max group list size :return: True if at least one command was split, False if none were split
umapi_client/api.py
def maybe_split_groups(self, max_groups): """ Check if group lists in add/remove directives should be split and split them if needed :param max_groups: Max group list size :return: True if at least one command was split, False if none were split """ split_commands = [] ...
def maybe_split_groups(self, max_groups): """ Check if group lists in add/remove directives should be split and split them if needed :param max_groups: Max group list size :return: True if at least one command was split, False if none were split """ split_commands = [] ...
[ "Check", "if", "group", "lists", "in", "add", "/", "remove", "directives", "should", "be", "split", "and", "split", "them", "if", "needed", ":", "param", "max_groups", ":", "Max", "group", "list", "size", ":", "return", ":", "True", "if", "at", "least", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L130-L161
[ "def", "maybe_split_groups", "(", "self", ",", "max_groups", ")", ":", "split_commands", "=", "[", "]", "# return True if we split at least once", "maybe_split", "=", "False", "valid_step_keys", "=", "[", "'add'", ",", "'addRoles'", ",", "'remove'", "]", "for", "c...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
QueryMultiple.reload
Rerun the query (lazily). The results will contain any values on the server side that have changed since the last run. :return: None
umapi_client/api.py
def reload(self): """ Rerun the query (lazily). The results will contain any values on the server side that have changed since the last run. :return: None """ self._results = [] self._next_item_index = 0 self._next_page_index = 0 self._last_page_se...
def reload(self): """ Rerun the query (lazily). The results will contain any values on the server side that have changed since the last run. :return: None """ self._results = [] self._next_item_index = 0 self._next_page_index = 0 self._last_page_se...
[ "Rerun", "the", "query", "(", "lazily", ")", ".", "The", "results", "will", "contain", "any", "values", "on", "the", "server", "side", "that", "have", "changed", "since", "the", "last", "run", ".", ":", "return", ":", "None" ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L187-L196
[ "def", "reload", "(", "self", ")", ":", "self", ".", "_results", "=", "[", "]", "self", ".", "_next_item_index", "=", "0", "self", ".", "_next_page_index", "=", "0", "self", ".", "_last_page_seen", "=", "False" ]
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
QueryMultiple._next_page
Fetch the next page of the query.
umapi_client/api.py
def _next_page(self): """ Fetch the next page of the query. """ if self._last_page_seen: raise StopIteration new, self._last_page_seen = self.conn.query_multiple(self.object_type, self._next_page_index, self...
def _next_page(self): """ Fetch the next page of the query. """ if self._last_page_seen: raise StopIteration new, self._last_page_seen = self.conn.query_multiple(self.object_type, self._next_page_index, self...
[ "Fetch", "the", "next", "page", "of", "the", "query", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L198-L210
[ "def", "_next_page", "(", "self", ")", ":", "if", "self", ".", "_last_page_seen", ":", "raise", "StopIteration", "new", ",", "self", ".", "_last_page_seen", "=", "self", ".", "conn", ".", "query_multiple", "(", "self", ".", "object_type", ",", "self", ".",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
QueryMultiple.all_results
Eagerly fetch all the results. This can be called after already doing some amount of iteration, and it will return all the previously-iterated results as well as any results that weren't yet iterated. :return: a list of all the results.
umapi_client/api.py
def all_results(self): """ Eagerly fetch all the results. This can be called after already doing some amount of iteration, and it will return all the previously-iterated results as well as any results that weren't yet iterated. :return: a list of all the results. """ ...
def all_results(self): """ Eagerly fetch all the results. This can be called after already doing some amount of iteration, and it will return all the previously-iterated results as well as any results that weren't yet iterated. :return: a list of all the results. """ ...
[ "Eagerly", "fetch", "all", "the", "results", ".", "This", "can", "be", "called", "after", "already", "doing", "some", "amount", "of", "iteration", "and", "it", "will", "return", "all", "the", "previously", "-", "iterated", "results", "as", "well", "as", "a...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L241-L251
[ "def", "all_results", "(", "self", ")", ":", "while", "not", "self", ".", "_last_page_seen", ":", "self", ".", "_next_page", "(", ")", "self", ".", "_next_item_index", "=", "len", "(", "self", ".", "_results", ")", "return", "list", "(", "self", ".", "...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
QuerySingle._fetch_result
Fetch the queried object.
umapi_client/api.py
def _fetch_result(self): """ Fetch the queried object. """ self._result = self.conn.query_single(self.object_type, self.url_params, self.query_params)
def _fetch_result(self): """ Fetch the queried object. """ self._result = self.conn.query_single(self.object_type, self.url_params, self.query_params)
[ "Fetch", "the", "queried", "object", "." ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L282-L286
[ "def", "_fetch_result", "(", "self", ")", ":", "self", ".", "_result", "=", "self", ".", "conn", ".", "query_single", "(", "self", ".", "object_type", ",", "self", ".", "url_params", ",", "self", ".", "query_params", ")" ]
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.create
Create the user on the Adobe back end. See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because we retry create calls if they time out, the default conflict handling for creation is to ignore the create call if the user already exists (possibly from an earlier call...
umapi_client/functional.py
def create(self, first_name=None, last_name=None, country=None, email=None, on_conflict=IfAlreadyExistsOptions.ignoreIfAlreadyExists): """ Create the user on the Adobe back end. See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because we retr...
def create(self, first_name=None, last_name=None, country=None, email=None, on_conflict=IfAlreadyExistsOptions.ignoreIfAlreadyExists): """ Create the user on the Adobe back end. See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because we retr...
[ "Create", "the", "user", "on", "the", "Adobe", "back", "end", ".", "See", "[", "Issue", "32", "]", "(", "https", ":", "//", "github", ".", "com", "/", "adobe", "-", "apiplatform", "/", "umapi", "-", "client", ".", "py", "/", "issues", "/", "32", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L116-L156
[ "def", "create", "(", "self", ",", "first_name", "=", "None", ",", "last_name", "=", "None", ",", "country", "=", "None", ",", "email", "=", "None", ",", "on_conflict", "=", "IfAlreadyExistsOptions", ".", "ignoreIfAlreadyExists", ")", ":", "# first validate th...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.update
Update values on an existing user. See the API docs for what kinds of update are possible. :param email: new email for this user :param username: new username for this user :param first_name: new first name for this user :param last_name: new last name for this user :param count...
umapi_client/functional.py
def update(self, email=None, username=None, first_name=None, last_name=None, country=None): """ Update values on an existing user. See the API docs for what kinds of update are possible. :param email: new email for this user :param username: new username for this user :param fir...
def update(self, email=None, username=None, first_name=None, last_name=None, country=None): """ Update values on an existing user. See the API docs for what kinds of update are possible. :param email: new email for this user :param username: new username for this user :param fir...
[ "Update", "values", "on", "an", "existing", "user", ".", "See", "the", "API", "docs", "for", "what", "kinds", "of", "update", "are", "possible", ".", ":", "param", "email", ":", "new", "email", "for", "this", "user", ":", "param", "username", ":", "new...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L158-L180
[ "def", "update", "(", "self", ",", "email", "=", "None", ",", "username", "=", "None", ",", "first_name", "=", "None", ",", "last_name", "=", "None", ",", "country", "=", "None", ")", ":", "if", "username", "and", "self", ".", "id_type", "!=", "Ident...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.add_to_groups
Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect is simply to do an "add to organization Everybody group", so we let that be done. :param groups: list of group names the user should be added to :param all_groups: a boolean meaning add to all (don't specify...
umapi_client/functional.py
def add_to_groups(self, groups=None, all_groups=False, group_type=None): """ Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect is simply to do an "add to organization Everybody group", so we let that be done. :param groups: list of group names the u...
def add_to_groups(self, groups=None, all_groups=False, group_type=None): """ Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect is simply to do an "add to organization Everybody group", so we let that be done. :param groups: list of group names the u...
[ "Add", "user", "to", "some", "(", "typically", "PLC", ")", "groups", ".", "Note", "that", "if", "you", "add", "to", "no", "groups", "the", "effect", "is", "simply", "to", "do", "an", "add", "to", "organization", "Everybody", "group", "so", "we", "let",...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L182-L205
[ "def", "add_to_groups", "(", "self", ",", "groups", "=", "None", ",", "all_groups", "=", "False", ",", "group_type", "=", "None", ")", ":", "if", "all_groups", ":", "if", "groups", "or", "group_type", ":", "raise", "ArgumentError", "(", "\"When adding to all...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.remove_from_groups
Remove user from some PLC groups, or all of them. :param groups: list of group names the user should be removed from :param all_groups: a boolean meaning remove from all (don't specify groups or group_type in this case) :param group_type: the type of group (defaults to "product") :return...
umapi_client/functional.py
def remove_from_groups(self, groups=None, all_groups=False, group_type=None): """ Remove user from some PLC groups, or all of them. :param groups: list of group names the user should be removed from :param all_groups: a boolean meaning remove from all (don't specify groups or group_type ...
def remove_from_groups(self, groups=None, all_groups=False, group_type=None): """ Remove user from some PLC groups, or all of them. :param groups: list of group names the user should be removed from :param all_groups: a boolean meaning remove from all (don't specify groups or group_type ...
[ "Remove", "user", "from", "some", "PLC", "groups", "or", "all", "of", "them", ".", ":", "param", "groups", ":", "list", "of", "group", "names", "the", "user", "should", "be", "removed", "from", ":", "param", "all_groups", ":", "a", "boolean", "meaning", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L207-L229
[ "def", "remove_from_groups", "(", "self", ",", "groups", "=", "None", ",", "all_groups", "=", "False", ",", "group_type", "=", "None", ")", ":", "if", "all_groups", ":", "if", "groups", "or", "group_type", ":", "raise", "ArgumentError", "(", "\"When removing...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.add_role
Make user have a role (typically PLC admin) with respect to some PLC groups. :param groups: list of group names the user should have this role for :param role_type: the role (defaults to "admin") :return: the User, so you can do User(...).add_role(...).add_to_groups(...)
umapi_client/functional.py
def add_role(self, groups=None, role_type=RoleTypes.admin): """ Make user have a role (typically PLC admin) with respect to some PLC groups. :param groups: list of group names the user should have this role for :param role_type: the role (defaults to "admin") :return: the User, s...
def add_role(self, groups=None, role_type=RoleTypes.admin): """ Make user have a role (typically PLC admin) with respect to some PLC groups. :param groups: list of group names the user should have this role for :param role_type: the role (defaults to "admin") :return: the User, s...
[ "Make", "user", "have", "a", "role", "(", "typically", "PLC", "admin", ")", "with", "respect", "to", "some", "PLC", "groups", ".", ":", "param", "groups", ":", "list", "of", "group", "names", "the", "user", "should", "have", "this", "role", "for", ":",...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L231-L245
[ "def", "add_role", "(", "self", ",", "groups", "=", "None", ",", "role_type", "=", "RoleTypes", ".", "admin", ")", ":", "if", "not", "groups", ":", "raise", "ArgumentError", "(", "\"You must specify groups to which to add the role for this user\"", ")", "if", "rol...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.remove_role
Remove user from a role (typically admin) of some groups. :param groups: list of group names the user should NOT have this role for :param role_type: the type of role (defaults to "admin") :return: the User, so you can do User(...).remove_role(...).remove_from_groups(...)
umapi_client/functional.py
def remove_role(self, groups=None, role_type=RoleTypes.admin): """ Remove user from a role (typically admin) of some groups. :param groups: list of group names the user should NOT have this role for :param role_type: the type of role (defaults to "admin") :return: the User, so yo...
def remove_role(self, groups=None, role_type=RoleTypes.admin): """ Remove user from a role (typically admin) of some groups. :param groups: list of group names the user should NOT have this role for :param role_type: the type of role (defaults to "admin") :return: the User, so yo...
[ "Remove", "user", "from", "a", "role", "(", "typically", "admin", ")", "of", "some", "groups", ".", ":", "param", "groups", ":", "list", "of", "group", "names", "the", "user", "should", "NOT", "have", "this", "role", "for", ":", "param", "role_type", "...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L247-L261
[ "def", "remove_role", "(", "self", ",", "groups", "=", "None", ",", "role_type", "=", "RoleTypes", ".", "admin", ")", ":", "if", "not", "groups", ":", "raise", "ArgumentError", "(", "\"You must specify groups from which to remove the role for this user\"", ")", "if"...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.remove_from_organization
Remove a user from the organization's list of visible users. Optionally also delete the account. Deleting the account can only be done if the organization owns the account's domain. :param delete_account: Whether to delete the account after removing from the organization (default false) :return...
umapi_client/functional.py
def remove_from_organization(self, delete_account=False): """ Remove a user from the organization's list of visible users. Optionally also delete the account. Deleting the account can only be done if the organization owns the account's domain. :param delete_account: Whether to delete th...
def remove_from_organization(self, delete_account=False): """ Remove a user from the organization's list of visible users. Optionally also delete the account. Deleting the account can only be done if the organization owns the account's domain. :param delete_account: Whether to delete th...
[ "Remove", "a", "user", "from", "the", "organization", "s", "list", "of", "visible", "users", ".", "Optionally", "also", "delete", "the", "account", ".", "Deleting", "the", "account", "can", "only", "be", "done", "if", "the", "organization", "owns", "the", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L263-L271
[ "def", "remove_from_organization", "(", "self", ",", "delete_account", "=", "False", ")", ":", "self", ".", "append", "(", "removeFromOrg", "=", "{", "\"deleteAccount\"", ":", "True", "if", "delete_account", "else", "False", "}", ")", "return", "None" ]
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserAction.delete_account
Delete a user's account. Deleting the user's account can only be done if the user's domain is controlled by the authorized organization, and removing the account will also remove the user from all organizations with access to that domain. :return: None, because you cannot follow this command wit...
umapi_client/functional.py
def delete_account(self): """ Delete a user's account. Deleting the user's account can only be done if the user's domain is controlled by the authorized organization, and removing the account will also remove the user from all organizations with access to that domain. :return: No...
def delete_account(self): """ Delete a user's account. Deleting the user's account can only be done if the user's domain is controlled by the authorized organization, and removing the account will also remove the user from all organizations with access to that domain. :return: No...
[ "Delete", "a", "user", "s", "account", ".", "Deleting", "the", "user", "s", "account", "can", "only", "be", "done", "if", "the", "user", "s", "domain", "is", "controlled", "by", "the", "authorized", "organization", "and", "removing", "the", "account", "wil...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L273-L283
[ "def", "delete_account", "(", "self", ")", ":", "if", "self", ".", "id_type", "==", "IdentityTypes", ".", "adobeID", ":", "raise", "ArgumentError", "(", "\"You cannot delete an Adobe ID account.\"", ")", "self", ".", "append", "(", "removeFromDomain", "=", "{", ...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserGroupAction._validate
Validates the group name Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid :param group_name: name of group
umapi_client/functional.py
def _validate(cls, group_name): """ Validates the group name Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid :param group_name: name of group """ if group_name and not cls._group_name_regex.match(group_name): r...
def _validate(cls, group_name): """ Validates the group name Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid :param group_name: name of group """ if group_name and not cls._group_name_regex.match(group_name): r...
[ "Validates", "the", "group", "name", "Input", "values", "must", "be", "strings", "(", "standard", "or", "unicode", ")", ".", "Throws", "ArgumentError", "if", "any", "input", "is", "invalid", ":", "param", "group_name", ":", "name", "of", "group" ]
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L329-L338
[ "def", "_validate", "(", "cls", ",", "group_name", ")", ":", "if", "group_name", "and", "not", "cls", ".", "_group_name_regex", ".", "match", "(", "group_name", ")", ":", "raise", "ArgumentError", "(", "\"'%s': Illegal group name\"", "%", "(", "group_name", ",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserGroupAction.add_to_products
Add user group to some product license configuration groups (PLCs), or all of them. :param products: list of product names the user should be added to :param all_products: a boolean meaning add to all (don't specify products in this case) :return: the Group, so you can do Group(...).add_to_produ...
umapi_client/functional.py
def add_to_products(self, products=None, all_products=False): """ Add user group to some product license configuration groups (PLCs), or all of them. :param products: list of product names the user should be added to :param all_products: a boolean meaning add to all (don't specify produc...
def add_to_products(self, products=None, all_products=False): """ Add user group to some product license configuration groups (PLCs), or all of them. :param products: list of product names the user should be added to :param all_products: a boolean meaning add to all (don't specify produc...
[ "Add", "user", "group", "to", "some", "product", "license", "configuration", "groups", "(", "PLCs", ")", "or", "all", "of", "them", ".", ":", "param", "products", ":", "list", "of", "product", "names", "the", "user", "should", "be", "added", "to", ":", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L350-L365
[ "def", "add_to_products", "(", "self", ",", "products", "=", "None", ",", "all_products", "=", "False", ")", ":", "if", "all_products", ":", "if", "products", ":", "raise", "ArgumentError", "(", "\"When adding to all products, do not specify specific products\"", ")",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserGroupAction.remove_from_products
Remove user group from some product license configuration groups (PLCs), or all of them. :param products: list of product names the user group should be removed from :param all_products: a boolean meaning remove from all (don't specify products in this case) :return: the Group, so you can do Gro...
umapi_client/functional.py
def remove_from_products(self, products=None, all_products=False): """ Remove user group from some product license configuration groups (PLCs), or all of them. :param products: list of product names the user group should be removed from :param all_products: a boolean meaning remove from ...
def remove_from_products(self, products=None, all_products=False): """ Remove user group from some product license configuration groups (PLCs), or all of them. :param products: list of product names the user group should be removed from :param all_products: a boolean meaning remove from ...
[ "Remove", "user", "group", "from", "some", "product", "license", "configuration", "groups", "(", "PLCs", ")", "or", "all", "of", "them", ".", ":", "param", "products", ":", "list", "of", "product", "names", "the", "user", "group", "should", "be", "removed"...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L367-L382
[ "def", "remove_from_products", "(", "self", ",", "products", "=", "None", ",", "all_products", "=", "False", ")", ":", "if", "all_products", ":", "if", "products", ":", "raise", "ArgumentError", "(", "\"When removing from all products, do not specify specific products\"...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserGroupAction.add_users
Add users (specified by email address) to this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to add to the group. :return: the Group, so you can do Group(...).add_users(...).add_to_products(...)
umapi_client/functional.py
def add_users(self, users=None): """ Add users (specified by email address) to this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to add to the group. :return: the Group, so you can ...
def add_users(self, users=None): """ Add users (specified by email address) to this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to add to the group. :return: the Group, so you can ...
[ "Add", "users", "(", "specified", "by", "email", "address", ")", "to", "this", "user", "group", ".", "In", "case", "of", "ambiguity", "(", "two", "users", "with", "same", "email", "address", ")", "the", "non", "-", "AdobeID", "user", "is", "preferred", ...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L384-L394
[ "def", "add_users", "(", "self", ",", "users", "=", "None", ")", ":", "if", "not", "users", ":", "raise", "ArgumentError", "(", "\"You must specify emails for users to add to the user group\"", ")", "ulist", "=", "{", "\"user\"", ":", "[", "user", "for", "user",...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
UserGroupAction.remove_users
Remove users (specified by email address) from this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to remove from the group. :return: the Group, so you can do Group(...).remove_users(...).add_to_prod...
umapi_client/functional.py
def remove_users(self, users=None): """ Remove users (specified by email address) from this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to remove from the group. :return: the Group...
def remove_users(self, users=None): """ Remove users (specified by email address) from this user group. In case of ambiguity (two users with same email address), the non-AdobeID user is preferred. :param users: list of emails for users to remove from the group. :return: the Group...
[ "Remove", "users", "(", "specified", "by", "email", "address", ")", "from", "this", "user", "group", ".", "In", "case", "of", "ambiguity", "(", "two", "users", "with", "same", "email", "address", ")", "the", "non", "-", "AdobeID", "user", "is", "preferre...
adobe-apiplatform/umapi-client.py
python
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L396-L406
[ "def", "remove_users", "(", "self", ",", "users", "=", "None", ")", ":", "if", "not", "users", ":", "raise", "ArgumentError", "(", "\"You must specify emails for users to remove from the user group\"", ")", "ulist", "=", "{", "\"user\"", ":", "[", "user", "for", ...
1c446d79643cc8615adaa23e12dce3ac5782cf76
train
transformer.scale2x
Scales using the AdvanceMAME Scale2X algorithm which does a 'jaggie-less' scale of bitmap graphics.
luma/emulator/render.py
def scale2x(self, surface): """ Scales using the AdvanceMAME Scale2X algorithm which does a 'jaggie-less' scale of bitmap graphics. """ assert(self._scale == 2) return self._pygame.transform.scale2x(surface)
def scale2x(self, surface): """ Scales using the AdvanceMAME Scale2X algorithm which does a 'jaggie-less' scale of bitmap graphics. """ assert(self._scale == 2) return self._pygame.transform.scale2x(surface)
[ "Scales", "using", "the", "AdvanceMAME", "Scale2X", "algorithm", "which", "does", "a", "jaggie", "-", "less", "scale", "of", "bitmap", "graphics", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L31-L37
[ "def", "scale2x", "(", "self", ",", "surface", ")", ":", "assert", "(", "self", ".", "_scale", "==", "2", ")", "return", "self", ".", "_pygame", ".", "transform", ".", "scale2x", "(", "surface", ")" ]
ca3db028b33d17cda9247ea5189873ff0408d013
train
transformer.smoothscale
Smooth scaling using MMX or SSE extensions if available
luma/emulator/render.py
def smoothscale(self, surface): """ Smooth scaling using MMX or SSE extensions if available """ return self._pygame.transform.smoothscale(surface, self._output_size)
def smoothscale(self, surface): """ Smooth scaling using MMX or SSE extensions if available """ return self._pygame.transform.smoothscale(surface, self._output_size)
[ "Smooth", "scaling", "using", "MMX", "or", "SSE", "extensions", "if", "available" ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L39-L43
[ "def", "smoothscale", "(", "self", ",", "surface", ")", ":", "return", "self", ".", "_pygame", ".", "transform", ".", "smoothscale", "(", "surface", ",", "self", ".", "_output_size", ")" ]
ca3db028b33d17cda9247ea5189873ff0408d013
train
transformer.identity
Fast scale operation that does not sample the results
luma/emulator/render.py
def identity(self, surface): """ Fast scale operation that does not sample the results """ return self._pygame.transform.scale(surface, self._output_size)
def identity(self, surface): """ Fast scale operation that does not sample the results """ return self._pygame.transform.scale(surface, self._output_size)
[ "Fast", "scale", "operation", "that", "does", "not", "sample", "the", "results" ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L45-L49
[ "def", "identity", "(", "self", ",", "surface", ")", ":", "return", "self", ".", "_pygame", ".", "transform", ".", "scale", "(", "surface", ",", "self", ".", "_output_size", ")" ]
ca3db028b33d17cda9247ea5189873ff0408d013
train
transformer.led_matrix
Transforms the input surface into an LED matrix (1 pixel = 1 LED)
luma/emulator/render.py
def led_matrix(self, surface): """ Transforms the input surface into an LED matrix (1 pixel = 1 LED) """ scale = self._led_on.get_width() w, h = self._input_size pix = self._pygame.PixelArray(surface) img = self._pygame.Surface((w * scale, h * scale)) for...
def led_matrix(self, surface): """ Transforms the input surface into an LED matrix (1 pixel = 1 LED) """ scale = self._led_on.get_width() w, h = self._input_size pix = self._pygame.PixelArray(surface) img = self._pygame.Surface((w * scale, h * scale)) for...
[ "Transforms", "the", "input", "surface", "into", "an", "LED", "matrix", "(", "1", "pixel", "=", "1", "LED", ")" ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L51-L65
[ "def", "led_matrix", "(", "self", ",", "surface", ")", ":", "scale", "=", "self", ".", "_led_on", ".", "get_width", "(", ")", "w", ",", "h", "=", "self", ".", "_input_size", "pix", "=", "self", ".", "_pygame", ".", "PixelArray", "(", "surface", ")", ...
ca3db028b33d17cda9247ea5189873ff0408d013
train
rgb2short
Converts RGB values to the nearest equivalent xterm-256 color.
luma/emulator/clut.py
def rgb2short(r, g, b): """ Converts RGB values to the nearest equivalent xterm-256 color. """ # Using list of snap points, convert RGB value to cube indexes r, g, b = [len(tuple(s for s in snaps if s < x)) for x in (r, g, b)] # Simple colorcube transform return (r * 36) + (g * 6) + b + 16
def rgb2short(r, g, b): """ Converts RGB values to the nearest equivalent xterm-256 color. """ # Using list of snap points, convert RGB value to cube indexes r, g, b = [len(tuple(s for s in snaps if s < x)) for x in (r, g, b)] # Simple colorcube transform return (r * 36) + (g * 6) + b + 16
[ "Converts", "RGB", "values", "to", "the", "nearest", "equivalent", "xterm", "-", "256", "color", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/clut.py#L14-L22
[ "def", "rgb2short", "(", "r", ",", "g", ",", "b", ")", ":", "# Using list of snap points, convert RGB value to cube indexes", "r", ",", "g", ",", "b", "=", "[", "len", "(", "tuple", "(", "s", "for", "s", "in", "snaps", "if", "s", "<", "x", ")", ")", ...
ca3db028b33d17cda9247ea5189873ff0408d013
train
emulator.to_surface
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`, transforming it according to the ``transform`` and ``scale`` constructor arguments.
luma/emulator/device.py
def to_surface(self, image, alpha=1.0): """ Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`, transforming it according to the ``transform`` and ``scale`` constructor arguments. """ assert(0.0 <= alpha <= 1.0) if alpha < 1.0: im = image.co...
def to_surface(self, image, alpha=1.0): """ Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`, transforming it according to the ``transform`` and ``scale`` constructor arguments. """ assert(0.0 <= alpha <= 1.0) if alpha < 1.0: im = image.co...
[ "Converts", "a", ":", "py", ":", "mod", ":", "PIL", ".", "Image", "into", "a", ":", "class", ":", "pygame", ".", "Surface", "transforming", "it", "according", "to", "the", "transform", "and", "scale", "constructor", "arguments", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L64-L84
[ "def", "to_surface", "(", "self", ",", "image", ",", "alpha", "=", "1.0", ")", ":", "assert", "(", "0.0", "<=", "alpha", "<=", "1.0", ")", "if", "alpha", "<", "1.0", ":", "im", "=", "image", ".", "convert", "(", "\"RGBA\"", ")", "black", "=", "Im...
ca3db028b33d17cda9247ea5189873ff0408d013
train
capture.display
Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file.
luma/emulator/device.py
def display(self, image): """ Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file. """ assert(image.size == self.size) self._last_image = image self._count += 1 filename = self._file_template.format(self._count) image = self.preprocess(image) ...
def display(self, image): """ Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file. """ assert(image.size == self.size) self._last_image = image self._count += 1 filename = self._file_template.format(self._count) image = self.preprocess(image) ...
[ "Takes", "a", ":", "py", ":", "mod", ":", "PIL", ".", "Image", "and", "dumps", "it", "to", "a", "numbered", "PNG", "file", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L100-L112
[ "def", "display", "(", "self", ",", "image", ")", ":", "assert", "(", "image", ".", "size", "==", "self", ".", "size", ")", "self", ".", "_last_image", "=", "image", "self", ".", "_count", "+=", "1", "filename", "=", "self", ".", "_file_template", "....
ca3db028b33d17cda9247ea5189873ff0408d013
train
gifanim.display
Takes an image, scales it according to the nominated transform, and stores it for later building into an animated GIF.
luma/emulator/device.py
def display(self, image): """ Takes an image, scales it according to the nominated transform, and stores it for later building into an animated GIF. """ assert(image.size == self.size) self._last_image = image image = self.preprocess(image) surface = self...
def display(self, image): """ Takes an image, scales it according to the nominated transform, and stores it for later building into an animated GIF. """ assert(image.size == self.size) self._last_image = image image = self.preprocess(image) surface = self...
[ "Takes", "an", "image", "scales", "it", "according", "to", "the", "nominated", "transform", "and", "stores", "it", "for", "later", "building", "into", "an", "animated", "GIF", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L134-L152
[ "def", "display", "(", "self", ",", "image", ")", ":", "assert", "(", "image", ".", "size", "==", "self", ".", "size", ")", "self", ".", "_last_image", "=", "image", "image", "=", "self", ".", "preprocess", "(", "image", ")", "surface", "=", "self", ...
ca3db028b33d17cda9247ea5189873ff0408d013
train
pygame.display
Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface.
luma/emulator/device.py
def display(self, image): """ Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface. """ assert(image.size == self.size) self._last_image = image image = self.preprocess(image) self._clock.tick(self._fps) self._pygame.event.pump() ...
def display(self, image): """ Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface. """ assert(image.size == self.size) self._last_image = image image = self.preprocess(image) self._clock.tick(self._fps) self._pygame.event.pump() ...
[ "Takes", "a", ":", "py", ":", "mod", ":", "PIL", ".", "Image", "and", "renders", "it", "to", "a", "pygame", "display", "surface", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L193-L212
[ "def", "display", "(", "self", ",", "image", ")", ":", "assert", "(", "image", ".", "size", "==", "self", ".", "size", ")", "self", ".", "_last_image", "=", "image", "image", "=", "self", ".", "preprocess", "(", "image", ")", "self", ".", "_clock", ...
ca3db028b33d17cda9247ea5189873ff0408d013
train
asciiart._char_density
Count the number of black pixels in a rendered character.
luma/emulator/device.py
def _char_density(self, c, font=ImageFont.load_default()): """ Count the number of black pixels in a rendered character. """ image = Image.new('1', font.getsize(c), color=255) draw = ImageDraw.Draw(image) draw.text((0, 0), c, fill="white", font=font) return collec...
def _char_density(self, c, font=ImageFont.load_default()): """ Count the number of black pixels in a rendered character. """ image = Image.new('1', font.getsize(c), color=255) draw = ImageDraw.Draw(image) draw.text((0, 0), c, fill="white", font=font) return collec...
[ "Count", "the", "number", "of", "black", "pixels", "in", "a", "rendered", "character", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L253-L260
[ "def", "_char_density", "(", "self", ",", "c", ",", "font", "=", "ImageFont", ".", "load_default", "(", ")", ")", ":", "image", "=", "Image", ".", "new", "(", "'1'", ",", "font", ".", "getsize", "(", "c", ")", ",", "color", "=", "255", ")", "draw...
ca3db028b33d17cda9247ea5189873ff0408d013
train
asciiart._generate_art
Return an iterator that produces the ascii art.
luma/emulator/device.py
def _generate_art(self, image, width, height): """ Return an iterator that produces the ascii art. """ # Characters aren't square, so scale the output by the aspect ratio of a charater height = int(height * self._char_width / float(self._char_height)) image = image.resize...
def _generate_art(self, image, width, height): """ Return an iterator that produces the ascii art. """ # Characters aren't square, so scale the output by the aspect ratio of a charater height = int(height * self._char_width / float(self._char_height)) image = image.resize...
[ "Return", "an", "iterator", "that", "produces", "the", "ascii", "art", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L262-L273
[ "def", "_generate_art", "(", "self", ",", "image", ",", "width", ",", "height", ")", ":", "# Characters aren't square, so scale the output by the aspect ratio of a charater", "height", "=", "int", "(", "height", "*", "self", ".", "_char_width", "/", "float", "(", "s...
ca3db028b33d17cda9247ea5189873ff0408d013
train
asciiart.display
Takes a :py:mod:`PIL.Image` and renders it to the current terminal as ASCII-art.
luma/emulator/device.py
def display(self, image): """ Takes a :py:mod:`PIL.Image` and renders it to the current terminal as ASCII-art. """ assert(image.size == self.size) self._last_image = image surface = self.to_surface(self.preprocess(image), alpha=self._contrast) rawbytes = ...
def display(self, image): """ Takes a :py:mod:`PIL.Image` and renders it to the current terminal as ASCII-art. """ assert(image.size == self.size) self._last_image = image surface = self.to_surface(self.preprocess(image), alpha=self._contrast) rawbytes = ...
[ "Takes", "a", ":", "py", ":", "mod", ":", "PIL", ".", "Image", "and", "renders", "it", "to", "the", "current", "terminal", "as", "ASCII", "-", "art", "." ]
rm-hull/luma.emulator
python
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L275-L300
[ "def", "display", "(", "self", ",", "image", ")", ":", "assert", "(", "image", ".", "size", "==", "self", ".", "size", ")", "self", ".", "_last_image", "=", "image", "surface", "=", "self", ".", "to_surface", "(", "self", ".", "preprocess", "(", "ima...
ca3db028b33d17cda9247ea5189873ff0408d013