Showing 136 of 136 total issues
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, param: bopt.Hyperparameter, x: List[float],
Function create_slice_1d
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_slice_1d(i: int, experiment: bopt.Experiment, resolution: int,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, job: Optional[Job],
Function acq_for_dims
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def acq_for_dims(model, acq: AcquisitionFunction, x_slice, hyperparameters, ax,
Avoid deeply nested control flow statements. Open
if sample.result is not None:
print(sample.result)
Avoid deeply nested control flow statements. Open
if value > self._separator_tops[i]:
state += 1 + len(self._separators[i])
else:
state += np.digitize(value, self._separators[i])
states.append(self._first_tile_states + (t - 1) * self._rest_tiles_states + state)
Avoid deeply nested control flow statements. Open
if type in mapping:
cls, parser = mapping[type]
else:
logging.error("Invalid value {} for hyperparameter type, "
"only 'int', 'float', 'logscale_int', 'logscale_float' "
Avoid deeply nested control flow statements. Open
with open(fname, "r") as f:
contents = f.read().rstrip("\n")
found = False
for line in contents.split("\n"):
Avoid deeply nested control flow statements. Open
if i == j:
slices_1d.append(create_slice_1d(i, experiment,
resolution, n_dims, x_slice, model, sample, show_marginal))
elif i < j:
Avoid deeply nested control flow statements. Open
with open("meta.json", "w") as f_dst:
import yaml
import json
data = yaml.load(f_src, Loader=yaml.Loader)
Avoid deeply nested control flow statements. Open
if len(values) == 2:
low, high = values
buckets = -1
elif len(values) == 3:
low, high, buckets = values
Avoid deeply nested control flow statements. Open
if best_res is None or (sample.result and sample.result > best_res):
best_res = sample.result
best_sample = sample
except ValueError:
Avoid deeply nested control flow statements. Open
for h, v in best_sample.hyperparam_values.mapping.items():
if isinstance(v, float):
v = round(v, 2)
run_str += " --{}={}".format(h.name, v)
Avoid deeply nested control flow statements. Open
for v, h in zip(value, experiment.hyperparameters):
kernel_param_timeline["{}_{}".format(key, h.name)].append(v)
else:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, task_name: str, batch_name: Optional[str],
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name: str, type: Type[T], default: T, action: Optional[str], help: str):
Function run_main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_main(args):
parser = argparse.ArgumentParser(prog="bopt")
parser.set_defaults()
cd_parser = argparse.ArgumentParser(add_help=None)
- 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 gpy_regression
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def gpy_regression(hyperparameters: List[Hyperparameter],
gp_config: GPConfig, X_sample: np.ndarray,
Y_sample: np.ndarray) -> GPRegression:
kernel = GPyModel.create_kernel(gp_config.kernel, X_sample.shape[1], ARD=gp_config.ard)
- 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 propose_location
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def propose_location(acquisition_fn: acq.AcquisitionFunction, gp:
GPRegression, y_max: float, hyperparameters: List[Hyperparameter],
gp_config: GPConfig) -> np.ndarray:
def min_obj(X):
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(args) -> None:
with handle_cd_revertible(args.dir):
with ensure_meta_yml():
logging.info("Found existing meta.yml, resuming experiment.")
- 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"