Showing 77 of 265 total issues
File thresholds.py
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
def AUCP(**kwargs):
"""AUCP class for Area Under Curve Precentage thresholder.
Use the area under the curve to evaluate a non-parametric means
to threshold scores generated by the decision_scores where outliers
Function generate_data_clusters
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def generate_data_clusters(n_train=1000, n_test=500, n_clusters=2,
n_features=2, contamination=0.1, size='same',
density='same', dist=0.25, random_state=None,
return_in_clusters=False):
"""Utility function to generate synthesized data in clusters.
- 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
File dif.py
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""Deep Isolation Forest for Anomaly Detection (DIF)
"""
# Author: Hongzuo Xu <hongzuoxu@126.edu>
# License: BSD 2 clause
File kpca.py
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""Kernel Principal Component Analysis (KPCA) Outlier Detector
"""
# Author: Akira Tamamori <tamamori5917@gmail.com>
# License: BSD 2 clause
Function generate_data_categorical
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def generate_data_categorical(n_train=1000, n_test=500, n_features=2,
n_informative=2, n_category_in=2,
n_category_out=2, contamination=0.1,
shuffle=True, random_state=None):
"""Utility function to generate synthesized categorical data.
- 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
Consider simplifying this complex logical expression. Open
if (include_left and include_right) and (param < low or param > high):
raise ValueError(
'{param_name} is set to {param}. '
'Not in the range of [{low}, {high}].'.format(
param=param, low=low, high=high, param_name=param_name))
Function _calculate_outlier_scores
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_outlier_scores(X, bin_edges, hist, n_bins, alpha,
tol): # pragma: no cover
"""The internal function to calculate the outlier scores based on
the bins and histograms constructed with the training data. The program
is optimized through numba. It is excluded from coverage test for
- 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 decision_function
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def decision_function(self, X):
"""Predict raw anomaly score of X using the fitted detector.
The anomaly score of an input sample is computed based on different
detector algorithms. For consistency, outliers are assigned with
- 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_outlier_scores_auto
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_outlier_scores_auto(X, bin_edges, hist, alpha,
tol): # pragma: no cover
"""The internal function to calculate the outlier scores based on
the bins and histograms constructed with the training data. The program
is optimized through numba. It is excluded from coverage test for
- 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 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function scale_angles
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def scale_angles(gammas, scaler1=None, scaler2=None):
"""
Scale all angles in which angles <= 90
degree will be scaled within [0 - 54.7] and
angles > 90 will be scaled within [90 - 126]
- 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_model
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _build_model(self):
#### Decoder #####
dec_in = Input(shape=(self.latent_dim,), name='I1')
dec_1 = Dropout(self.dropout_rate)(dec_in)
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, c=None,
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, activation_hidden='tanh',
Function active_support_elastic_net
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def active_support_elastic_net(self, X, y, alpha, tau=1.0,
algorithm='lasso_lars', support_init='L2',
support_size=100, maxiter=40,
maxiter_lasso=1000):
"""
- 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_model
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _build_model(self):
#### Decoder #####
dec_in = Input(shape=(self.latent_dim,), name='I1')
dec_1 = Dropout(self.dropout_rate)(dec_in)
- 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 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, model_type="WEIGHT", n_neighbours=5, negative_sampling="MIXED",