16.5.5 Applying Unsupervised EdgeWise for Partitioned Graphs

You can apply unsupervised edgewise on partitioned graphs, where you have different providers and different features.

opg4j> var model = analyst.unsupervisedEdgeWiseModelBuilder().
         setVertexInputPropertyNames("vertex_provider_features").
         setEdgeInputPropertyNames("edge_provider1_features", "edge_provider2_features").
         build()
UnsupervisedEdgeWiseModel model = analyst.unsupervisedEdgeWiseModelBuilder()
    .setVertexInputPropertyNames("vertex_provider_features")
    .setEdgeInputPropertyNames("edge_provider1_features", "edge_provider2_features")
    .build();
params = dict(vertex_input_property_names=["vertex_provider_features"],
              edge_input_property_names=["edge_provider1_features", "edge_provider2_features"])

model = analyst.unsupervised_edgewise_builder(**params)

You can select which providers you want to train or infer on:

opg4j> var model = analyst.unsupervisedEdgeWiseModelBuilder().
         setVertexInputPropertyNames("vertex_provider_features").
         setEdgeInputPropertyNames("edge_provider1_features", "edge_provider2_features").
         setTargetEdgeLabels("provider1").
         build()
UnsupervisedEdgeWiseModel model = analyst.unsupervisedEdgeWiseModelBuilder()
    .setVertexInputPropertyNames("vertex_provider_features")
    .setEdgeInputPropertyNames("edge_provider1_features", "edge_provider2_features")
    .setTargetEdgeLabels("provider1")
    .build();
params = dict(vertex_input_property_names=["vertex_provider_features"],
              edge_input_property_names=["edge_provider1_features", "edge_provider2_features"],
              target_edge_labels=["provider1"])

model = analyst.unsupervised_edgewise_builder(**params)

If you wish to control the flow of the embeddings at each graph convolutional layer of the underlying Graphwise model, then you can enable or disable the connections of interest. By default, all the connections are enabled.

opg4j> var convLayerConfig = analyst.graphWiseConvLayerConfigBuilder().
         setNumSampledNeighbors(25).
         useVertexToVertexConnection(true).
         useEdgeToVertexConnection(true).
         useEdgeToEdgeConnection(false).
         useVertexToEdgeConnection(false).
         build()
opg4j> var model = analyst.unsupervisedEdgeWiseModelBuilder().
         setVertexInputPropertyNames("vertex_provider1_features", "vertex_provider2_features").
         setEdgeInputPropertyNames("edge_provider_features").
         setTargetEdgeLabels("provider1").
         build()
GraphWiseConvLayerConfig convLayerConfig = analyst.graphWiseConvLayerConfigBuilder()
    .setNumSampledNeighbors(10)
    .useVertexToVertexConnection(true)
    .useEdgeToVertexConnection(true)
    .useEdgeToEdgeConnection(false)
    .useVertexToEdgeConnection(false)
    .build();

UnsupervisedEdgeWiseModel model = analyst.unsupervisedEdgeWiseModelBuilder()
    .setVertexInputPropertyNames("vertex_provider1_features", "vertex_provider2_features")
    .setEdgeInputPropertyNames("edge_provider_features")
    .setTargetEdgeLabels("provider1")
    .setConvLayerConfigs(convLayerConfig)
    .build();
conv_layer_config = dict(num_sampled_neighbors=25,
                         activation_fn='tanh',
                         weight_init_scheme='xavier',
                         neighbor_weight_property_name=weightProperty,
                         vertex_to_vertex_connection=True,
                         edge_to_vertex_connection=True,
                         vertex_to_edge_connection=False,
                         edge_to_edge_connection=False)

conv_layer = analyst.graphwise_conv_layer_config(**conv_layer_config)

params = dict(vertex_input_property_names=["vertex_provider1_features", "vertex_provider2_features"],
              edge_input_property_names=["edge_provider_features"],
              target_edge_labels=["provider1"],
              conv_layer_config=[conv_layer])

model = analyst.unsupervised_edgewise_builder(**params)