def test_odd_sth(): """Eigenvalue test for the ODD-STh kernel.""" odd_sth_kernel = OddSth(verbose=verbose, normalize=normalize) if verbose: print_kernel("ODD-STh", odd_sth_kernel, dataset_tr, dataset_te) else: positive_eig(odd_sth_kernel, dataset)
def test_odd_sth(): """Picklability test for the ODD-STh kernel [+ generic-wrapper].""" train, _ = generate_dataset(n_graphs=100, r_vertices=(10, 20), r_connectivity=(0.4, 0.8), r_weight_edges=(1, 1), n_graphs_test=40, random_state=rs, features=('nl', 4)) odd_sth_kernel = OddSth(verbose=verbose, normalize=normalize) gk = GraphKernel(kernel={"name": "odd_sth"}, verbose=verbose, normalize=normalize) odd_sth_kernel.fit(train) assert is_picklable(odd_sth_kernel) gk.fit(train) assert is_picklable(gk)
def test_odd_sth(): """Random input test for the ODD-STh kernel [+ generic-wrapper].""" train, test = generate_dataset(n_graphs=100, r_vertices=(10, 20), r_connectivity=(0.4, 0.8), r_weight_edges=(1, 1), n_graphs_test=40, random_state=rs, features=('nl', 4)) odd_sth_kernel = OddSth(verbose=verbose, normalize=normalize) gk = GraphKernel(kernel="ODD", verbose=verbose, normalize=normalize) try: odd_sth_kernel.fit_transform(train) odd_sth_kernel.transform(test) gk.fit_transform(train) gk.transform(test) assert True except Exception as exception: assert False, exception
"GK-GraphHopper": lambda: GraphHopper(normalize=NORMALIZING_GRAPH_KERNELS), "GK-PyramidMatch": lambda: PyramidMatch(normalize=NORMALIZING_GRAPH_KERNELS), # Error with PG "GK-LovaszTheta": lambda: LovaszTheta(normalize=NORMALIZING_GRAPH_KERNELS), "GK-SvmTheta": lambda: SvmTheta(normalize=NORMALIZING_GRAPH_KERNELS), "GK-Propagation": lambda: Propagation(normalize=NORMALIZING_GRAPH_KERNELS), "GK-PropagationA": lambda: PropagationAttr(normalize=NORMALIZING_GRAPH_KERNELS), "GK-MScLaplacian": lambda: MultiscaleLaplacian(normalize=NORMALIZING_GRAPH_KERNELS), "GK-OddSth": lambda: OddSth(normalize=NORMALIZING_GRAPH_KERNELS), "GK-SubgraphMatching": lambda: SubgraphMatching(normalize=NORMALIZING_GRAPH_KERNELS ), # taking too long } def test_prediction_on_Grakel_kernels(graphs: pd.DataFrame, y_column: str, cv_sets=None, ignore_kernels=None): if cv_sets is None: cv = 10 print("Using 10-fold cross validation...") else: cv = cv_sets