Package oracle.pgx.api.mllib
Class UnsupervisedAnomalyDetectionGraphWiseModel
- java.lang.Object
-
- oracle.pgx.api.mllib.Model<ModelType>
-
- oracle.pgx.api.mllib.GraphWiseModel<UnsupervisedGraphWiseModelConfig,oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata,UnsupervisedGraphWiseModel>
-
- oracle.pgx.api.mllib.UnsupervisedGraphWiseModel
-
- oracle.pgx.api.mllib.UnsupervisedAnomalyDetectionGraphWiseModel
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,VertexAnomalyDetectionModel
public class UnsupervisedAnomalyDetectionGraphWiseModel extends UnsupervisedGraphWiseModel implements VertexAnomalyDetectionModel
Implementation ofVertexAnomalyDetectionModel
usingUnsupervisedGraphWiseModel
SeeUnsupervisedAnomalyDetectionGraphWiseModelBuilder
for documentation of the hyperparameters.- Since:
- 23.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class oracle.pgx.api.mllib.UnsupervisedGraphWiseModel
UnsupervisedGraphWiseModel.UnsupervisedGraphWiseInferenceType
-
Nested classes/interfaces inherited from interface oracle.pgx.api.mllib.VertexAnomalyDetectionModel
VertexAnomalyDetectionModel.AnomalyDetectionInferenceType
-
-
Field Summary
-
Fields inherited from class oracle.pgx.api.mllib.UnsupervisedGraphWiseModel
ALGORITHM_NAME
-
-
Constructor Summary
Constructors Constructor Description UnsupervisedAnomalyDetectionGraphWiseModel(UnsupervisedGraphWiseModel model)
UnsupervisedAnomalyDetectionGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata modelMetadata, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)
This constructor should never be used to get a model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <ID> PgxFrame
evaluateAnomalyLabels(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, java.lang.String vertexAnomalyPropertyName, java.lang.Object anomalyPropertyValue, float threshold)
<ID> PgxFuture<PgxFrame>
evaluateAnomalyLabelsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, java.lang.String vertexAnomalyPropertyName, java.lang.Object anomalyPropertyValue, float threshold)
Evaluates anomaly detection performance statistics for the specified vertices.<ID> java.lang.Double
findAnomalyThreshold(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float contaminationFactor)
Blocking version ofVertexAnomalyDetectionModel.findAnomalyThresholdAsync(PgxGraph, Iterable, float)
.<ID> PgxFuture<java.lang.Double>
findAnomalyThresholdAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float contaminationFactor)
Finds an appropriate anomaly threshold for labeling the input vertices as anomalies, respecting the proportion given by the contamination factor<ID> PgxFrame
inferAnomalyLabels(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float threshold)
Blocking version ofVertexAnomalyDetectionModel.inferAnomalyLabelsAsync(PgxGraph, Iterable, float)
.<ID> PgxFuture<PgxFrame>
inferAnomalyLabelsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float threshold)
Infers the anomaly labels for the specified vertices.<ID> PgxFrame
inferAnomalyScores(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)
Blocking version ofVertexAnomalyDetectionModel.inferAnomalyScoresAsync(PgxGraph, Iterable)
.<ID> PgxFuture<PgxFrame>
inferAnomalyScoresAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)
Infers the anomaly scores for the specified vertices.-
Methods inherited from class oracle.pgx.api.mllib.UnsupervisedGraphWiseModel
fitAsync, fitAsync, getEmbeddingConfig, getLossFunction, getTrainingLogAsync, gnnExplainer, inferEmbeddingsAsync, store, store, storeAsync, storeAsync
-
Methods inherited from class oracle.pgx.api.mllib.GraphWiseModel
destroy, destroyAsync, fit, fit, getBatchSize, getConfig, getConvLayerConfigs, getEdgeInputFeatureDim, getEdgeInputPropertyNames, getEmbeddingDim, getInputFeatureDim, getLearningRate, getNumEpochs, getSeed, getTrainingLog, getTrainingLoss, getVertexInputPropertyNames, inferEmbeddings, isFitted
-
-
-
-
Constructor Detail
-
UnsupervisedAnomalyDetectionGraphWiseModel
public UnsupervisedAnomalyDetectionGraphWiseModel(PgxSession session, oracle.pgx.api.internal.Core core, java.util.function.Supplier<java.lang.String> keystorePathSupplier, java.util.function.Supplier<char[]> keystorePasswordSupplier, oracle.pgx.api.internal.mllib.UnsupervisedGraphWiseModelMetadata modelMetadata, java.util.function.BiFunction<PgxSession,oracle.pgx.api.internal.Graph,PgxGraph> graphConstructor)
This constructor should never be used to get a model. UseUnsupervisedAnomalyDetectionGraphWiseModelBuilder
instead.- Parameters:
session
- PgxSession to which the model is connectedcore
- Core to which the model is connectedmodelMetadata
- Metadata concerning the different hyper-parameters of the GraphWise Model- Since:
- 23.2
-
UnsupervisedAnomalyDetectionGraphWiseModel
public UnsupervisedAnomalyDetectionGraphWiseModel(UnsupervisedGraphWiseModel model)
-
-
Method Detail
-
inferAnomalyScoresAsync
public <ID> PgxFuture<PgxFrame> inferAnomalyScoresAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)
Description copied from interface:VertexAnomalyDetectionModel
Infers the anomaly scores for the specified vertices.- Specified by:
inferAnomalyScoresAsync
in interfaceVertexAnomalyDetectionModel
- Parameters:
graph
- the input graphvertices
- the vertices to find anomaly scores for- Returns:
- PgxFrame containing the scores for each vertex.
-
inferAnomalyScores
public <ID> PgxFrame inferAnomalyScores(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices)
Description copied from interface:VertexAnomalyDetectionModel
Blocking version ofVertexAnomalyDetectionModel.inferAnomalyScoresAsync(PgxGraph, Iterable)
.- Specified by:
inferAnomalyScores
in interfaceVertexAnomalyDetectionModel
- Returns:
- PgxFrame containing the scores for each vertex.
-
inferAnomalyLabelsAsync
public <ID> PgxFuture<PgxFrame> inferAnomalyLabelsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float threshold)
Description copied from interface:VertexAnomalyDetectionModel
Infers the anomaly labels for the specified vertices.- Specified by:
inferAnomalyLabelsAsync
in interfaceVertexAnomalyDetectionModel
- Parameters:
graph
- the input graphvertices
- the vertices to produce labels tothreshold
- the decision threshold- Returns:
- PgxFrame containing the labels for each vertex.
-
inferAnomalyLabels
public <ID> PgxFrame inferAnomalyLabels(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float threshold)
Description copied from interface:VertexAnomalyDetectionModel
Blocking version ofVertexAnomalyDetectionModel.inferAnomalyLabelsAsync(PgxGraph, Iterable, float)
.- Specified by:
inferAnomalyLabels
in interfaceVertexAnomalyDetectionModel
- Returns:
- PgxFrame containing the labels for each vertex.
-
findAnomalyThresholdAsync
public <ID> PgxFuture<java.lang.Double> findAnomalyThresholdAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float contaminationFactor)
Description copied from interface:VertexAnomalyDetectionModel
Finds an appropriate anomaly threshold for labeling the input vertices as anomalies, respecting the proportion given by the contamination factor- Specified by:
findAnomalyThresholdAsync
in interfaceVertexAnomalyDetectionModel
- Parameters:
graph
- the input graphvertices
- the vertices used to find the thresholdcontaminationFactor
- the expected proportion of vertices that should be labeled as anomalies- Returns:
- the threshold
-
findAnomalyThreshold
public <ID> java.lang.Double findAnomalyThreshold(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, float contaminationFactor)
Description copied from interface:VertexAnomalyDetectionModel
Blocking version ofVertexAnomalyDetectionModel.findAnomalyThresholdAsync(PgxGraph, Iterable, float)
.- Specified by:
findAnomalyThreshold
in interfaceVertexAnomalyDetectionModel
- Returns:
- the threshold
-
evaluateAnomalyLabelsAsync
public <ID> PgxFuture<PgxFrame> evaluateAnomalyLabelsAsync(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, java.lang.String vertexAnomalyPropertyName, java.lang.Object anomalyPropertyValue, float threshold)
Description copied from interface:VertexAnomalyDetectionModel
Evaluates anomaly detection performance statistics for the specified vertices.- Specified by:
evaluateAnomalyLabelsAsync
in interfaceVertexAnomalyDetectionModel
- Parameters:
graph
- the input graphvertices
- the vertices to produce labels tovertexAnomalyPropertyName
- the name of the vertex containing the ground truth anomaly labelsanomalyPropertyValue
- the value representing anomalies in vertexAnomalyPropertyName propertythreshold
- the decision threshold- Returns:
- PgxFrame containing the evaluation results.
-
evaluateAnomalyLabels
public <ID> PgxFrame evaluateAnomalyLabels(PgxGraph graph, java.lang.Iterable<PgxVertex<ID>> vertices, java.lang.String vertexAnomalyPropertyName, java.lang.Object anomalyPropertyValue, float threshold)
Description copied from interface:VertexAnomalyDetectionModel
Blocking version ofVertexAnomalyDetectionModel.evaluateAnomalyLabelsAsync(PgxGraph, Iterable, String, Object, float)
.- Specified by:
evaluateAnomalyLabels
in interfaceVertexAnomalyDetectionModel
- Returns:
- PgxFrame containing the evaluation results.
-
-