aws_sdk_machinelearning/operation/create_ml_model/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_ml_model::_create_ml_model_output::CreateMlModelOutputBuilder;
3
4pub use crate::operation::create_ml_model::_create_ml_model_input::CreateMlModelInputBuilder;
5
6impl crate::operation::create_ml_model::builders::CreateMlModelInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::create_ml_model::CreateMlModelOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_ml_model::CreateMLModelError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_ml_model();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateMLModel`.
24///
25/// <p>Creates a new <code>MLModel</code> using the <code>DataSource</code> and the recipe as information sources.</p>
26/// <p>An <code>MLModel</code> is nearly immutable. Users can update only the <code>MLModelName</code> and the <code>ScoreThreshold</code> in an <code>MLModel</code> without creating a new <code>MLModel</code>.</p>
27/// <p><code>CreateMLModel</code> is an asynchronous operation. In response to <code>CreateMLModel</code>, Amazon Machine Learning (Amazon ML) immediately returns and sets the <code>MLModel</code> status to <code>PENDING</code>. After the <code>MLModel</code> has been created and ready is for use, Amazon ML sets the status to <code>COMPLETED</code>.</p>
28/// <p>You can use the <code>GetMLModel</code> operation to check the progress of the <code>MLModel</code> during the creation operation.</p>
29/// <p><code>CreateMLModel</code> requires a <code>DataSource</code> with computed statistics, which can be created by setting <code>ComputeStatistics</code> to <code>true</code> in <code>CreateDataSourceFromRDS</code>, <code>CreateDataSourceFromS3</code>, or <code>CreateDataSourceFromRedshift</code> operations.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateMLModelFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::create_ml_model::builders::CreateMlModelInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::create_ml_model::CreateMlModelOutput,
39 crate::operation::create_ml_model::CreateMLModelError,
40 > for CreateMLModelFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::create_ml_model::CreateMlModelOutput,
48 crate::operation::create_ml_model::CreateMLModelError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl CreateMLModelFluentBuilder {
55 /// Creates a new `CreateMLModelFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the CreateMLModel as a reference.
64 pub fn as_input(&self) -> &crate::operation::create_ml_model::builders::CreateMlModelInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::create_ml_model::CreateMlModelOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::create_ml_model::CreateMLModelError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins = crate::operation::create_ml_model::CreateMLModel::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::create_ml_model::CreateMLModel::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::create_ml_model::CreateMlModelOutput,
101 crate::operation::create_ml_model::CreateMLModelError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>.</p>
116 pub fn ml_model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.ml_model_id(input.into());
118 self
119 }
120 /// <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>.</p>
121 pub fn set_ml_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_ml_model_id(input);
123 self
124 }
125 /// <p>A user-supplied ID that uniquely identifies the <code>MLModel</code>.</p>
126 pub fn get_ml_model_id(&self) -> &::std::option::Option<::std::string::String> {
127 self.inner.get_ml_model_id()
128 }
129 /// <p>A user-supplied name or description of the <code>MLModel</code>.</p>
130 pub fn ml_model_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.ml_model_name(input.into());
132 self
133 }
134 /// <p>A user-supplied name or description of the <code>MLModel</code>.</p>
135 pub fn set_ml_model_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_ml_model_name(input);
137 self
138 }
139 /// <p>A user-supplied name or description of the <code>MLModel</code>.</p>
140 pub fn get_ml_model_name(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_ml_model_name()
142 }
143 /// <p>The category of supervised learning that this <code>MLModel</code> will address. Choose from the following types:</p>
144 /// <ul>
145 /// <li>
146 /// <p>Choose <code>REGRESSION</code> if the <code>MLModel</code> will be used to predict a numeric value.</p></li>
147 /// <li>
148 /// <p>Choose <code>BINARY</code> if the <code>MLModel</code> result has two possible values.</p></li>
149 /// <li>
150 /// <p>Choose <code>MULTICLASS</code> if the <code>MLModel</code> result has a limited number of values.</p></li>
151 /// </ul>
152 /// <p>For more information, see the <a href="https://docs.aws.amazon.com/machine-learning/latest/dg">Amazon Machine Learning Developer Guide</a>.</p>
153 pub fn ml_model_type(mut self, input: crate::types::MlModelType) -> Self {
154 self.inner = self.inner.ml_model_type(input);
155 self
156 }
157 /// <p>The category of supervised learning that this <code>MLModel</code> will address. Choose from the following types:</p>
158 /// <ul>
159 /// <li>
160 /// <p>Choose <code>REGRESSION</code> if the <code>MLModel</code> will be used to predict a numeric value.</p></li>
161 /// <li>
162 /// <p>Choose <code>BINARY</code> if the <code>MLModel</code> result has two possible values.</p></li>
163 /// <li>
164 /// <p>Choose <code>MULTICLASS</code> if the <code>MLModel</code> result has a limited number of values.</p></li>
165 /// </ul>
166 /// <p>For more information, see the <a href="https://docs.aws.amazon.com/machine-learning/latest/dg">Amazon Machine Learning Developer Guide</a>.</p>
167 pub fn set_ml_model_type(mut self, input: ::std::option::Option<crate::types::MlModelType>) -> Self {
168 self.inner = self.inner.set_ml_model_type(input);
169 self
170 }
171 /// <p>The category of supervised learning that this <code>MLModel</code> will address. Choose from the following types:</p>
172 /// <ul>
173 /// <li>
174 /// <p>Choose <code>REGRESSION</code> if the <code>MLModel</code> will be used to predict a numeric value.</p></li>
175 /// <li>
176 /// <p>Choose <code>BINARY</code> if the <code>MLModel</code> result has two possible values.</p></li>
177 /// <li>
178 /// <p>Choose <code>MULTICLASS</code> if the <code>MLModel</code> result has a limited number of values.</p></li>
179 /// </ul>
180 /// <p>For more information, see the <a href="https://docs.aws.amazon.com/machine-learning/latest/dg">Amazon Machine Learning Developer Guide</a>.</p>
181 pub fn get_ml_model_type(&self) -> &::std::option::Option<crate::types::MlModelType> {
182 self.inner.get_ml_model_type()
183 }
184 ///
185 /// Adds a key-value pair to `Parameters`.
186 ///
187 /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
188 ///
189 /// <p>A list of the training parameters in the <code>MLModel</code>. The list is implemented as a map of key-value pairs.</p>
190 /// <p>The following is the current set of training parameters:</p>
191 /// <ul>
192 /// <li>
193 /// <p><code>sgd.maxMLModelSizeInBytes</code> - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance.</p>
194 /// <p>The value is an integer that ranges from <code>100000</code> to <code>2147483648</code>. The default value is <code>33554432</code>.</p></li>
195 /// <li>
196 /// <p><code>sgd.maxPasses</code> - The number of times that the training process traverses the observations to build the <code>MLModel</code>. The value is an integer that ranges from <code>1</code> to <code>10000</code>. The default value is <code>10</code>.</p></li>
197 /// <li>
198 /// <p><code>sgd.shuffleType</code> - Whether Amazon ML shuffles the training data. Shuffling the data improves a model's ability to find the optimal solution for a variety of data types. The valid values are <code>auto</code> and <code>none</code>. The default value is <code>none</code>. We strongly recommend that you shuffle your data.</p></li>
199 /// <li>
200 /// <p><code>sgd.l1RegularizationAmount</code> - The coefficient regularization L1 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to zero, resulting in a sparse feature set. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
201 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L1 normalization. This parameter can't be used when <code>L2</code> is specified. Use this parameter sparingly.</p></li>
202 /// <li>
203 /// <p><code>sgd.l2RegularizationAmount</code> - The coefficient regularization L2 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
204 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L2 normalization. This parameter can't be used when <code>L1</code> is specified. Use this parameter sparingly.</p></li>
205 /// </ul>
206 pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
207 self.inner = self.inner.parameters(k.into(), v.into());
208 self
209 }
210 /// <p>A list of the training parameters in the <code>MLModel</code>. The list is implemented as a map of key-value pairs.</p>
211 /// <p>The following is the current set of training parameters:</p>
212 /// <ul>
213 /// <li>
214 /// <p><code>sgd.maxMLModelSizeInBytes</code> - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance.</p>
215 /// <p>The value is an integer that ranges from <code>100000</code> to <code>2147483648</code>. The default value is <code>33554432</code>.</p></li>
216 /// <li>
217 /// <p><code>sgd.maxPasses</code> - The number of times that the training process traverses the observations to build the <code>MLModel</code>. The value is an integer that ranges from <code>1</code> to <code>10000</code>. The default value is <code>10</code>.</p></li>
218 /// <li>
219 /// <p><code>sgd.shuffleType</code> - Whether Amazon ML shuffles the training data. Shuffling the data improves a model's ability to find the optimal solution for a variety of data types. The valid values are <code>auto</code> and <code>none</code>. The default value is <code>none</code>. We strongly recommend that you shuffle your data.</p></li>
220 /// <li>
221 /// <p><code>sgd.l1RegularizationAmount</code> - The coefficient regularization L1 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to zero, resulting in a sparse feature set. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
222 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L1 normalization. This parameter can't be used when <code>L2</code> is specified. Use this parameter sparingly.</p></li>
223 /// <li>
224 /// <p><code>sgd.l2RegularizationAmount</code> - The coefficient regularization L2 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
225 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L2 normalization. This parameter can't be used when <code>L1</code> is specified. Use this parameter sparingly.</p></li>
226 /// </ul>
227 pub fn set_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
228 self.inner = self.inner.set_parameters(input);
229 self
230 }
231 /// <p>A list of the training parameters in the <code>MLModel</code>. The list is implemented as a map of key-value pairs.</p>
232 /// <p>The following is the current set of training parameters:</p>
233 /// <ul>
234 /// <li>
235 /// <p><code>sgd.maxMLModelSizeInBytes</code> - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance.</p>
236 /// <p>The value is an integer that ranges from <code>100000</code> to <code>2147483648</code>. The default value is <code>33554432</code>.</p></li>
237 /// <li>
238 /// <p><code>sgd.maxPasses</code> - The number of times that the training process traverses the observations to build the <code>MLModel</code>. The value is an integer that ranges from <code>1</code> to <code>10000</code>. The default value is <code>10</code>.</p></li>
239 /// <li>
240 /// <p><code>sgd.shuffleType</code> - Whether Amazon ML shuffles the training data. Shuffling the data improves a model's ability to find the optimal solution for a variety of data types. The valid values are <code>auto</code> and <code>none</code>. The default value is <code>none</code>. We strongly recommend that you shuffle your data.</p></li>
241 /// <li>
242 /// <p><code>sgd.l1RegularizationAmount</code> - The coefficient regularization L1 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to zero, resulting in a sparse feature set. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
243 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L1 normalization. This parameter can't be used when <code>L2</code> is specified. Use this parameter sparingly.</p></li>
244 /// <li>
245 /// <p><code>sgd.l2RegularizationAmount</code> - The coefficient regularization L2 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as <code>1.0E-08</code>.</p>
246 /// <p>The value is a double that ranges from <code>0</code> to <code>MAX_DOUBLE</code>. The default is to not use L2 normalization. This parameter can't be used when <code>L1</code> is specified. Use this parameter sparingly.</p></li>
247 /// </ul>
248 pub fn get_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
249 self.inner.get_parameters()
250 }
251 /// <p>The <code>DataSource</code> that points to the training data.</p>
252 pub fn training_data_source_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
253 self.inner = self.inner.training_data_source_id(input.into());
254 self
255 }
256 /// <p>The <code>DataSource</code> that points to the training data.</p>
257 pub fn set_training_data_source_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
258 self.inner = self.inner.set_training_data_source_id(input);
259 self
260 }
261 /// <p>The <code>DataSource</code> that points to the training data.</p>
262 pub fn get_training_data_source_id(&self) -> &::std::option::Option<::std::string::String> {
263 self.inner.get_training_data_source_id()
264 }
265 /// <p>The data recipe for creating the <code>MLModel</code>. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
266 pub fn recipe(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
267 self.inner = self.inner.recipe(input.into());
268 self
269 }
270 /// <p>The data recipe for creating the <code>MLModel</code>. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
271 pub fn set_recipe(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
272 self.inner = self.inner.set_recipe(input);
273 self
274 }
275 /// <p>The data recipe for creating the <code>MLModel</code>. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
276 pub fn get_recipe(&self) -> &::std::option::Option<::std::string::String> {
277 self.inner.get_recipe()
278 }
279 /// <p>The Amazon Simple Storage Service (Amazon S3) location and file name that contains the <code>MLModel</code> recipe. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
280 pub fn recipe_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
281 self.inner = self.inner.recipe_uri(input.into());
282 self
283 }
284 /// <p>The Amazon Simple Storage Service (Amazon S3) location and file name that contains the <code>MLModel</code> recipe. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
285 pub fn set_recipe_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
286 self.inner = self.inner.set_recipe_uri(input);
287 self
288 }
289 /// <p>The Amazon Simple Storage Service (Amazon S3) location and file name that contains the <code>MLModel</code> recipe. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.</p>
290 pub fn get_recipe_uri(&self) -> &::std::option::Option<::std::string::String> {
291 self.inner.get_recipe_uri()
292 }
293}