Class SupervisedGraphWiseModel

    • Constructor Detail

      • SupervisedGraphWiseModel

        public SupervisedGraphWiseModel​(PgxSession session,
                                        oracle.pgx.api.internal.Core core,
                                        java.util.function.Supplier<java.lang.String> keystorePathSupplier,
                                        java.util.function.Supplier<char[]> keystorePasswordSupplier,
                                        java.util.function.BiFunction<PgxSession,​oracle.pgx.api.internal.Graph,​PgxGraph> graphConstructor,
                                        oracle.pgx.api.internal.mllib.SupervisedGraphWiseModelMetadata modelMetadata)
        This constructor should never be used to get a model. Use SupervisedGraphWiseModelBuilder instead.
        Parameters:
        session - PgxSession to which the model is connected
        core - Core to which the model is connected
        graphConstructor - Constructor for a PgxGraph
        modelMetadata - Metadata concerning the different hyper-parameters of the GraphWise Model
        Since:
        19.4
      • SupervisedGraphWiseModel

        public SupervisedGraphWiseModel​(PgxSession session,
                                        oracle.pgx.api.internal.Core core,
                                        java.util.function.Supplier<java.lang.String> keystorePathSupplier,
                                        java.util.function.Supplier<char[]> keystorePasswordSupplier,
                                        java.util.function.BiFunction<PgxSession,​oracle.pgx.api.internal.Graph,​PgxGraph> graphConstructor,
                                        oracle.pgx.api.internal.mllib.ModelMetadata modelMetadata)
    • Method Detail

      • inferLogitsAsync

        public <ID> PgxFuture<PgxFrame> inferLogitsAsync​(PgxGraph graph,
                                                         java.lang.Iterable<PgxVertex<ID>> vertices)
        Infers the prediction logits for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce logits to
        Returns:
        PgxFrame containing the logits for each vertex.
        Since:
        19.4
      • inferLogits

        public <ID> PgxFrame inferLogits​(PgxGraph graph,
                                         java.lang.Iterable<PgxVertex<ID>> vertices)
        Blocking version of inferLogitsAsync(PgxGraph, Iterable). Infers the prediction logits for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce logits to
        Returns:
        PgxFrame containing the logits for each vertex.
        Since:
        19.4
      • inferLabelsAsync

        public <ID> PgxFuture<PgxFrame> inferLabelsAsync​(PgxGraph graph,
                                                         java.lang.Iterable<PgxVertex<ID>> vertices)
        Infers the labels for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce labels to
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        19.4
      • inferLabelsAsync

        public <ID> PgxFuture<PgxFrame> inferLabelsAsync​(PgxGraph graph,
                                                         java.lang.Iterable<PgxVertex<ID>> vertices,
                                                         float threshold)
        Infers the labels for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce labels to
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        21.4
      • evaluateLabelsAsync

        public <ID> PgxFuture<PgxFrame> evaluateLabelsAsync​(PgxGraph graph,
                                                            java.lang.Iterable<PgxVertex<ID>> vertices)
        Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        Returns:
        PgxFrame containing the metrics
        Since:
        19.4
      • evaluateLabelsAsync

        public <ID> PgxFuture<PgxFrame> evaluateLabelsAsync​(PgxGraph graph,
                                                            java.lang.Iterable<PgxVertex<ID>> vertices,
                                                            float threshold)
        Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        threshold - the decision threshold
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        21.4
      • inferLabels

        public <ID> PgxFrame inferLabels​(PgxGraph graph,
                                         java.lang.Iterable<PgxVertex<ID>> vertices)
        Blocking version of inferLabelsAsync(PgxGraph, Iterable). Infers the labels for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce labels to
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        19.4
      • inferLabels

        public <ID> PgxFrame inferLabels​(PgxGraph graph,
                                         java.lang.Iterable<PgxVertex<ID>> vertices,
                                         float threshold)
        Blocking version of inferLabelsAsync(PgxGraph, Iterable, float). Infers the labels for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to produce labels to
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        21.4
      • evaluateLabels

        public <ID> PgxFrame evaluateLabels​(PgxGraph graph,
                                            java.lang.Iterable<PgxVertex<ID>> vertices)
        Blocking version of evaluateLabelsAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        Returns:
        PgxFrame containing the metrics
        Since:
        19.4
      • evaluateLabels

        public <ID> PgxFrame evaluateLabels​(PgxGraph graph,
                                            java.lang.Iterable<PgxVertex<ID>> vertices,
                                            float threshold)
        Blocking version of evaluateLabelsAsync(PgxGraph, Iterable, float). Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the labels for each vertex.
        Since:
        21.4
      • inferAsync

        public <ID> PgxFuture<PgxFrame> inferAsync​(PgxGraph graph,
                                                   java.lang.Iterable<PgxVertex<ID>> vertices)
        Does inference for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to do inference on
        Returns:
        PgxFrame containing the inference results for each vertex.
        Since:
        23.1
      • inferAsync

        public <ID> PgxFuture<PgxFrame> inferAsync​(PgxGraph graph,
                                                   java.lang.Iterable<PgxVertex<ID>> vertices,
                                                   float threshold)
        Does inference for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to do inference on
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the inference results for each vertex.
        Since:
        23.1
      • evaluateAsync

        public <ID> PgxFuture<PgxFrame> evaluateAsync​(PgxGraph graph,
                                                      java.lang.Iterable<PgxVertex<ID>> vertices)
        Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        Returns:
        PgxFrame containing the scores for each vertex.
        Since:
        23.1
      • evaluateAsync

        public <ID> PgxFuture<PgxFrame> evaluateAsync​(PgxGraph graph,
                                                      java.lang.Iterable<PgxVertex<ID>> vertices,
                                                      float threshold)
        Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        threshold - decision threshold
        Returns:
        PgxFrame containing the scores for each vertex.
        Since:
        23.1
      • infer

        public <ID> PgxFrame infer​(PgxGraph graph,
                                   java.lang.Iterable<PgxVertex<ID>> vertices)
        Blocking version of inferAsync(PgxGraph, Iterable). Does inference for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to do inference on
        Returns:
        PgxFrame containing the inference results for each vertex.
        Since:
        23.1
      • infer

        public <ID> PgxFrame infer​(PgxGraph graph,
                                   java.lang.Iterable<PgxVertex<ID>> vertices,
                                   float threshold)
        Blocking version of inferAsync(PgxGraph, Iterable). Does inference for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to do inference on
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the inference results for each vertex.
        Since:
        23.1
      • evaluate

        public <ID> PgxFrame evaluate​(PgxGraph graph,
                                      java.lang.Iterable<PgxVertex<ID>> vertices)
        Blocking version of evaluateAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        Returns:
        PgxFrame containing the metrics
        Since:
        23.1
      • evaluate

        public <ID> PgxFrame evaluate​(PgxGraph graph,
                                      java.lang.Iterable<PgxVertex<ID>> vertices,
                                      float threshold)
        Blocking version of evaluateAsync(PgxGraph, Iterable). Evaluates (macro averaged) classification performance statistics for the specified vertices.
        Parameters:
        graph - the input graph
        vertices - the vertices to evaluate the model on
        threshold - decision threshold for classification (unused for regression)
        Returns:
        PgxFrame containing the metrics
        Since:
        23.1
      • storeAsync

        public PgxFuture<java.lang.Void> storeAsync​(java.lang.String path,
                                                    java.lang.String key)
                                             throws java.util.concurrent.ExecutionException,
                                                    java.lang.InterruptedException
        Stores the GraphWise model in the specified path, with encryption.
        Parameters:
        path - path to store the model
        key - the encryption key, or null if no encryption should be used.
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
        Since:
        19.4
      • storeAsync

        public PgxFuture<java.lang.Void> storeAsync​(java.lang.String path,
                                                    java.lang.String key,
                                                    boolean overwrite)
        Stores the GraphWise model in the specified path, with encryption.
        Parameters:
        path - path to store the model
        key - the encryption key, or null if no encryption should be used.
        Since:
        21.1
      • store

        public void store​(java.lang.String path,
                          java.lang.String key)
                   throws java.util.concurrent.ExecutionException,
                          java.lang.InterruptedException
        Blocking version of storeAsync(String, String). Calls storeAsync(String, String) and waits for the returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
        Since:
        19.4
      • store

        public void store​(java.lang.String path,
                          java.lang.String key,
                          boolean overwrite)
                   throws java.util.concurrent.ExecutionException,
                          java.lang.InterruptedException
        Blocking version of storeAsync(String, String). Calls storeAsync(String, String) and waits for the returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
        Since:
        21.1
      • getLossFunctionClass

        public LossFunction getLossFunctionClass()
        Gets the loss function
        Returns:
        loss function
        Since:
        21.4
      • getPredictionLayerConfigs

        public GraphWisePredictionLayerConfig[] getPredictionLayerConfigs()
        Gets the configuration objects for the prediction layers
        Returns:
        configurations
        Since:
        19.4
      • getClassWeights

        public java.util.Map<?,​java.lang.Float> getClassWeights()
        Gets the class weights
        Returns:
        class weights
        Since:
        19.4
      • getVertexTargetPropertyName

        public java.lang.String getVertexTargetPropertyName()
        Gets the target property name
        Returns:
        target property name
        Since:
        19.4
      • gnnExplainer

        public SupervisedGnnExplainer gnnExplainer()
        Get a GnnExplainer object that can explain this model's predictions.
        Returns:
        SupervisedGnnExplainer object
        Since:
        22.2
      • getTargetVertexLabels

        public java.util.List<java.util.Set<java.lang.String>> getTargetVertexLabels()
        Gets the target vertex labels
        Returns:
        target vertex labels
        Since:
        22.2