From 48b9cfd526f65fa50f30043a5fa65163dc1cfc55 Mon Sep 17 00:00:00 2001 From: Diego B Theuerkauf Date: Thu, 12 Dec 2024 19:01:35 +0100 Subject: [PATCH] Sort imports --- docs/source/conf.py | 4 +-- probinet/evaluation/likelihood.py | 6 ++-- probinet/evaluation/link_prediction.py | 4 +-- probinet/input/loader.py | 13 +++---- .../model_selection/acd_cross_validation.py | 5 +-- probinet/model_selection/cross_validation.py | 9 ++--- .../dyncrep_cross_validation.py | 4 +-- probinet/model_selection/masking.py | 2 +- .../model_selection/mtcov_cross_validation.py | 10 ++---- probinet/models/acd.py | 30 +++++----------- probinet/models/base.py | 8 ++--- probinet/models/crep.py | 18 ++++------ probinet/models/dyncrep.py | 23 ++++-------- probinet/models/jointcrep.py | 12 +++---- probinet/models/mtcov.py | 12 +++---- probinet/synthetic/anomaly.py | 2 +- probinet/synthetic/base.py | 6 ++-- probinet/synthetic/dynamic.py | 2 +- probinet/synthetic/multilayer.py | 4 +-- probinet/synthetic/reciprocity.py | 35 ++++++------------- probinet/types.py | 3 +- probinet/utils/tools.py | 2 +- tests/test_cv.py | 5 +-- tests/test_evaluate.py | 5 +-- tests/test_input.py | 2 ++ tests/test_link_prediction.py | 2 ++ tests/test_loader.py | 3 +- tests/test_preprocessing.py | 6 ++-- tests/test_synthetic.py | 7 ++-- tests/test_tools.py | 20 +++-------- tests/test_validation_ACD.py | 9 ++--- tests/test_validation_DynCRep.py | 4 +-- 32 files changed, 93 insertions(+), 184 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5b8fc41..46bf9d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,9 +25,7 @@ ) author = "Diego Baptista Theuerkauf" -from probinet.version import ( - __version__, -) # noqa: E402 # pylint: disable=wrong-import-position +from probinet.version import __version__ # noqa: E402 # pylint: disable=wrong-import-position version = __version__ diff --git a/probinet/evaluation/likelihood.py b/probinet/evaluation/likelihood.py index 88c1d3b..6a24f2d 100644 --- a/probinet/evaluation/likelihood.py +++ b/probinet/evaluation/likelihood.py @@ -8,10 +8,8 @@ import pandas as pd from probinet.evaluation.expectation_computation import ( - compute_expected_adjacency_tensor, - compute_expected_adjacency_tensor_multilayer, - compute_mean_lambda0, -) + compute_expected_adjacency_tensor, compute_expected_adjacency_tensor_multilayer, + compute_mean_lambda0) from probinet.utils.tools import log_and_raise_error diff --git a/probinet/evaluation/link_prediction.py b/probinet/evaluation/link_prediction.py index 7efc33c..355fda8 100644 --- a/probinet/evaluation/link_prediction.py +++ b/probinet/evaluation/link_prediction.py @@ -8,9 +8,7 @@ import numpy as np from sklearn import metrics -from probinet.evaluation.expectation_computation import ( - compute_expected_adjacency_tensor_multilayer, -) +from probinet.evaluation.expectation_computation import compute_expected_adjacency_tensor_multilayer @singledispatch diff --git a/probinet/input/loader.py b/probinet/input/loader.py index d8533d2..b69bbce 100644 --- a/probinet/input/loader.py +++ b/probinet/input/loader.py @@ -2,8 +2,9 @@ Functions for handling the data. """ -import logging +import csv from importlib.resources import files +import logging from os import PathLike from pathlib import Path from typing import Any, Optional, Union @@ -11,16 +12,12 @@ import networkx as nx import numpy as np import pandas as pd -import csv - -from .preprocessing import ( - create_adjacency_tensor_from_graph_list, - create_sparse_adjacency_tensor_from_graph_list, -) -from .stats import print_graph_stats from ..models.classes import GraphData from ..utils.tools import log_and_raise_error +from .preprocessing import ( + create_adjacency_tensor_from_graph_list, create_sparse_adjacency_tensor_from_graph_list) +from .stats import print_graph_stats def build_adjacency_from_networkx( diff --git a/probinet/model_selection/acd_cross_validation.py b/probinet/model_selection/acd_cross_validation.py index 58c7339..96d3e72 100644 --- a/probinet/model_selection/acd_cross_validation.py +++ b/probinet/model_selection/acd_cross_validation.py @@ -7,10 +7,7 @@ import numpy as np -from probinet.evaluation.expectation_computation import ( - calculate_expectation_acd, - calculate_Q_dense, -) +from probinet.evaluation.expectation_computation import calculate_expectation_acd, calculate_Q_dense from ..evaluation.expectation_computation import compute_mean_lambda0 from ..evaluation.link_prediction import compute_link_prediction_AUC diff --git a/probinet/model_selection/cross_validation.py b/probinet/model_selection/cross_validation.py index d3176ca..7d73d02 100644 --- a/probinet/model_selection/cross_validation.py +++ b/probinet/model_selection/cross_validation.py @@ -18,16 +18,11 @@ import numpy as np from probinet.evaluation.expectation_computation import ( - calculate_conditional_expectation, - calculate_expectation, -) + calculate_conditional_expectation, calculate_expectation) from probinet.evaluation.likelihood import calculate_opt_func from probinet.evaluation.link_prediction import compute_link_prediction_AUC from probinet.input.loader import build_adjacency_from_file -from probinet.model_selection.masking import ( - extract_mask_kfold, - shuffle_indices_all_matrix, -) +from probinet.model_selection.masking import extract_mask_kfold, shuffle_indices_all_matrix from probinet.models.classes import GraphData diff --git a/probinet/model_selection/dyncrep_cross_validation.py b/probinet/model_selection/dyncrep_cross_validation.py index 4342dda..8db3ed3 100644 --- a/probinet/model_selection/dyncrep_cross_validation.py +++ b/probinet/model_selection/dyncrep_cross_validation.py @@ -8,9 +8,7 @@ import numpy as np -from probinet.evaluation.expectation_computation import ( - calculate_conditional_expectation_dyncrep, -) +from probinet.evaluation.expectation_computation import calculate_conditional_expectation_dyncrep from probinet.evaluation.likelihood import likelihood_conditional from probinet.evaluation.link_prediction import compute_link_prediction_AUC from probinet.model_selection.cross_validation import CrossValidation diff --git a/probinet/model_selection/masking.py b/probinet/model_selection/masking.py index 90cd62e..2e55749 100644 --- a/probinet/model_selection/masking.py +++ b/probinet/model_selection/masking.py @@ -2,7 +2,7 @@ This module provides functions for shuffling indices and extracting masks for selecting the held-out set in the adjacency tensor and design matrix. """ -from typing import List, Tuple, Sequence +from typing import List, Sequence, Tuple import numpy as np diff --git a/probinet/model_selection/mtcov_cross_validation.py b/probinet/model_selection/mtcov_cross_validation.py index f7bd25c..bb14aae 100644 --- a/probinet/model_selection/mtcov_cross_validation.py +++ b/probinet/model_selection/mtcov_cross_validation.py @@ -8,17 +8,11 @@ import numpy as np -from probinet.evaluation.expectation_computation import ( - compute_covariate_prediction_accuracy, -) +from probinet.evaluation.expectation_computation import compute_covariate_prediction_accuracy from probinet.evaluation.likelihood import loglikelihood from probinet.evaluation.link_prediction import compute_multilayer_link_prediction_AUC from probinet.model_selection.cross_validation import CrossValidation -from probinet.model_selection.masking import ( - extract_masks, - shuffle_indicesG, - shuffle_indicesX, -) +from probinet.model_selection.masking import extract_masks, shuffle_indicesG, shuffle_indicesX from probinet.models.classes import GraphData from probinet.models.mtcov import MTCOV diff --git a/probinet/models/acd.py b/probinet/models/acd.py index f7b236a..0ddae20 100644 --- a/probinet/models/acd.py +++ b/probinet/models/acd.py @@ -5,10 +5,10 @@ """ import logging -import time from os import PathLike from pathlib import Path -from typing import Any, List, Tuple, Optional +import time +from typing import Any, List, Optional, Tuple import numpy as np import pandas as pd @@ -16,27 +16,15 @@ from sparse import COO from probinet.evaluation.expectation_computation import ( - compute_mean_lambda0, - compute_mean_lambda0_nonzero, -) -from .base import ModelBase, ModelUpdateMixin -from .classes import GraphData -from .constants import EPS_, OUTPUT_FOLDER, BG_DEFAULT, K_DEFAULT, AG_DEFAULT + compute_mean_lambda0, compute_mean_lambda0_nonzero) + from ..input.preprocessing import preprocess_adjacency_tensor -from ..types import ( - GraphDataType, - MaskType, - EndFileType, - FilesType, - ArraySequence, - SubsNzType, -) -from ..utils.matrix_operations import ( - sp_uttkrp, - sp_uttkrp_assortative, - transpose_tensor, -) +from ..types import ArraySequence, EndFileType, FilesType, GraphDataType, MaskType, SubsNzType +from ..utils.matrix_operations import sp_uttkrp, sp_uttkrp_assortative, transpose_tensor from ..utils.tools import get_item_array_from_subs, log_and_raise_error +from .base import ModelBase, ModelUpdateMixin +from .classes import GraphData +from .constants import AG_DEFAULT, BG_DEFAULT, EPS_, K_DEFAULT, OUTPUT_FOLDER class AnomalyDetection(ModelBase, ModelUpdateMixin): diff --git a/probinet/models/base.py b/probinet/models/base.py index 5768de1..74e7c55 100644 --- a/probinet/models/base.py +++ b/probinet/models/base.py @@ -2,14 +2,14 @@ Base classes for the models classes. """ -import dataclasses -import logging -import os -import time from abc import ABC, abstractmethod from argparse import Namespace +import dataclasses from functools import singledispatchmethod +import logging +import os from pathlib import Path +import time from typing import Any, Dict, Optional, Tuple import numpy as np diff --git a/probinet/models/crep.py b/probinet/models/crep.py index af0b355..ac35dee 100644 --- a/probinet/models/crep.py +++ b/probinet/models/crep.py @@ -5,28 +5,22 @@ """ import logging -import time from pathlib import Path +import time from typing import Any, List, Optional, Tuple, Union -import numpy as np from numpy import dtype, ndarray +import numpy as np from sparse import COO -from .base import ModelBase, ModelUpdateMixin -from .classes import GraphData -from .constants import OUTPUT_FOLDER from ..evaluation.expectation_computation import compute_mean_lambda0 from ..input.preprocessing import preprocess_adjacency_tensor -from ..types import ( - GraphDataType, - MaskType, - EndFileType, - FilesType, - ArraySequence, -) +from ..types import ArraySequence, EndFileType, FilesType, GraphDataType, MaskType from ..utils.matrix_operations import sp_uttkrp, sp_uttkrp_assortative from ..utils.tools import get_item_array_from_subs, log_and_raise_error +from .base import ModelBase, ModelUpdateMixin +from .classes import GraphData +from .constants import OUTPUT_FOLDER class CRep(ModelBase, ModelUpdateMixin): diff --git a/probinet/models/dyncrep.py b/probinet/models/dyncrep.py index bec974c..a808c40 100644 --- a/probinet/models/dyncrep.py +++ b/probinet/models/dyncrep.py @@ -2,34 +2,25 @@ Class definition of DynCRep, the algorithm to perform inference in temporal networks :cite:`safdari2022reciprocity`. """ -import logging -import time from argparse import Namespace +import logging from pathlib import Path +import time from typing import Any, Dict, Optional, Tuple import numpy as np from scipy.optimize import brentq, root from sparse import COO -from .base import ModelBase, ModelUpdateMixin -from .classes import GraphData -from .constants import EPS_, OUTPUT_FOLDER from ..evaluation.expectation_computation import ( - compute_lagrange_multiplier, - compute_mean_lambda0, - u_with_lagrange_multiplier, -) + compute_lagrange_multiplier, compute_mean_lambda0, u_with_lagrange_multiplier) from ..input.preprocessing import preprocess_adjacency_tensor -from ..types import ( - GraphDataType, - MaskType, - EndFileType, - FilesType, - ArraySequence, -) +from ..types import ArraySequence, EndFileType, FilesType, GraphDataType, MaskType from ..utils.matrix_operations import sp_uttkrp, sp_uttkrp_assortative from ..utils.tools import get_item_array_from_subs, log_and_raise_error +from .base import ModelBase, ModelUpdateMixin +from .classes import GraphData +from .constants import EPS_, OUTPUT_FOLDER class DynCRep(ModelBase, ModelUpdateMixin): diff --git a/probinet/models/jointcrep.py b/probinet/models/jointcrep.py index e607994..122015f 100644 --- a/probinet/models/jointcrep.py +++ b/probinet/models/jointcrep.py @@ -5,20 +5,20 @@ """ import logging -import time from pathlib import Path -from typing import Any, Tuple, Union, Optional +import time +from typing import Any, Optional, Tuple, Union import numpy as np -from .base import ModelBase, ModelUpdateMixin -from .classes import GraphData -from .constants import OUTPUT_FOLDER, K_DEFAULT from ..evaluation.expectation_computation import compute_mean_lambda0 from ..input.preprocessing import preprocess_adjacency_tensor -from ..types import GraphDataType, EndFileType, FilesType +from ..types import EndFileType, FilesType, GraphDataType from ..utils.matrix_operations import sp_uttkrp, sp_uttkrp_assortative, transpose_tensor from ..utils.tools import check_symmetric, get_item_array_from_subs, log_and_raise_error +from .base import ModelBase, ModelUpdateMixin +from .classes import GraphData +from .constants import K_DEFAULT, OUTPUT_FOLDER class JointCRep(ModelBase, ModelUpdateMixin): diff --git a/probinet/models/mtcov.py b/probinet/models/mtcov.py index e921734..ac031c0 100644 --- a/probinet/models/mtcov.py +++ b/probinet/models/mtcov.py @@ -5,25 +5,25 @@ :cite:`contisciani2020community`. """ +from argparse import Namespace import logging +from pathlib import Path import sys import time -from argparse import Namespace -from pathlib import Path from typing import Any, Dict, List, Optional, Tuple import numpy as np import scipy.sparse from sparse import COO -from .base import ModelBase, ModelUpdateMixin -from .classes import GraphData -from .constants import OUTPUT_FOLDER from ..evaluation.expectation_computation import compute_mean_lambda0 from ..input.loader import build_adjacency_and_design_from_file from ..input.preprocessing import preprocess_adjacency_tensor, preprocess_data_matrix -from ..types import GraphDataType, EndFileType, FilesType, ArraySequence +from ..types import ArraySequence, EndFileType, FilesType, GraphDataType from ..utils.matrix_operations import sp_uttkrp, sp_uttkrp_assortative +from .base import ModelBase, ModelUpdateMixin +from .classes import GraphData +from .constants import OUTPUT_FOLDER MAX_BATCH_SIZE = 5000 RANDOM_SEED = 10 diff --git a/probinet/synthetic/anomaly.py b/probinet/synthetic/anomaly.py index 6b81520..074850b 100644 --- a/probinet/synthetic/anomaly.py +++ b/probinet/synthetic/anomaly.py @@ -13,7 +13,7 @@ from scipy.optimize import brentq from ..models.constants import OUTPUT_FOLDER -from ..synthetic.base import GraphProcessingMixin, affinity_matrix +from ..synthetic.base import affinity_matrix, GraphProcessingMixin from ..synthetic.dynamic import eq_c, membership_vectors from ..utils.tools import flt from ..visualization.plot import plot_M diff --git a/probinet/synthetic/base.py b/probinet/synthetic/base.py index fe06f01..f7b972c 100644 --- a/probinet/synthetic/base.py +++ b/probinet/synthetic/base.py @@ -3,17 +3,17 @@ """ from abc import ABCMeta +from enum import Enum import logging import math from os import PathLike -from enum import Enum from pathlib import Path -from typing import Tuple, Optional, Union +from typing import Optional, Tuple, Union -import pandas as pd from matplotlib import pyplot as plt import networkx as nx import numpy as np +import pandas as pd from probinet.visualization.plot import plot_A diff --git a/probinet/synthetic/dynamic.py b/probinet/synthetic/dynamic.py index 00ef441..f88e0e2 100644 --- a/probinet/synthetic/dynamic.py +++ b/probinet/synthetic/dynamic.py @@ -16,10 +16,10 @@ from scipy.sparse import coo_matrix from probinet.visualization.plot import plot_M -from .base import GraphProcessingMixin, affinity_matrix from ..models.constants import EPS_, OUTPUT_FOLDER from ..utils.matrix_operations import normalize_nonzero_membership +from .base import affinity_matrix, GraphProcessingMixin class SyntheticDynCRep(GraphProcessingMixin): diff --git a/probinet/synthetic/multilayer.py b/probinet/synthetic/multilayer.py index 9f130aa..e587a45 100644 --- a/probinet/synthetic/multilayer.py +++ b/probinet/synthetic/multilayer.py @@ -3,12 +3,12 @@ with one categorical attribute. Self-loops are removed and only the largest connected component is considered. """ -import logging from abc import ABCMeta +import logging import os -import warnings from pathlib import Path from typing import Optional +import warnings import matplotlib.pyplot as plt import networkx as nx diff --git a/probinet/synthetic/reciprocity.py b/probinet/synthetic/reciprocity.py index ab83ded..895ffec 100644 --- a/probinet/synthetic/reciprocity.py +++ b/probinet/synthetic/reciprocity.py @@ -3,43 +3,28 @@ It builds a directed, possibly weighted, network. """ +import logging import math -import sys - -import warnings from pathlib import Path - -from scipy.sparse import tril, triu - -from ..evaluation.expectation_computation import compute_mean_lambda0 -from ..input.stats import reciprocal_edges -from ..models.constants import OUTPUT_FOLDER -from ..utils.matrix_operations import ( - Exp_ija_matrix, - normalize_nonzero_membership, - transpose_matrix, - transpose_tensor, -) - - -import logging +import sys from typing import Optional, Tuple +import warnings import networkx as nx import numpy as np from scipy.optimize import brentq +from scipy.sparse import tril, triu from probinet.visualization.plot import plot_A -from ..input.stats import print_graph_stats +from ..evaluation.expectation_computation import compute_mean_lambda0 +from ..input.stats import print_graph_stats, reciprocal_edges +from ..models.constants import OUTPUT_FOLDER +from ..utils.matrix_operations import ( + Exp_ija_matrix, normalize_nonzero_membership, transpose_matrix, transpose_tensor) from ..utils.tools import check_symmetric, log_and_raise_error, output_adjacency from .base import ( - DEFAULT_ETA, - StandardMMSBM, - GraphProcessingMixin, - affinity_matrix, - BaseSyntheticNetwork, -) + affinity_matrix, BaseSyntheticNetwork, DEFAULT_ETA, GraphProcessingMixin, StandardMMSBM) if not sys.warnoptions: warnings.simplefilter("ignore") diff --git a/probinet/types.py b/probinet/types.py index e1682dd..09bec48 100644 --- a/probinet/types.py +++ b/probinet/types.py @@ -3,7 +3,8 @@ '""" from os import PathLike -from typing import Union, Sequence +from typing import Sequence, Union + import numpy as np from sparse import COO diff --git a/probinet/utils/tools.py b/probinet/utils/tools.py index f1d5022..675c9c1 100644 --- a/probinet/utils/tools.py +++ b/probinet/utils/tools.py @@ -12,7 +12,7 @@ import pandas as pd from sparse import COO -from ..models.constants import RTOL_DEFAULT, ATOL_DEFAULT +from ..models.constants import ATOL_DEFAULT, RTOL_DEFAULT from ..types import ArraySequence diff --git a/tests/test_cv.py b/tests/test_cv.py index dfa4d4b..2878742 100644 --- a/tests/test_cv.py +++ b/tests/test_cv.py @@ -6,10 +6,7 @@ import numpy as np -from probinet.model_selection.masking import ( - extract_mask_kfold, - shuffle_indices_all_matrix, -) +from probinet.model_selection.masking import extract_mask_kfold, shuffle_indices_all_matrix class TestCV(unittest.TestCase): diff --git a/tests/test_evaluate.py b/tests/test_evaluate.py index 96f3971..935be9a 100644 --- a/tests/test_evaluate.py +++ b/tests/test_evaluate.py @@ -7,10 +7,7 @@ import numpy as np from probinet.evaluation.expectation_computation import ( - calculate_conditional_expectation, - calculate_expectation, - compute_mean_lambda0, -) + calculate_conditional_expectation, calculate_expectation, compute_mean_lambda0) from probinet.evaluation.link_prediction import compute_link_prediction_AUC diff --git a/tests/test_input.py b/tests/test_input.py index bd95a19..03906e3 100644 --- a/tests/test_input.py +++ b/tests/test_input.py @@ -3,8 +3,10 @@ """ import networkx as nx + from probinet.input.loader import build_adjacency_from_networkx from probinet.models.classes import GraphData + from .fixtures import BaseTest diff --git a/tests/test_link_prediction.py b/tests/test_link_prediction.py index 689ebca..0bbc3e3 100644 --- a/tests/test_link_prediction.py +++ b/tests/test_link_prediction.py @@ -1,6 +1,8 @@ import unittest + import numpy as np from sklearn import metrics + from probinet.evaluation.link_prediction import calculate_f1_score diff --git a/tests/test_loader.py b/tests/test_loader.py index 9942164..6f86e2e 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -3,9 +3,10 @@ import networkx as nx import numpy as np +from probinet.input.loader import build_adjacency_from_file from probinet.models.classes import GraphData + from .fixtures import BaseTest -from probinet.input.loader import build_adjacency_from_file class TestBuildAdjacencyFromFile(BaseTest): diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index ed1d916..9ee3ca4 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -9,10 +9,8 @@ from sparse import COO from probinet.input.preprocessing import ( - create_adjacency_tensor_from_graph_list, - create_sparse_adjacency_tensor_from_graph_list, - preprocess_adjacency_tensor, -) + create_adjacency_tensor_from_graph_list, create_sparse_adjacency_tensor_from_graph_list, + preprocess_adjacency_tensor) from probinet.utils import tools diff --git a/tests/test_synthetic.py b/tests/test_synthetic.py index 1d57c31..28190e9 100644 --- a/tests/test_synthetic.py +++ b/tests/test_synthetic.py @@ -10,13 +10,10 @@ import yaml from probinet.synthetic.anomaly import SyntNetAnomaly -from probinet.synthetic.base import BaseSyntheticNetwork, affinity_matrix +from probinet.synthetic.base import affinity_matrix, BaseSyntheticNetwork from probinet.synthetic.dynamic import SyntheticDynCRep from probinet.synthetic.multilayer import SyntheticMTCOV -from probinet.synthetic.reciprocity import ( - GM_reciprocity, - ReciprocityMMSBM_joints, -) +from probinet.synthetic.reciprocity import GM_reciprocity, ReciprocityMMSBM_joints from .constants import RTOL diff --git a/tests/test_tools.py b/tests/test_tools.py index 2f325d9..87c46e1 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -12,23 +12,11 @@ from sparse import COO from probinet.utils.matrix_operations import ( - Exp_ija_matrix, - normalize_nonzero_membership, - sp_uttkrp, - sp_uttkrp_assortative, - transpose_matrix, - transpose_tensor, -) + Exp_ija_matrix, normalize_nonzero_membership, sp_uttkrp, sp_uttkrp_assortative, + transpose_matrix, transpose_tensor) from probinet.utils.tools import ( - build_edgelist, - can_cast_to_int, - get_item_array_from_subs, - is_sparse, - output_adjacency, - sptensor_from_dense_array, - write_adjacency, - write_design_matrix, -) + build_edgelist, can_cast_to_int, get_item_array_from_subs, is_sparse, output_adjacency, + sptensor_from_dense_array, write_adjacency, write_design_matrix) from .constants import DECIMAL, RTOL from .fixtures import BaseTest diff --git a/tests/test_validation_ACD.py b/tests/test_validation_ACD.py index b56ea51..4844f14 100644 --- a/tests/test_validation_ACD.py +++ b/tests/test_validation_ACD.py @@ -6,14 +6,9 @@ import yaml from probinet.evaluation.community_detection import ( - compute_community_detection_metric, - cosine_similarity, -) + compute_community_detection_metric, cosine_similarity) from probinet.input.loader import build_adjacency_from_file -from probinet.model_selection.masking import ( - extract_mask_kfold, - shuffle_indices_all_matrix, -) +from probinet.model_selection.masking import extract_mask_kfold, shuffle_indices_all_matrix from probinet.models.acd import AnomalyDetection from probinet.utils.matrix_operations import normalize_nonzero_membership diff --git a/tests/test_validation_DynCRep.py b/tests/test_validation_DynCRep.py index e3ddc3b..19bd681 100644 --- a/tests/test_validation_DynCRep.py +++ b/tests/test_validation_DynCRep.py @@ -6,9 +6,7 @@ import numpy as np import yaml -from probinet.evaluation.expectation_computation import ( - compute_expected_adjacency_tensor, -) +from probinet.evaluation.expectation_computation import compute_expected_adjacency_tensor from probinet.evaluation.link_prediction import compute_link_prediction_AUC from probinet.input.loader import build_adjacency_from_file from probinet.models.dyncrep import DynCRep