All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.machinelearning.models.TableVerticalLimitSettings Maven / Gradle / Ivy

Go to download

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.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.Duration;

/**
 * Job execution constraints.
 */
@Fluent
public final class TableVerticalLimitSettings implements JsonSerializable {
    /*
     * Number of iterations.
     */
    private Integer maxTrials;

    /*
     * Iteration timeout.
     */
    private Duration trialTimeout;

    /*
     * AutoML job timeout.
     */
    private Duration timeout;

    /*
     * Maximum Concurrent iterations.
     */
    private Integer maxConcurrentTrials;

    /*
     * Max cores per iteration.
     */
    private Integer maxCoresPerTrial;

    /*
     * Exit score for the AutoML job.
     */
    private Double exitScore;

    /*
     * Enable early termination, determines whether or not if AutoMLJob will terminate early if there is no score
     * improvement in last 20 iterations.
     */
    private Boolean enableEarlyTermination;

    /**
     * Creates an instance of TableVerticalLimitSettings class.
     */
    public TableVerticalLimitSettings() {
    }

    /**
     * Get the maxTrials property: Number of iterations.
     * 
     * @return the maxTrials value.
     */
    public Integer maxTrials() {
        return this.maxTrials;
    }

    /**
     * Set the maxTrials property: Number of iterations.
     * 
     * @param maxTrials the maxTrials value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withMaxTrials(Integer maxTrials) {
        this.maxTrials = maxTrials;
        return this;
    }

    /**
     * Get the trialTimeout property: Iteration timeout.
     * 
     * @return the trialTimeout value.
     */
    public Duration trialTimeout() {
        return this.trialTimeout;
    }

    /**
     * Set the trialTimeout property: Iteration timeout.
     * 
     * @param trialTimeout the trialTimeout value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withTrialTimeout(Duration trialTimeout) {
        this.trialTimeout = trialTimeout;
        return this;
    }

    /**
     * Get the timeout property: AutoML job timeout.
     * 
     * @return the timeout value.
     */
    public Duration timeout() {
        return this.timeout;
    }

    /**
     * Set the timeout property: AutoML job timeout.
     * 
     * @param timeout the timeout value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withTimeout(Duration timeout) {
        this.timeout = timeout;
        return this;
    }

    /**
     * Get the maxConcurrentTrials property: Maximum Concurrent iterations.
     * 
     * @return the maxConcurrentTrials value.
     */
    public Integer maxConcurrentTrials() {
        return this.maxConcurrentTrials;
    }

    /**
     * Set the maxConcurrentTrials property: Maximum Concurrent iterations.
     * 
     * @param maxConcurrentTrials the maxConcurrentTrials value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withMaxConcurrentTrials(Integer maxConcurrentTrials) {
        this.maxConcurrentTrials = maxConcurrentTrials;
        return this;
    }

    /**
     * Get the maxCoresPerTrial property: Max cores per iteration.
     * 
     * @return the maxCoresPerTrial value.
     */
    public Integer maxCoresPerTrial() {
        return this.maxCoresPerTrial;
    }

    /**
     * Set the maxCoresPerTrial property: Max cores per iteration.
     * 
     * @param maxCoresPerTrial the maxCoresPerTrial value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withMaxCoresPerTrial(Integer maxCoresPerTrial) {
        this.maxCoresPerTrial = maxCoresPerTrial;
        return this;
    }

    /**
     * Get the exitScore property: Exit score for the AutoML job.
     * 
     * @return the exitScore value.
     */
    public Double exitScore() {
        return this.exitScore;
    }

    /**
     * Set the exitScore property: Exit score for the AutoML job.
     * 
     * @param exitScore the exitScore value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withExitScore(Double exitScore) {
        this.exitScore = exitScore;
        return this;
    }

    /**
     * Get the enableEarlyTermination property: Enable early termination, determines whether or not if AutoMLJob will
     * terminate early if there is no score improvement in last 20 iterations.
     * 
     * @return the enableEarlyTermination value.
     */
    public Boolean enableEarlyTermination() {
        return this.enableEarlyTermination;
    }

    /**
     * Set the enableEarlyTermination property: Enable early termination, determines whether or not if AutoMLJob will
     * terminate early if there is no score improvement in last 20 iterations.
     * 
     * @param enableEarlyTermination the enableEarlyTermination value to set.
     * @return the TableVerticalLimitSettings object itself.
     */
    public TableVerticalLimitSettings withEnableEarlyTermination(Boolean enableEarlyTermination) {
        this.enableEarlyTermination = enableEarlyTermination;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("maxTrials", this.maxTrials);
        jsonWriter.writeStringField("trialTimeout", CoreUtils.durationToStringWithDays(this.trialTimeout));
        jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout));
        jsonWriter.writeNumberField("maxConcurrentTrials", this.maxConcurrentTrials);
        jsonWriter.writeNumberField("maxCoresPerTrial", this.maxCoresPerTrial);
        jsonWriter.writeNumberField("exitScore", this.exitScore);
        jsonWriter.writeBooleanField("enableEarlyTermination", this.enableEarlyTermination);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of TableVerticalLimitSettings from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of TableVerticalLimitSettings if the JsonReader was pointing to an instance of it, or null if
     * it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the TableVerticalLimitSettings.
     */
    public static TableVerticalLimitSettings fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            TableVerticalLimitSettings deserializedTableVerticalLimitSettings = new TableVerticalLimitSettings();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("maxTrials".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.maxTrials = reader.getNullable(JsonReader::getInt);
                } else if ("trialTimeout".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.trialTimeout
                        = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()));
                } else if ("timeout".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.timeout
                        = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()));
                } else if ("maxConcurrentTrials".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.maxConcurrentTrials = reader.getNullable(JsonReader::getInt);
                } else if ("maxCoresPerTrial".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.maxCoresPerTrial = reader.getNullable(JsonReader::getInt);
                } else if ("exitScore".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.exitScore = reader.getNullable(JsonReader::getDouble);
                } else if ("enableEarlyTermination".equals(fieldName)) {
                    deserializedTableVerticalLimitSettings.enableEarlyTermination
                        = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTableVerticalLimitSettings;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy