aws_sdk_forecast/types/
_featurization.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <note>
4/// <p>This object belongs to the <code>CreatePredictor</code> operation. If you created your predictor with <code>CreateAutoPredictor</code>, see <code>AttributeConfig</code>.</p>
5/// </note>
6/// <p>Provides featurization (transformation) information for a dataset field. This object is part of the <code>FeaturizationConfig</code> object.</p>
7/// <p>For example:</p>
8/// <p><code>{</code></p>
9/// <p><code>"AttributeName": "demand",</code></p>
10/// <p><code>FeaturizationPipeline \[ {</code></p>
11/// <p><code>"FeaturizationMethodName": "filling",</code></p>
12/// <p><code>"FeaturizationMethodParameters": {"aggregation": "avg", "backfill": "nan"}</code></p>
13/// <p><code>} \]</code></p>
14/// <p><code>}</code></p>
15#[non_exhaustive]
16#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
17pub struct Featurization {
18    /// <p>The name of the schema attribute that specifies the data field to be featurized. Amazon Forecast supports the target field of the <code>TARGET_TIME_SERIES</code> and the <code>RELATED_TIME_SERIES</code> datasets. For example, for the <code>RETAIL</code> domain, the target is <code>demand</code>, and for the <code>CUSTOM</code> domain, the target is <code>target_value</code>. For more information, see <code>howitworks-missing-values</code>.</p>
19    pub attribute_name: ::std::string::String,
20    /// <p>An array of one <code>FeaturizationMethod</code> object that specifies the feature transformation method.</p>
21    pub featurization_pipeline: ::std::option::Option<::std::vec::Vec<crate::types::FeaturizationMethod>>,
22}
23impl Featurization {
24    /// <p>The name of the schema attribute that specifies the data field to be featurized. Amazon Forecast supports the target field of the <code>TARGET_TIME_SERIES</code> and the <code>RELATED_TIME_SERIES</code> datasets. For example, for the <code>RETAIL</code> domain, the target is <code>demand</code>, and for the <code>CUSTOM</code> domain, the target is <code>target_value</code>. For more information, see <code>howitworks-missing-values</code>.</p>
25    pub fn attribute_name(&self) -> &str {
26        use std::ops::Deref;
27        self.attribute_name.deref()
28    }
29    /// <p>An array of one <code>FeaturizationMethod</code> object that specifies the feature transformation method.</p>
30    ///
31    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.featurization_pipeline.is_none()`.
32    pub fn featurization_pipeline(&self) -> &[crate::types::FeaturizationMethod] {
33        self.featurization_pipeline.as_deref().unwrap_or_default()
34    }
35}
36impl Featurization {
37    /// Creates a new builder-style object to manufacture [`Featurization`](crate::types::Featurization).
38    pub fn builder() -> crate::types::builders::FeaturizationBuilder {
39        crate::types::builders::FeaturizationBuilder::default()
40    }
41}
42
43/// A builder for [`Featurization`](crate::types::Featurization).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct FeaturizationBuilder {
47    pub(crate) attribute_name: ::std::option::Option<::std::string::String>,
48    pub(crate) featurization_pipeline: ::std::option::Option<::std::vec::Vec<crate::types::FeaturizationMethod>>,
49}
50impl FeaturizationBuilder {
51    /// <p>The name of the schema attribute that specifies the data field to be featurized. Amazon Forecast supports the target field of the <code>TARGET_TIME_SERIES</code> and the <code>RELATED_TIME_SERIES</code> datasets. For example, for the <code>RETAIL</code> domain, the target is <code>demand</code>, and for the <code>CUSTOM</code> domain, the target is <code>target_value</code>. For more information, see <code>howitworks-missing-values</code>.</p>
52    /// This field is required.
53    pub fn attribute_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.attribute_name = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>The name of the schema attribute that specifies the data field to be featurized. Amazon Forecast supports the target field of the <code>TARGET_TIME_SERIES</code> and the <code>RELATED_TIME_SERIES</code> datasets. For example, for the <code>RETAIL</code> domain, the target is <code>demand</code>, and for the <code>CUSTOM</code> domain, the target is <code>target_value</code>. For more information, see <code>howitworks-missing-values</code>.</p>
58    pub fn set_attribute_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.attribute_name = input;
60        self
61    }
62    /// <p>The name of the schema attribute that specifies the data field to be featurized. Amazon Forecast supports the target field of the <code>TARGET_TIME_SERIES</code> and the <code>RELATED_TIME_SERIES</code> datasets. For example, for the <code>RETAIL</code> domain, the target is <code>demand</code>, and for the <code>CUSTOM</code> domain, the target is <code>target_value</code>. For more information, see <code>howitworks-missing-values</code>.</p>
63    pub fn get_attribute_name(&self) -> &::std::option::Option<::std::string::String> {
64        &self.attribute_name
65    }
66    /// Appends an item to `featurization_pipeline`.
67    ///
68    /// To override the contents of this collection use [`set_featurization_pipeline`](Self::set_featurization_pipeline).
69    ///
70    /// <p>An array of one <code>FeaturizationMethod</code> object that specifies the feature transformation method.</p>
71    pub fn featurization_pipeline(mut self, input: crate::types::FeaturizationMethod) -> Self {
72        let mut v = self.featurization_pipeline.unwrap_or_default();
73        v.push(input);
74        self.featurization_pipeline = ::std::option::Option::Some(v);
75        self
76    }
77    /// <p>An array of one <code>FeaturizationMethod</code> object that specifies the feature transformation method.</p>
78    pub fn set_featurization_pipeline(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeaturizationMethod>>) -> Self {
79        self.featurization_pipeline = input;
80        self
81    }
82    /// <p>An array of one <code>FeaturizationMethod</code> object that specifies the feature transformation method.</p>
83    pub fn get_featurization_pipeline(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeaturizationMethod>> {
84        &self.featurization_pipeline
85    }
86    /// Consumes the builder and constructs a [`Featurization`](crate::types::Featurization).
87    /// This method will fail if any of the following fields are not set:
88    /// - [`attribute_name`](crate::types::builders::FeaturizationBuilder::attribute_name)
89    pub fn build(self) -> ::std::result::Result<crate::types::Featurization, ::aws_smithy_types::error::operation::BuildError> {
90        ::std::result::Result::Ok(crate::types::Featurization {
91            attribute_name: self.attribute_name.ok_or_else(|| {
92                ::aws_smithy_types::error::operation::BuildError::missing_field(
93                    "attribute_name",
94                    "attribute_name was not specified but it is required when building Featurization",
95                )
96            })?,
97            featurization_pipeline: self.featurization_pipeline,
98        })
99    }
100}