<commit_before># Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: bigquery_explain_forecast_model_job
description: |
  Launch a BigQuery ML.EXPLAIN_FORECAST job and let you explain forecast an ARIMA_PLUS or ARIMA model. This function only applies to the time-series ARIMA_PLUS and ARIMA models.

    Args:
        project (str):
            Required. Project to run the BigQuery job.
        location (Optional[str]):
            Location to run the BigQuery job. If not set,
            default to `US` multi-region.
            For more details, see https://cloud.google.com/bigquery/docs/locations#specifying_your_location
        model (google.BQMLModel):
            Required. BigQuery ML model for ML.EXPLAIN_FORECAST.
            For more details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast
        horizon (Optional[int]): Horizon is the number of time points to explain forecast. For more
            details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#horizon
        confidence_level (Optional[float]): The percentage of the future values that fall in the
            prediction interval. For more details, see
            https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#confidence_level
        query_parameters (Optional[Sequence]):
            jobs.query parameters for standard SQL queries.
            If query_parameters are both specified in here and in job_configuration_query,
            the value in here will override the other one.
        job_configuration_query (Optional[dict]):
            A json formatted string describing the rest of the job configuration.
            For more details, see https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationQuery
        labels (Optional[dict]):
            The labels associated with this job. You can use these to organize and group your jobs.
            Label keys and values can be no longer than 63 characters, can only containlowercase
            letters, numeric characters, underscores and dashes. International characters are
            allowed. Label values are optional. Label keys must start with a letter and each label
            in the list must have a different key.

            Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
        encryption_spec_key_name(Optional[List[str]]):
            Describes the Cloud KMS encryption key that will be used to protect
            destination BigQuery table. The BigQuery Service Account associated with
            your project requires access to this encryption key.
            If encryption_spec_key_name are both specified in here and in job_configuration_query,
            the value in here will override the other one.
    Returns:
        destination_table (google.BQTable):
            Describes the table where the model explain forecast results should be stored.
            For more details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#mlexplain_forecast_output
        gcp_resources (str):
            Serialized gcp_resources proto tracking the BigQuery job.
            For more details, see https://github.com/kubeflow/pipelines/blob/master/components/google-cloud/google_cloud_pipeline_components/proto/README.md.
inputs:
- {name: project, type: String}
- {name: location, type: String, default: "us-central1"}
- {name: model, type: google.BQMLModel}
- {name: horizon, type: Integer, optional: true, default: 3}
- {name: confidence_level, type: Float, optional: true, default: 0.95}
- {name: query_parameters, type: JsonArray, optional: true, default: '[]' }
- {name: job_configuration_query, type: JsonObject, optional: true, default: '{}'}
- {name: labels, type: JsonObject, optional: true, default: '{}'}
- {name: encryption_spec_key_name, type: String, optional: true}
outputs:
- {name: destination_table, type: google.BQTable}
- {name: gcp_resources, type: String}
implementation:
  container:
    image: gcr.io/ml-pipeline/google-cloud-pipeline-components:latest
    command: [python3, -u, -m, google_cloud_pipeline_components.container.v1.gcp_launcher.launcher]
    args: [
      --type, BigqueryExplainForecastModelJob,
      --project, {inputValue: project},
      --location, {inputValue: location},
      --model_name,
      concat: [
          "{{$.inputs.artifacts['model'].metadata['projectId']}}",
          '.',
          "{{$.inputs.artifacts['model'].metadata['datasetId']}}",
          '.',
          "{{$.inputs.artifacts['model'].metadata['modelId']}}"
          ],
      --horizon, {inputValue: horizon},
      --confidence_level, {inputValue: confidence_level},
      --payload,
      concat: [
          '{',
            '"configuration": {',
              '"query": ', {inputValue: job_configuration_query},
            '}',
          '}'
      ],
      --job_configuration_query_override,
      concat: [
          '{',
            '"query_parameters": ', {inputValue: query_parameters},
            ', "destination_encryption_configuration": {',
            '"kmsKeyName": "', {inputValue: encryption_spec_key_name}, '"}',
          '}'<commit_msg>chore(component): propagating labels for explain_forecast_model component<commit_after># Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: bigquery_explain_forecast_model_job
description: |
  Launch a BigQuery ML.EXPLAIN_FORECAST job and let you explain forecast an ARIMA_PLUS or ARIMA model. This function only applies to the time-series ARIMA_PLUS and ARIMA models.

    Args:
        project (str):
            Required. Project to run the BigQuery job.
        location (Optional[str]):
            Location to run the BigQuery job. If not set,
            default to `US` multi-region.
            For more details, see https://cloud.google.com/bigquery/docs/locations#specifying_your_location
        model (google.BQMLModel):
            Required. BigQuery ML model for ML.EXPLAIN_FORECAST.
            For more details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast
        horizon (Optional[int]): Horizon is the number of time points to explain forecast. For more
            details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#horizon
        confidence_level (Optional[float]): The percentage of the future values that fall in the
            prediction interval. For more details, see
            https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#confidence_level
        query_parameters (Optional[Sequence]):
            jobs.query parameters for standard SQL queries.
            If query_parameters are both specified in here and in job_configuration_query,
            the value in here will override the other one.
        job_configuration_query (Optional[dict]):
            A json formatted string describing the rest of the job configuration.
            For more details, see https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationQuery
        labels (Optional[dict]):
            The labels associated with this job. You can use these to organize and group your jobs.
            Label keys and values can be no longer than 63 characters, can only containlowercase
            letters, numeric characters, underscores and dashes. International characters are
            allowed. Label values are optional. Label keys must start with a letter and each label
            in the list must have a different key.

            Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
        encryption_spec_key_name(Optional[List[str]]):
            Describes the Cloud KMS encryption key that will be used to protect
            destination BigQuery table. The BigQuery Service Account associated with
            your project requires access to this encryption key.
            If encryption_spec_key_name are both specified in here and in job_configuration_query,
            the value in here will override the other one.
    Returns:
        destination_table (google.BQTable):
            Describes the table where the model explain forecast results should be stored.
            For more details, see https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-explain-forecast#mlexplain_forecast_output
        gcp_resources (str):
            Serialized gcp_resources proto tracking the BigQuery job.
            For more details, see https://github.com/kubeflow/pipelines/blob/master/components/google-cloud/google_cloud_pipeline_components/proto/README.md.
inputs:
- {name: project, type: String}
- {name: location, type: String, default: "us-central1"}
- {name: model, type: google.BQMLModel}
- {name: horizon, type: Integer, optional: true, default: 3}
- {name: confidence_level, type: Float, optional: true, default: 0.95}
- {name: query_parameters, type: JsonArray, optional: true, default: '[]' }
- {name: job_configuration_query, type: JsonObject, optional: true, default: '{}'}
- {name: labels, type: JsonObject, optional: true, default: '{}'}
- {name: encryption_spec_key_name, type: String, optional: true}
outputs:
- {name: destination_table, type: google.BQTable}
- {name: gcp_resources, type: String}
implementation:
  container:
    image: gcr.io/ml-pipeline/google-cloud-pipeline-components:latest
    command: [python3, -u, -m, google_cloud_pipeline_components.container.v1.gcp_launcher.launcher]
    args: [
      --type, BigqueryExplainForecastModelJob,
      --project, {inputValue: project},
      --location, {inputValue: location},
      --model_name,
      concat: [
          "{{$.inputs.artifacts['model'].metadata['projectId']}}",
          '.',
          "{{$.inputs.artifacts['model'].metadata['datasetId']}}",
          '.',
          "{{$.inputs.artifacts['model'].metadata['modelId']}}"
          ],
      --horizon, {inputValue: horizon},
      --confidence_level, {inputValue: confidence_level},
      --payload,
      concat: [
          '{',
            '"configuration": {',
              '"query": ', {inputValue: job_configuration_query},
              ', "labels": ', {inputValue: labels},
            '}',
          '}'
      ],
      --job_configuration_query_override,
      concat: [
          '{',
            '"query_parameters": ', {inputValue: query_parameters},
            ', "destination_encryption_configuration": {',
            '"kmsKeyName": "', {inputValue: encryption_spec_key_name}, '"}',
          '}'
{'fraction_non_alphanumeric': 0.09977939928729, 'fraction_numerical': 0.0035635499745460715, 'mean_word_length': 3.0242403550699897, 'pattern_counts': {'":': 17, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5112605', 'n_tokens_mistral': 3177, 'n_tokens_neox': 3109, 'n_words': 1012}