Learning - label propagation¶
Learning propagation is one of the simplest learning processes one can conduct on labeled networks. Py3plex offers off-the-shelf validation procedures for evaluating multiple variants of LP!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from py3plex.core import multinet
from py3plex.algorithms.network_classification import *
from py3plex.visualization.benchmark_visualizations import *
import scipy
import pandas as pd
multilayer_network = multinet.multi_layer_network().load_network("../datasets/cora.mat",directed=False, input_type="sparse")
## WARNING: sparse matrices are meant for efficiency. Many operations with standard px objects are hence not possible, e.g., basic_stats()...
## different heuristic-based target weights..
normalization_schemes = ["freq","basic","freq_amplify","exp"]
result_frames = []
for scheme in normalization_schemes:
result_frames.append(validate_label_propagation(multilayer_network.core_network,multilayer_network.labels,dataset_name="cora_classic",repetitions=5,normalization_scheme=scheme))
## results frame
validation_results = pd.DataFrame()
## construct a single dataframe
for x in result_frames:
validation_results = validation_results.append(x,ignore_index=True)
validation_results.reset_index()
## plot results
plot_core_macro(validation_results)
|