#[non_exhaustive]pub struct ClarifyInferenceConfigBuilder { /* private fields */ }
Expand description
A builder for ClarifyInferenceConfig
.
Implementations§
Source§impl ClarifyInferenceConfigBuilder
impl ClarifyInferenceConfigBuilder
Sourcepub fn features_attribute(self, input: impl Into<String>) -> Self
pub fn features_attribute(self, input: impl Into<String>) -> Self
Provides the JMESPath expression to extract the features from a model container input in JSON Lines format. For example, if FeaturesAttribute
is the JMESPath expression 'myfeatures'
, it extracts a list of features \[1,2,3\]
from request data '{"myfeatures":\[1,2,3\]}'
.
Sourcepub fn set_features_attribute(self, input: Option<String>) -> Self
pub fn set_features_attribute(self, input: Option<String>) -> Self
Provides the JMESPath expression to extract the features from a model container input in JSON Lines format. For example, if FeaturesAttribute
is the JMESPath expression 'myfeatures'
, it extracts a list of features \[1,2,3\]
from request data '{"myfeatures":\[1,2,3\]}'
.
Sourcepub fn get_features_attribute(&self) -> &Option<String>
pub fn get_features_attribute(&self) -> &Option<String>
Provides the JMESPath expression to extract the features from a model container input in JSON Lines format. For example, if FeaturesAttribute
is the JMESPath expression 'myfeatures'
, it extracts a list of features \[1,2,3\]
from request data '{"myfeatures":\[1,2,3\]}'
.
Sourcepub fn content_template(self, input: impl Into<String>) -> Self
pub fn content_template(self, input: impl Into<String>) -> Self
A template string used to format a JSON record into an acceptable model container input. For example, a ContentTemplate
string '{"myfeatures":$features}'
will format a list of features \[1,2,3\]
into the record string '{"myfeatures":\[1,2,3\]}'
. Required only when the model container input is in JSON Lines format.
Sourcepub fn set_content_template(self, input: Option<String>) -> Self
pub fn set_content_template(self, input: Option<String>) -> Self
A template string used to format a JSON record into an acceptable model container input. For example, a ContentTemplate
string '{"myfeatures":$features}'
will format a list of features \[1,2,3\]
into the record string '{"myfeatures":\[1,2,3\]}'
. Required only when the model container input is in JSON Lines format.
Sourcepub fn get_content_template(&self) -> &Option<String>
pub fn get_content_template(&self) -> &Option<String>
A template string used to format a JSON record into an acceptable model container input. For example, a ContentTemplate
string '{"myfeatures":$features}'
will format a list of features \[1,2,3\]
into the record string '{"myfeatures":\[1,2,3\]}'
. Required only when the model container input is in JSON Lines format.
Sourcepub fn max_record_count(self, input: i32) -> Self
pub fn max_record_count(self, input: i32) -> Self
The maximum number of records in a request that the model container can process when querying the model container for the predictions of a synthetic dataset. A record is a unit of input data that inference can be made on, for example, a single line in CSV data. If MaxRecordCount
is 1
, the model container expects one record per request. A value of 2 or greater means that the model expects batch requests, which can reduce overhead and speed up the inferencing process. If this parameter is not provided, the explainer will tune the record count per request according to the model container's capacity at runtime.
Sourcepub fn set_max_record_count(self, input: Option<i32>) -> Self
pub fn set_max_record_count(self, input: Option<i32>) -> Self
The maximum number of records in a request that the model container can process when querying the model container for the predictions of a synthetic dataset. A record is a unit of input data that inference can be made on, for example, a single line in CSV data. If MaxRecordCount
is 1
, the model container expects one record per request. A value of 2 or greater means that the model expects batch requests, which can reduce overhead and speed up the inferencing process. If this parameter is not provided, the explainer will tune the record count per request according to the model container's capacity at runtime.
Sourcepub fn get_max_record_count(&self) -> &Option<i32>
pub fn get_max_record_count(&self) -> &Option<i32>
The maximum number of records in a request that the model container can process when querying the model container for the predictions of a synthetic dataset. A record is a unit of input data that inference can be made on, for example, a single line in CSV data. If MaxRecordCount
is 1
, the model container expects one record per request. A value of 2 or greater means that the model expects batch requests, which can reduce overhead and speed up the inferencing process. If this parameter is not provided, the explainer will tune the record count per request according to the model container's capacity at runtime.
Sourcepub fn max_payload_in_mb(self, input: i32) -> Self
pub fn max_payload_in_mb(self, input: i32) -> Self
The maximum payload size (MB) allowed of a request from the explainer to the model container. Defaults to 6
MB.
Sourcepub fn set_max_payload_in_mb(self, input: Option<i32>) -> Self
pub fn set_max_payload_in_mb(self, input: Option<i32>) -> Self
The maximum payload size (MB) allowed of a request from the explainer to the model container. Defaults to 6
MB.
Sourcepub fn get_max_payload_in_mb(&self) -> &Option<i32>
pub fn get_max_payload_in_mb(&self) -> &Option<i32>
The maximum payload size (MB) allowed of a request from the explainer to the model container. Defaults to 6
MB.
Sourcepub fn probability_index(self, input: i32) -> Self
pub fn probability_index(self, input: i32) -> Self
A zero-based index used to extract a probability value (score) or list from model container output in CSV format. If this value is not provided, the entire model container output will be treated as a probability value (score) or list.
Example for a single class model: If the model container output consists of a string-formatted prediction label followed by its probability: '1,0.6'
, set ProbabilityIndex
to 1
to select the probability value 0.6
.
Example for a multiclass model: If the model container output consists of a string-formatted prediction label followed by its probability: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set ProbabilityIndex
to 1
to select the probability values \[0.1,0.6,0.3\]
.
Sourcepub fn set_probability_index(self, input: Option<i32>) -> Self
pub fn set_probability_index(self, input: Option<i32>) -> Self
A zero-based index used to extract a probability value (score) or list from model container output in CSV format. If this value is not provided, the entire model container output will be treated as a probability value (score) or list.
Example for a single class model: If the model container output consists of a string-formatted prediction label followed by its probability: '1,0.6'
, set ProbabilityIndex
to 1
to select the probability value 0.6
.
Example for a multiclass model: If the model container output consists of a string-formatted prediction label followed by its probability: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set ProbabilityIndex
to 1
to select the probability values \[0.1,0.6,0.3\]
.
Sourcepub fn get_probability_index(&self) -> &Option<i32>
pub fn get_probability_index(&self) -> &Option<i32>
A zero-based index used to extract a probability value (score) or list from model container output in CSV format. If this value is not provided, the entire model container output will be treated as a probability value (score) or list.
Example for a single class model: If the model container output consists of a string-formatted prediction label followed by its probability: '1,0.6'
, set ProbabilityIndex
to 1
to select the probability value 0.6
.
Example for a multiclass model: If the model container output consists of a string-formatted prediction label followed by its probability: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set ProbabilityIndex
to 1
to select the probability values \[0.1,0.6,0.3\]
.
Sourcepub fn label_index(self, input: i32) -> Self
pub fn label_index(self, input: i32) -> Self
A zero-based index used to extract a label header or list of label headers from model container output in CSV format.
Example for a multiclass model: If the model container output consists of label headers followed by probabilities: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set LabelIndex
to 0
to select the label headers \['cat','dog','fish'\]
.
Sourcepub fn set_label_index(self, input: Option<i32>) -> Self
pub fn set_label_index(self, input: Option<i32>) -> Self
A zero-based index used to extract a label header or list of label headers from model container output in CSV format.
Example for a multiclass model: If the model container output consists of label headers followed by probabilities: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set LabelIndex
to 0
to select the label headers \['cat','dog','fish'\]
.
Sourcepub fn get_label_index(&self) -> &Option<i32>
pub fn get_label_index(&self) -> &Option<i32>
A zero-based index used to extract a label header or list of label headers from model container output in CSV format.
Example for a multiclass model: If the model container output consists of label headers followed by probabilities: '"\[\'cat\',\'dog\',\'fish\'\]","\[0.1,0.6,0.3\]"'
, set LabelIndex
to 0
to select the label headers \['cat','dog','fish'\]
.
Sourcepub fn probability_attribute(self, input: impl Into<String>) -> Self
pub fn probability_attribute(self, input: impl Into<String>) -> Self
A JMESPath expression used to extract the probability (or score) from the model container output if the model container is in JSON Lines format.
Example: If the model container output of a single request is '{"predicted_label":1,"probability":0.6}'
, then set ProbabilityAttribute
to 'probability'
.
Sourcepub fn set_probability_attribute(self, input: Option<String>) -> Self
pub fn set_probability_attribute(self, input: Option<String>) -> Self
A JMESPath expression used to extract the probability (or score) from the model container output if the model container is in JSON Lines format.
Example: If the model container output of a single request is '{"predicted_label":1,"probability":0.6}'
, then set ProbabilityAttribute
to 'probability'
.
Sourcepub fn get_probability_attribute(&self) -> &Option<String>
pub fn get_probability_attribute(&self) -> &Option<String>
A JMESPath expression used to extract the probability (or score) from the model container output if the model container is in JSON Lines format.
Example: If the model container output of a single request is '{"predicted_label":1,"probability":0.6}'
, then set ProbabilityAttribute
to 'probability'
.
Sourcepub fn label_attribute(self, input: impl Into<String>) -> Self
pub fn label_attribute(self, input: impl Into<String>) -> Self
A JMESPath expression used to locate the list of label headers in the model container output.
Example: If the model container output of a batch request is '{"labels":\["cat","dog","fish"\],"probability":\[0.6,0.3,0.1\]}'
, then set LabelAttribute
to 'labels'
to extract the list of label headers \["cat","dog","fish"\]
Sourcepub fn set_label_attribute(self, input: Option<String>) -> Self
pub fn set_label_attribute(self, input: Option<String>) -> Self
A JMESPath expression used to locate the list of label headers in the model container output.
Example: If the model container output of a batch request is '{"labels":\["cat","dog","fish"\],"probability":\[0.6,0.3,0.1\]}'
, then set LabelAttribute
to 'labels'
to extract the list of label headers \["cat","dog","fish"\]
Sourcepub fn get_label_attribute(&self) -> &Option<String>
pub fn get_label_attribute(&self) -> &Option<String>
A JMESPath expression used to locate the list of label headers in the model container output.
Example: If the model container output of a batch request is '{"labels":\["cat","dog","fish"\],"probability":\[0.6,0.3,0.1\]}'
, then set LabelAttribute
to 'labels'
to extract the list of label headers \["cat","dog","fish"\]
Sourcepub fn label_headers(self, input: impl Into<String>) -> Self
pub fn label_headers(self, input: impl Into<String>) -> Self
Appends an item to label_headers
.
To override the contents of this collection use set_label_headers
.
For multiclass classification problems, the label headers are the names of the classes. Otherwise, the label header is the name of the predicted label. These are used to help readability for the output of the InvokeEndpoint
API. See the response section under Invoke the endpoint in the Developer Guide for more information. If there are no label headers in the model container output, provide them manually using this parameter.
Sourcepub fn set_label_headers(self, input: Option<Vec<String>>) -> Self
pub fn set_label_headers(self, input: Option<Vec<String>>) -> Self
For multiclass classification problems, the label headers are the names of the classes. Otherwise, the label header is the name of the predicted label. These are used to help readability for the output of the InvokeEndpoint
API. See the response section under Invoke the endpoint in the Developer Guide for more information. If there are no label headers in the model container output, provide them manually using this parameter.
Sourcepub fn get_label_headers(&self) -> &Option<Vec<String>>
pub fn get_label_headers(&self) -> &Option<Vec<String>>
For multiclass classification problems, the label headers are the names of the classes. Otherwise, the label header is the name of the predicted label. These are used to help readability for the output of the InvokeEndpoint
API. See the response section under Invoke the endpoint in the Developer Guide for more information. If there are no label headers in the model container output, provide them manually using this parameter.
Sourcepub fn feature_headers(self, input: impl Into<String>) -> Self
pub fn feature_headers(self, input: impl Into<String>) -> Self
Appends an item to feature_headers
.
To override the contents of this collection use set_feature_headers
.
The names of the features. If provided, these are included in the endpoint response payload to help readability of the InvokeEndpoint
output. See the Response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn set_feature_headers(self, input: Option<Vec<String>>) -> Self
pub fn set_feature_headers(self, input: Option<Vec<String>>) -> Self
The names of the features. If provided, these are included in the endpoint response payload to help readability of the InvokeEndpoint
output. See the Response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn get_feature_headers(&self) -> &Option<Vec<String>>
pub fn get_feature_headers(&self) -> &Option<Vec<String>>
The names of the features. If provided, these are included in the endpoint response payload to help readability of the InvokeEndpoint
output. See the Response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn feature_types(self, input: ClarifyFeatureType) -> Self
pub fn feature_types(self, input: ClarifyFeatureType) -> Self
Appends an item to feature_types
.
To override the contents of this collection use set_feature_types
.
A list of data types of the features (optional). Applicable only to NLP explainability. If provided, FeatureTypes
must have at least one 'text'
string (for example, \['text'\]
). If FeatureTypes
is not provided, the explainer infers the feature types based on the baseline data. The feature types are included in the endpoint response payload. For additional information see the response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn set_feature_types(self, input: Option<Vec<ClarifyFeatureType>>) -> Self
pub fn set_feature_types(self, input: Option<Vec<ClarifyFeatureType>>) -> Self
A list of data types of the features (optional). Applicable only to NLP explainability. If provided, FeatureTypes
must have at least one 'text'
string (for example, \['text'\]
). If FeatureTypes
is not provided, the explainer infers the feature types based on the baseline data. The feature types are included in the endpoint response payload. For additional information see the response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn get_feature_types(&self) -> &Option<Vec<ClarifyFeatureType>>
pub fn get_feature_types(&self) -> &Option<Vec<ClarifyFeatureType>>
A list of data types of the features (optional). Applicable only to NLP explainability. If provided, FeatureTypes
must have at least one 'text'
string (for example, \['text'\]
). If FeatureTypes
is not provided, the explainer infers the feature types based on the baseline data. The feature types are included in the endpoint response payload. For additional information see the response section under Invoke the endpoint in the Developer Guide for more information.
Sourcepub fn build(self) -> ClarifyInferenceConfig
pub fn build(self) -> ClarifyInferenceConfig
Consumes the builder and constructs a ClarifyInferenceConfig
.
Trait Implementations§
Source§impl Clone for ClarifyInferenceConfigBuilder
impl Clone for ClarifyInferenceConfigBuilder
Source§fn clone(&self) -> ClarifyInferenceConfigBuilder
fn clone(&self) -> ClarifyInferenceConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for ClarifyInferenceConfigBuilder
impl Default for ClarifyInferenceConfigBuilder
Source§fn default() -> ClarifyInferenceConfigBuilder
fn default() -> ClarifyInferenceConfigBuilder
Source§impl PartialEq for ClarifyInferenceConfigBuilder
impl PartialEq for ClarifyInferenceConfigBuilder
Source§fn eq(&self, other: &ClarifyInferenceConfigBuilder) -> bool
fn eq(&self, other: &ClarifyInferenceConfigBuilder) -> bool
self
and other
values to be equal, and is used by ==
.impl StructuralPartialEq for ClarifyInferenceConfigBuilder
Auto Trait Implementations§
impl Freeze for ClarifyInferenceConfigBuilder
impl RefUnwindSafe for ClarifyInferenceConfigBuilder
impl Send for ClarifyInferenceConfigBuilder
impl Sync for ClarifyInferenceConfigBuilder
impl Unpin for ClarifyInferenceConfigBuilder
impl UnwindSafe for ClarifyInferenceConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);