Showing 54 of 58 total issues
File actor_critic.py
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Tuple
import torch # noqa
import torch.nn as nn # noqa
from gym import spaces
Function evolve
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def evolve(self, population):
"""
Evolve the population of the network
Args:
- 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 train
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def train(self) -> List[float]:
"""
general training loop for classical RL
"""
timestep = 0
- 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 train
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def train(self) -> None:
"""Main training method"""
if self.load_weights is not None or self.load_hyperparams is not None:
self.load()
- 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 tune_A2C
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def tune_A2C(trial):
# Define hyperparameters that are relevant for training
# Choose a suggestion type and range (float/int and log/uniform)
lr_value = trial.suggest_float("lr_value", 1e-5, 1e-2, log=True)
lr_policy = trial.suggest_float("lr_policy", 1e-5, 1e-2, log=True)
- 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 evaluate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(self, render: bool = False) -> None:
"""Evaluate performance of Agent
Args:
render (bool): Option to render the environment during evaluation
- 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 objective
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def objective(trial):
lr_value = trial.suggest_float("lr_value", 1e-6, 1e-1, log=True)
lr_policy = trial.suggest_float("lr_policy", 1e-6, 1e-1, log=True)
replay_size = trial.suggest_int("replay_size", 1e2, 1e5, log=True)
max_ep_len = trial.suggest_int("max_ep_len", 1e3, 50000, log=True)
- 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 __init__
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
File vector_envs.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
import multiprocessing as mp
from abc import ABC, abstractmethod
from copy import deepcopy
from typing import Any, Iterator, List, Tuple
Function train
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def train(self) -> None:
"""Main training method"""
if self.load_weights is not None or self.load_hyperparams is not None:
self.load()
- 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 __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function run_experiment
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_experiment(args):
start_time = datetime.now
print(f"\nStarting experiment at {start_time():%d-%m-%y %H:%M:%S}\n")
results = {}
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function worker
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def worker(parent_conn: mp.Pipe, child_conn: mp.Pipe, env: gym.Env):
"""
Worker class to facilitate multiprocessing
:param parent_conn: Parent connection of Pipe
- 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"