def setup_class( cls, normalize_features=True, statistics_level="basic", n_node_features=0, timeout=10, ): """Initializes the class by adding descriptions for all features. Args: normalize_features (bool): normalise features by number of nodes and number of edges statistics_level (str): 'basic', 'advanced' - for features that provide distributions we must compute statistics. n_node_features (int): dimension of node features for feature constructors timeout (int): number of seconds before the calculation for a feature is cancelled Returns: (DataFrame): dataframe with feature information """ cls.normalize_features = normalize_features cls.statistics_level = statistics_level cls.n_node_features = n_node_features inst = cls(get_trivial_graph(n_node_features=n_node_features)) features = inst.get_features(all_features=True) feature_info = pd.DataFrame() for feature in features: feat_info = inst.get_feature_info(feature) feature_info[feature] = pd.Series(feat_info) # we set the timeout only for real computation for setup speed up cls.timeout = timeout return feature_info
def test_trivial_graph(): """test if the features are computable on trivial graph""" from hcga.utils import get_trivial_graph graph = get_trivial_graph() for feature_class in test_feature_classes: feature_inst = feature_class(graph) feature_inst.get_features()
def setup_class( cls, normalize_features=True, statistics_level="basic", n_node_features=0, timeout=10, ): """Initializes the class by adding descriptions for all features.""" cls.normalize_features = normalize_features cls.statistics_level = statistics_level cls.n_node_features = n_node_features cls.timeout = timeout inst = cls(get_trivial_graph(n_node_features=n_node_features)) features = inst.get_features(all_features=True) feature_info = pd.DataFrame() for feature in features: feat_info = inst.get_feature_info(feature) feature_info[feature] = pd.Series(feat_info) return feature_info