File models.py
has 738 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
import random
import tensorflow as tf
import numpy as np
import logging
Function batch_to_model_data_format
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def batch_to_model_data_format(
batch: MaybeNestedBatchData,
data_signature: Dict[Text, Dict[Text, List[FeatureSignature]]],
) -> Dict[Text, Dict[Text, List[tf.Tensor]]]:
"""Convert input batch tensors into batch data format.
- 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 _check_if_sparse_feature_sizes_decreased
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _check_if_sparse_feature_sizes_decreased(
new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
) -> None:
"""Checks if the sizes of sparse features have decreased during fine-tuning.
- 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 _calculate_entity_loss
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _calculate_entity_loss(
Function load
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def load(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _prepare_ffnn_layer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _prepare_ffnn_layer(
Function _rasa_predict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _rasa_predict(
self, batch_in: Tuple[np.ndarray, ...]
) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]:
"""Custom prediction method that builds tf graph on the first call.
- 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 _sparse_feature_sizes_have_increased
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _sparse_feature_sizes_have_increased(
new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
) -> bool:
"""Checks if the sizes of sparse features have increased during fine-tuning.
- 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"