Showing 2,238 of 2,238 total issues
File model_trainers.py
has 453 lines of code (exceeds 400 allowed). Consider refactoring. Open
import copy
import datetime
import importlib
import verboselogs, logging
Function evaluate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(
self, predictions_proba, matrix_store, model_id, protected_df=None, subset=None
):
"""Evaluate a model based on predictions, and save the results
- 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
ModelGroupEvaluator
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class ModelGroupEvaluator:
'''
ModelGroup class calls the model group metadata from the database
and hold metadata features on each of the class attibutes.
This class will contain any information about the model_group, and
Function plot_cats
has 24 arguments (exceeds 5 allowed). Consider refactoring. Open
def plot_cats(
MatrixStore
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class MatrixStore:
"""Base class for classes that allow access of a matrix and its metadata.
Subclasses should be scoped to a storage format (e.g. CSV)
and implement the _load, save, and head_of_matrix methods for that storage format
Function populate_crosstabs_table
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def populate_crosstabs_table(
model_id,
as_of_date,
df,
thresholds=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 build_matrix
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def build_matrix(
self,
as_of_times,
label_name,
label_type,
- 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 _get_impute_select
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _get_impute_select(self, impute_cols, nonimpute_cols, partitionby=None):
imprules = self.get_imputation_rules()
# check if we're missing any columns relative to the full set and raise an
- 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 test_imputation_output
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def test_imputation_output(feat_list, exp_imp_cols, feat_table):
with testing.postgresql.Postgresql() as psql:
engine = sqlalchemy.create_engine(psql.url())
engine.execute("create table states (entity_id int, as_of_date date)")
- 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
Aggregation
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Aggregation:
def __init__(
self,
aggregates,
groups,
File selection_rules.py
has 413 lines of code (exceeds 400 allowed). Consider refactoring. Open
import inspect
import verboselogs, logging
logger = verboselogs.VerboseLogger(__name__)
from numpy import exp, log, average
Function validate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, conn):
"""
SpacetimeAggregations ensure that no intervals extend beyond the absolute
minimum time.
"""
- 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 test_ModelEvaluator_needs_evaluation_no_bias_audit
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def test_ModelEvaluator_needs_evaluation_no_bias_audit(db_engine_with_results_schema):
# TEST SETUP:
# create two models: one that has zero evaluations,
# one that has an evaluation for precision@100_abs
- 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 stitch_csvs
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stitch_csvs(self, features_queries, label_query, matrix_store, matrix_uuid):
"""
Get all features related this matrix_uuid as CSV files, as well as the labels.
Join all the csv elements columnwise and create the final matrix.
The last column is the label.
Function plot_jaccard_preds
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def plot_jaccard_preds(self,
param_type=None,
param=None,
model_subset=None,
temporal_comparison=False,
- 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 retrain
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def retrain(self, prediction_date):
"""Retrain a model by going back one split from prediction_date, so the as_of_date for training would be (prediction_date - training_label_timespan)
Args:
prediction_date(str)
Function generate_plans
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_plans(self, matrix_set_definitions, feature_dictionaries):
"""Create build tasks and update the matrix definitions with UUIDs
:param matrix_set_definitions: the temporal information needed to generate each matrix
:param feature_dictionaries: combinations of features to include in matrices
- 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 _final_model_group_args
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _final_model_group_args(self, class_path, parameters, matrix_metadata):
"""Generates model grouping arguments based on input.
Applies a set of default or custom grouping keys depending on the object's
configuration.
- 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 colname_aggregate_lookup
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def colname_aggregate_lookup(self):
"""A reverse lookup from column name to the source collate.Aggregate
Will error if the Aggregation contains duplicate column names
"""
- 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 test_model_trainer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_model_trainer(grid_config, default_model_trainer):
trainer = default_model_trainer
db_engine = trainer.db_engine
project_storage = trainer.model_storage_engine.project_storage
model_storage_engine = trainer.model_storage_engine