File sampling.py
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
from functools import partial
import warnings
import numpy as np
from scipy.stats import multivariate_normal
from sklearn.utils import check_random_state
Function _slice_one_sample
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _slice_one_sample(ptarget, x0, w, rs):
"""Slice sampling for one sample
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _rejection_sampling_2D
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _rejection_sampling_2D(n_samples, sigma, random_state=None,
return_acceptance_rate=False):
"""Rejection sampling algorithm for the 2D case.
Implementation of a rejection sampling algorithm. The implementation
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _slice_sampling
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _slice_sampling(ptarget, n_samples, x0, n_burnin=20, thin=10,
Function _sample_gaussian_spd_centered
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sample_gaussian_spd_centered(n_matrices, n_dim, sigma, random_state=None,
Function sample_gaussian_spd
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample_gaussian_spd(n_matrices, mean, sigma, random_state=None,
Function _sample_parameter_r
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sample_parameter_r(n_samples, n_dim, sigma,
Function generate_random_spd_matrix
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_random_spd_matrix(n_dim, random_state=None, *, mat_mean=.0,
Function _slice_sampling
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _slice_sampling(ptarget, n_samples, x0, n_burnin=20, thin=10,
random_state=None, n_jobs=1):
"""Slice sampling procedure.
Implementation of a slice sampling algorithm for sampling from any target
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"