Esempio n. 1
0
    def test_init_all_parameters_classification(self):
        """Ensure all private members are set correctly at initialization"""

        aiplatform.init(project=_TEST_PROJECT)

        job = training_jobs.AutoMLTextTrainingJob(
            display_name=_TEST_DISPLAY_NAME,
            prediction_type=_TEST_PREDICTION_TYPE_CLASSIFICATION,
            multi_label=_TEST_CLASSIFICATION_MULTILABEL,
        )

        assert job._display_name == _TEST_DISPLAY_NAME
        assert (job._training_task_definition ==
                schema.training_job.definition.automl_text_classification)
        assert (job._training_task_inputs_dict ==
                training_job_inputs.AutoMlTextClassificationInputs(
                    multi_label=_TEST_CLASSIFICATION_MULTILABEL))
Esempio n. 2
0
_TEST_PREDICTION_TYPE_CLASSIFICATION = "classification"
_TEST_CLASSIFICATION_MULTILABEL = True
_TEST_PREDICTION_TYPE_EXTRACTION = "extraction"
_TEST_PREDICTION_TYPE_SENTIMENT = "sentiment"
_TEST_SENTIMENT_MAX = 10

_TEST_DATASET_NAME = "test-dataset-name"
_TEST_MODEL_DISPLAY_NAME = "model-display-name"

_TEST_LABELS = {"key": "value"}
_TEST_MODEL_LABELS = {"model_key": "model_value"}

_TEST_MODEL_ID = "98777645321"

_TEST_TRAINING_TASK_INPUTS_CLASSIFICATION = (
    training_job_inputs.AutoMlTextClassificationInputs(
        multi_label=_TEST_CLASSIFICATION_MULTILABEL))
_TEST_TRAINING_TASK_INPUTS_EXTRACTION = training_job_inputs.AutoMlTextExtractionInputs(
)
_TEST_TRAINING_TASK_INPUTS_SENTIMENT = training_job_inputs.AutoMlTextSentimentInputs(
    sentiment_max=_TEST_SENTIMENT_MAX)

_TEST_FRACTION_SPLIT_TRAINING = 0.6
_TEST_FRACTION_SPLIT_VALIDATION = 0.2
_TEST_FRACTION_SPLIT_TEST = 0.2
_TEST_FILTER_SPLIT_TRAINING = "train"
_TEST_FILTER_SPLIT_VALIDATION = "validate"
_TEST_FILTER_SPLIT_TEST = "test"
_TEST_PREDEFINED_SPLIT_COLUMN_NAME = "predefined_column"

_TEST_MODEL_NAME = (
    f"projects/{_TEST_PROJECT}/locations/{_TEST_LOCATION}/models/{_TEST_MODEL_ID}"
Esempio n. 3
0
_TEST_DATASET_DISPLAY_NAME = "test-dataset-display-name"
_TEST_DATASET_NAME = "test-dataset-name"
_TEST_DISPLAY_NAME = "test-display-name"
_TEST_METADATA_SCHEMA_URI_TEXT = schema.dataset.metadata.text

_TEST_PREDICTION_TYPE_CLASSIFICATION = "classification"
_TEST_CLASSIFICATION_MULTILABEL = True
_TEST_PREDICTION_TYPE_EXTRACTION = "extraction"
_TEST_PREDICTION_TYPE_SENTIMENT = "sentiment"
_TEST_SENTIMENT_MAX = 10

_TEST_DATASET_NAME = "test-dataset-name"
_TEST_MODEL_DISPLAY_NAME = "model-display-name"
_TEST_MODEL_ID = "98777645321"

_TEST_TRAINING_TASK_INPUTS_CLASSIFICATION = training_job_inputs.AutoMlTextClassificationInputs(
    multi_label=_TEST_CLASSIFICATION_MULTILABEL)
_TEST_TRAINING_TASK_INPUTS_EXTRACTION = training_job_inputs.AutoMlTextExtractionInputs(
)
_TEST_TRAINING_TASK_INPUTS_SENTIMENT = training_job_inputs.AutoMlTextSentimentInputs(
    sentiment_max=_TEST_SENTIMENT_MAX)

_TEST_FRACTION_SPLIT_TRAINING = 0.6
_TEST_FRACTION_SPLIT_VALIDATION = 0.2
_TEST_FRACTION_SPLIT_TEST = 0.2

_TEST_MODEL_NAME = (
    f"projects/{_TEST_PROJECT}/locations/{_TEST_LOCATION}/models/{_TEST_MODEL_ID}"
)

_TEST_PIPELINE_RESOURCE_NAME = (
    f"projects/{_TEST_PROJECT}/locations/{_TEST_LOCATION}/trainingPipeline/12345"