Class UnsupervisedGnnExplainer

    • Method Detail

      • inferAndExplainAsync

        public <ID> PgxFuture<UnsupervisedGnnExplanation<ID>> inferAndExplainAsync​(PgxGraph graph,
                                                                                   PgxVertex<ID> vertex)
        Performs inference on the specified vertex and generates an explanation that contains scores of how important each property and each vertex in the computation graph is for the prediction.
        Parameters:
        graph - the input graph
        vertex - the vertex
        Returns:
        explanation containing feature importance and vertex importance.
        Since:
        22.2
      • inferAndExplain

        public <ID> UnsupervisedGnnExplanation<ID> inferAndExplain​(PgxGraph graph,
                                                                   PgxVertex<ID> vertex)
        Blocking version of inferAndExplainAsync(PgxGraph, PgxVertex). Performs inference on the specified vertex and generates an explanation that contains scores of how important each property and each vertex in the computation graph is for the prediction.
        Parameters:
        graph - the input graph
        vertex - the vertex
        Returns:
        explanation containing feature importance and vertex importance.
        Since:
        22.2
      • numClusters

        public int numClusters()
        Get the number of clusters used for the explainer loss.
        Returns:
        number of clusters
        Since:
        22.2
      • numSamples

        public int numSamples()
        Get the number of vertex samples used by the explainer.
        Returns:
        number of samples
        Since:
        22.2
      • numOptimizationSteps

        public UnsupervisedGnnExplainer numOptimizationSteps​(int numOptimizationSteps)
        Set the number of optimization steps for the explainer.
        Parameters:
        numOptimizationSteps - number of optimization steps
        Since:
        22.2
      • learningRate

        public UnsupervisedGnnExplainer learningRate​(double learningRate)
        Set the learning rate for the explainer.
        Parameters:
        learningRate - learning rate
        Since:
        22.2
      • marginalize

        public UnsupervisedGnnExplainer marginalize​(boolean marginalize)
        Set whether the explainer loss is marginalized over features. This can help in cases where there are important features that take values close to zero. Without marginalization the explainer can learn to mask such features out even if they are important, marginalization solves this by instead learning a mask for the deviation from the estimated input distribution.
        Parameters:
        marginalize - true if loss should be marginalized, false otherwise
        Since:
        22.2
      • numClusters

        public UnsupervisedGnnExplainer numClusters​(int numClusters)
        Set the number of clusters to use in the explainer loss. The unsupervised explainer uses k-means clustering to compute the explainer loss that is optimized. If the approximate number of components in the graph is known, it is a good idea to set the number of clusters to this number.
        Parameters:
        numClusters - number of clusters
        Since:
        22.2
      • numSamples

        public UnsupervisedGnnExplainer numSamples​(int numSamples)
        Set the number of vertex samples to use to optimize the explainer. For the sake of performance, the explainer computes the loss on this number of randomly sampled vertices. Using more samples will be more accurate but will take longer and use more resources.
        Parameters:
        numSamples - number of samples
        Since:
        22.2