Showing 16 of 322 total issues
Function mask_test_edges
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def mask_test_edges(adj):
# Function to build test set with 10% positive links
# NOTE: Splits are randomized and results might slightly deviate from reported numbers in the paper.
# TODO: Clean up.
- 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 csv_to_npz.py
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Process the output of data-to-csv.sh to produce an npz file usable
by an2vec.
This script gets the mutual mention largest connected component of a
weighted edgelist, computes Word2Vec vectors, clusters them,
File scenarios-exploration-asymmetric-n_nodes=1000.py
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Explore the effect of overlap size in slicing embeddings for scenarios having different network-feature correlation
##
## Imports and setup
##
Function build_uid2tweets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def build_uid2tweets(args, uid2orig, orig2lcc):
"""Build the association of user ids to user tweets (split on words,
filtered for useless words)."""
# Prepare output variables
- 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 mask_test_edges
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mask_test_edges(adj):
# Function to build test set with 10% positive links
# NOTE: Splits are randomized and results might slightly deviate from reported numbers in the paper.
# TODO: Clean up.
Function build_user_features_lcc
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_user_features_lcc(uid2orig, orig2lcc, uid2tweets, word2cluster):
"""Build the COO matrix of user features, for users in
the mutual mention largest connected component."""
logging.info("Build user feature matrix from word/hashtag clustering")
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_dim, output_dim, adj, features_nonzero, dropout=0., act=tf.nn.relu, **kwargs):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, input_dim, output_dim, adj, dropout=0., act=tf.nn.relu, **kwargs):
Avoid deeply nested control flow statements. Open
for model_type in tqdm([MODEL_OVERLAP, MODEL_NOOVERLAP]):
if model_type == MODEL_OVERLAP:
dim_ξ_adj = dim_ξ_ov_adj
dim_ξ_v = dim_ξ_ov_v
q_overlap = ov
Function make_train_vae
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_train_vae(dims, q_overlap, p_ξ_slices, skey, with_progress=True):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, preds, labels, model, num_nodes, pos_weight, norm):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, placeholders, num_features, num_nodes, features_nonzero, **kwargs):
Function make_vae
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_vae(n_nodes, dims, q_overlap, p_ξ_slices):
Function train
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(model, A, labels, features, with_progress=True):
Function csv_to_adj
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def csv_to_adj(filepath):
"""Read a `weight,src,dst` csv file into a COO adjacency matrix.
Return the adjacency matrix in COO format, and the map of node ids in
the file to ids in the matrix.
- 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 load_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_files(name, clean):
# Load features
parts = {}
for part_name in DATASET_PARTS:
with open(INPATH + '/ind.{}.{}'.format(name, part_name), 'rb') as f:
- 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"