com.azure.resourcemanager.machinelearning.models.DataDriftMonitoringSignal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-machinelearning Show documentation
Show all versions of azure-resourcemanager-machinelearning Show documentation
This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.machinelearning.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* The DataDriftMonitoringSignal model.
*/
@Fluent
public final class DataDriftMonitoringSignal extends MonitoringSignalBase {
/*
* [Required] Specifies the type of signal to monitor.
*/
private MonitoringSignalType signalType = MonitoringSignalType.DATA_DRIFT;
/*
* The feature filter which identifies which feature to calculate drift over.
*/
private MonitoringFeatureFilterBase features;
/*
* The settings for computing feature importance.
*/
private FeatureImportanceSettings featureImportanceSettings;
/*
* [Required] A list of metrics to calculate and their associated thresholds.
*/
private List metricThresholds;
/*
* [Required] The data which drift will be calculated for.
*/
private MonitoringInputDataBase productionData;
/*
* [Required] The data to calculate drift against.
*/
private MonitoringInputDataBase referenceData;
/*
* A dictionary that maps feature names to their respective data types.
*/
private Map featureDataTypeOverride;
/**
* Creates an instance of DataDriftMonitoringSignal class.
*/
public DataDriftMonitoringSignal() {
}
/**
* Get the signalType property: [Required] Specifies the type of signal to monitor.
*
* @return the signalType value.
*/
@Override
public MonitoringSignalType signalType() {
return this.signalType;
}
/**
* Get the features property: The feature filter which identifies which feature to calculate drift over.
*
* @return the features value.
*/
public MonitoringFeatureFilterBase features() {
return this.features;
}
/**
* Set the features property: The feature filter which identifies which feature to calculate drift over.
*
* @param features the features value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal withFeatures(MonitoringFeatureFilterBase features) {
this.features = features;
return this;
}
/**
* Get the featureImportanceSettings property: The settings for computing feature importance.
*
* @return the featureImportanceSettings value.
*/
public FeatureImportanceSettings featureImportanceSettings() {
return this.featureImportanceSettings;
}
/**
* Set the featureImportanceSettings property: The settings for computing feature importance.
*
* @param featureImportanceSettings the featureImportanceSettings value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal
withFeatureImportanceSettings(FeatureImportanceSettings featureImportanceSettings) {
this.featureImportanceSettings = featureImportanceSettings;
return this;
}
/**
* Get the metricThresholds property: [Required] A list of metrics to calculate and their associated thresholds.
*
* @return the metricThresholds value.
*/
public List metricThresholds() {
return this.metricThresholds;
}
/**
* Set the metricThresholds property: [Required] A list of metrics to calculate and their associated thresholds.
*
* @param metricThresholds the metricThresholds value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal withMetricThresholds(List metricThresholds) {
this.metricThresholds = metricThresholds;
return this;
}
/**
* Get the productionData property: [Required] The data which drift will be calculated for.
*
* @return the productionData value.
*/
public MonitoringInputDataBase productionData() {
return this.productionData;
}
/**
* Set the productionData property: [Required] The data which drift will be calculated for.
*
* @param productionData the productionData value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal withProductionData(MonitoringInputDataBase productionData) {
this.productionData = productionData;
return this;
}
/**
* Get the referenceData property: [Required] The data to calculate drift against.
*
* @return the referenceData value.
*/
public MonitoringInputDataBase referenceData() {
return this.referenceData;
}
/**
* Set the referenceData property: [Required] The data to calculate drift against.
*
* @param referenceData the referenceData value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal withReferenceData(MonitoringInputDataBase referenceData) {
this.referenceData = referenceData;
return this;
}
/**
* Get the featureDataTypeOverride property: A dictionary that maps feature names to their respective data types.
*
* @return the featureDataTypeOverride value.
*/
public Map featureDataTypeOverride() {
return this.featureDataTypeOverride;
}
/**
* Set the featureDataTypeOverride property: A dictionary that maps feature names to their respective data types.
*
* @param featureDataTypeOverride the featureDataTypeOverride value to set.
* @return the DataDriftMonitoringSignal object itself.
*/
public DataDriftMonitoringSignal
withFeatureDataTypeOverride(Map featureDataTypeOverride) {
this.featureDataTypeOverride = featureDataTypeOverride;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DataDriftMonitoringSignal withNotificationTypes(List notificationTypes) {
super.withNotificationTypes(notificationTypes);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DataDriftMonitoringSignal withProperties(Map properties) {
super.withProperties(properties);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
super.validate();
if (features() != null) {
features().validate();
}
if (featureImportanceSettings() != null) {
featureImportanceSettings().validate();
}
if (metricThresholds() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property metricThresholds in model DataDriftMonitoringSignal"));
} else {
metricThresholds().forEach(e -> e.validate());
}
if (productionData() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property productionData in model DataDriftMonitoringSignal"));
} else {
productionData().validate();
}
if (referenceData() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property referenceData in model DataDriftMonitoringSignal"));
} else {
referenceData().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(DataDriftMonitoringSignal.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("notificationTypes", notificationTypes(),
(writer, element) -> writer.writeString(element == null ? null : element.toString()));
jsonWriter.writeMapField("properties", properties(), (writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("metricThresholds", this.metricThresholds,
(writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("productionData", this.productionData);
jsonWriter.writeJsonField("referenceData", this.referenceData);
jsonWriter.writeStringField("signalType", this.signalType == null ? null : this.signalType.toString());
jsonWriter.writeJsonField("features", this.features);
jsonWriter.writeJsonField("featureImportanceSettings", this.featureImportanceSettings);
jsonWriter.writeMapField("featureDataTypeOverride", this.featureDataTypeOverride,
(writer, element) -> writer.writeString(element == null ? null : element.toString()));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DataDriftMonitoringSignal from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DataDriftMonitoringSignal if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the DataDriftMonitoringSignal.
*/
public static DataDriftMonitoringSignal fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DataDriftMonitoringSignal deserializedDataDriftMonitoringSignal = new DataDriftMonitoringSignal();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("notificationTypes".equals(fieldName)) {
List notificationTypes
= reader.readArray(reader1 -> MonitoringNotificationType.fromString(reader1.getString()));
deserializedDataDriftMonitoringSignal.withNotificationTypes(notificationTypes);
} else if ("properties".equals(fieldName)) {
Map properties = reader.readMap(reader1 -> reader1.getString());
deserializedDataDriftMonitoringSignal.withProperties(properties);
} else if ("metricThresholds".equals(fieldName)) {
List metricThresholds
= reader.readArray(reader1 -> DataDriftMetricThresholdBase.fromJson(reader1));
deserializedDataDriftMonitoringSignal.metricThresholds = metricThresholds;
} else if ("productionData".equals(fieldName)) {
deserializedDataDriftMonitoringSignal.productionData = MonitoringInputDataBase.fromJson(reader);
} else if ("referenceData".equals(fieldName)) {
deserializedDataDriftMonitoringSignal.referenceData = MonitoringInputDataBase.fromJson(reader);
} else if ("signalType".equals(fieldName)) {
deserializedDataDriftMonitoringSignal.signalType
= MonitoringSignalType.fromString(reader.getString());
} else if ("features".equals(fieldName)) {
deserializedDataDriftMonitoringSignal.features = MonitoringFeatureFilterBase.fromJson(reader);
} else if ("featureImportanceSettings".equals(fieldName)) {
deserializedDataDriftMonitoringSignal.featureImportanceSettings
= FeatureImportanceSettings.fromJson(reader);
} else if ("featureDataTypeOverride".equals(fieldName)) {
Map featureDataTypeOverride
= reader.readMap(reader1 -> MonitoringFeatureDataType.fromString(reader1.getString()));
deserializedDataDriftMonitoringSignal.featureDataTypeOverride = featureDataTypeOverride;
} else {
reader.skipChildren();
}
}
return deserializedDataDriftMonitoringSignal;
});
}
}