8.3.3 高度なハイパーパラメータ・カスタマイズ

豊富なハイパーパラメータ・カスタマイズを使用して、頂点プロパティのみ、エッジ・プロパティのみまたは両方でUnsupervised GraphWiseモデルを作成できます。

これは、サブ構成クラスGraphWiseConvLayerConfigを使用して実装されます。

次のコードでは、Unsupervised GraphWiseモデルの構成の実装について説明します。

  1. 次のコードに示すように、Unsupervised GraphWiseモデルを作成します。
    JShellを使用したカスタマイズ済Unsupervised GraphWiseモデルの作成
    opg4j> var weightProperty = analyst.pagerank(trainGraph).getName();
    opg4j> var convLayerConfig = analyst.graphWiseConvLayerConfigBuilder().
                    setNumSampledNeighbors(25).
                    setActivationFunction(ActivationFunction.TANH).
                    setWeightInitScheme(WeightInitScheme.XAVIER).
                    setWeightedAggregationProperty(weightProperty).
                    build();
    
    opg4j> var model = analyst.unsupervisedGraphWiseModelBuilder().
                    setVertexInputPropertyNames("features").
                    setConvLayerConfigs(convLayerConfig).
                    build();
    Javaを使用したカスタマイズ済Unsupervised GraphWiseモデルの作成
    String weightProperty = analyst.pagerank(trainGraph).getName();
    GraphWiseConvLayerConfig convLayerConfig = analyst.graphWiseConvLayerConfigBuilder()
        .setNumSampledNeighbors(25)
        .setActivationFunction(ActivationFunction.TANH)
        .setWeightInitScheme(WeightInitScheme.XAVIER)
        .setWeightedAggregationProperty(weightProperty)
        .build();
    
    UnsupervisedGraphWiseModel model = analyst.unsupervisedGraphWiseModelBuilder()
        .setVertexInputPropertyNames("features")
        .setConvLayerConfigs(convLayerConfig)
        .build();
    
    Pythonを使用したカスタマイズ済Unsupervised GraphWiseモデルの作成
    weightProperty = analyst.pagerank(train_graph).name
    
    conv_layer_config = dict(num_sampled_neighbors=25,
                             activation_fn='TANH',
                             weight_init_scheme='XAVIER',
                             neighbor_weight_property_name=weightProperty)
    conv_layer = analyst.graphwise_conv_layer_config(**conv_layer_config)
    params = dict(conv_layer_config=[conv_layer],
                  vertex_input_property_names=["features"])
    
    model = analyst.unsupervised_graphwise_builder(**params)

    使用可能なすべてのハイパーパラメータとそのデフォルト値の詳細は、JavadocのUnsupervisedGraphWiseModelBuilderおよびGraphWiseConvLayerConfigBuilderを参照してください。