File embedding_policy.py
has 1090 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
import copy
import json
import logging
import os
EmbeddingPolicy
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class EmbeddingPolicy(Policy):
"""Recurrent Embedding Dialogue Policy (REDP)
The policy that is used in our paper https://arxiv.org/abs/1811.11707
"""
Function __init__
has 24 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _train_tf
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _train_tf(self,
session_data: SessionData,
loss: tf.Tensor,
mask: tf.Tensor) -> None:
"""Train tf graph."""
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
featurizer: Optional[FullDialogueTrackerFeaturizer] = None,
priority: int = 1,
encoded_all_actions: Optional[np.ndarray] = None,
Function _create_attn_cell
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_attn_cell(self,
Function _create_tf_dial_embed
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_tf_dial_embed(
Function _create_attn_cell
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_attn_cell(self,
cell: tf.contrib.rnn.RNNCell,
embed_utter: tf.Tensor,
embed_prev_action: tf.Tensor,
real_length: tf.Tensor,
- 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 _tf_sim
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _tf_sim(self,
embed_dialogue: tf.Tensor,
embed_action: tf.Tensor,
mask: Optional[tf.Tensor]
) -> Tuple[tf.Tensor, tf.Tensor]:
- 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"