Showing 19 of 28 total issues
File model_trainers.py
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
from sklearn.model_selection import ParameterGrid
from sqlalchemy.orm import sessionmaker
import importlib
File evaluation.py
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy
from results_schema import Evaluation
from catwalk.utils import db_retry, sort_predictions_and_labels
from catwalk.metrics import *
from sqlalchemy.orm import sessionmaker
File storage.py
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
from .utils import upload_object_to_key, key_exists, model_cache_key, download_object
import os
import pickle
import pandas
import yaml
Function __init__
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, penalty='l2', dual=False, tol=1e-4, C=1.0,
Function _write_to_db
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _write_to_db(
self,
model_id,
matrix_store,
predictions,
- 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 _write_model_to_db
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _write_model_to_db(
Function evaluate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def evaluate(
Function _generate_evaluations
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_evaluations(
Function matrix_with_sorted_columns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def matrix_with_sorted_columns(self, columns):
columnset = set(self.columns())
desired_columnset = set(columns)
if columnset == desired_columnset:
if self.columns() != columns:
- 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 _entity_feature_values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _entity_feature_values(matrix, feature_name, as_of_date=None):
"""Finds the value of the given feature for each entity in a matrix
Args:
matrix (pandas.DataFrame), with index either 'entity_id' or 'entity_id'/'as_of_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
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _train_and_store_model
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _train_and_store_model(
Function process_train_task
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_train_task(
Function _write_to_db
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _write_to_db(
Function _write_to_db
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _write_to_db(
Function uniform_distribution
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def uniform_distribution(db_engine, model_id, as_of_date, test_matrix_store, n_ranks):
Function evaluate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(
self,
predictions_proba,
labels,
model_id,
- 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 _generate_evaluations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _generate_evaluations(
self,
metrics,
parameters,
threshold_config,
- 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 _write_model_to_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _write_model_to_db(
self,
class_path,
parameters,
feature_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"