2019-11-22 15:06:10 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="platinum"]
|
|
|
|
[[explain-dfanalytics]]
|
2020-07-20 16:06:29 -04:00
|
|
|
= Explain {dfanalytics} API
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
[subs="attributes"]
|
|
|
|
++++
|
|
|
|
<titleabbrev>Explain {dfanalytics} API</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
Explains a {dataframe-analytics-config}.
|
|
|
|
|
|
|
|
experimental[]
|
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-request]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-request-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
`GET _ml/data_frame/analytics/_explain` +
|
|
|
|
|
|
|
|
`POST _ml/data_frame/analytics/_explain` +
|
|
|
|
|
|
|
|
`GET _ml/data_frame/analytics/<data_frame_analytics_id>/_explain` +
|
|
|
|
|
|
|
|
`POST _ml/data_frame/analytics/<data_frame_analytics_id>/_explain`
|
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-prereq]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-prereq-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
2020-01-09 04:44:07 -05:00
|
|
|
If the {es} {security-features} are enabled, you must have the following privileges:
|
|
|
|
|
|
|
|
* cluster: `monitor_ml`
|
|
|
|
|
2020-07-23 19:43:10 -04:00
|
|
|
For more information, see <<security-privileges>> and {ml-docs-setup-privileges}.
|
2019-11-22 15:06:10 -05:00
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-desc]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-description-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
This API provides explanations for a {dataframe-analytics-config} that either
|
|
|
|
exists already or one that has not been created yet.
|
2019-11-22 15:06:10 -05:00
|
|
|
The following explanations are provided:
|
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
* which fields are included or not in the analysis and why,
|
|
|
|
* how much memory is estimated to be required. The estimate can be used when
|
2020-01-17 07:02:59 -05:00
|
|
|
deciding the appropriate value for `model_memory_limit` setting later on.
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2020-01-17 07:02:59 -05:00
|
|
|
If you have object fields or fields that are excluded via source filtering,
|
|
|
|
they are not included in the explanation.
|
2019-11-22 15:06:10 -05:00
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-path-params]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-path-parms-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
`<data_frame_analytics_id>`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(Optional, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics]
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-request-body]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-request-body-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
2020-03-31 11:56:52 -04:00
|
|
|
A {dataframe-analytics-config} as described in <<put-dfanalytics>>.
|
|
|
|
Note that `id` and `dest` don't need to be provided in the context of this API.
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2020-03-31 15:51:04 -04:00
|
|
|
[role="child_attributes"]
|
2019-11-22 15:06:10 -05:00
|
|
|
[[ml-explain-dfanalytics-results]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-response-body-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
The API returns a response that contains the following:
|
|
|
|
|
|
|
|
`field_selection`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(array)
|
2020-04-14 21:47:09 -04:00
|
|
|
An array of objects that explain selection for each field, sorted by
|
|
|
|
the field names.
|
|
|
|
+
|
|
|
|
.Properties of `field_selection` objects
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
`is_included`:::
|
|
|
|
(boolean) Whether the field is selected to be included in the analysis.
|
|
|
|
|
|
|
|
`is_required`:::
|
|
|
|
(boolean) Whether the field is required.
|
|
|
|
|
|
|
|
`feature_type`:::
|
|
|
|
(string) The feature type of this field for the analysis. May be `categorical`
|
|
|
|
or `numerical`.
|
|
|
|
|
|
|
|
`mapping_types`:::
|
|
|
|
(string) The mapping types of the field.
|
|
|
|
|
|
|
|
`name`:::
|
|
|
|
(string) The field name.
|
|
|
|
|
|
|
|
`reason`:::
|
|
|
|
(string) The reason a field is not selected to be included in the analysis.
|
|
|
|
====
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
`memory_estimation`::
|
2020-04-14 21:47:09 -04:00
|
|
|
(object)
|
|
|
|
An object containing the memory estimates.
|
|
|
|
+
|
|
|
|
.Properties of `memory_estimation`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
`expected_memory_with_disk`:::
|
|
|
|
(string) Estimated memory usage under the assumption that overflowing to disk is
|
|
|
|
allowed during {dfanalytics}. `expected_memory_with_disk` is usually smaller
|
|
|
|
than `expected_memory_without_disk` as using disk allows to limit the main
|
|
|
|
memory needed to perform {dfanalytics}.
|
|
|
|
|
|
|
|
`expected_memory_without_disk`:::
|
|
|
|
(string) Estimated memory usage under the assumption that the whole
|
|
|
|
{dfanalytics} should happen in memory (i.e. without overflowing to disk).
|
|
|
|
====
|
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
[[ml-explain-dfanalytics-example]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-examples-title}
|
2019-11-22 15:06:10 -05:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST _ml/data_frame/analytics/_explain
|
|
|
|
{
|
2020-03-31 11:56:52 -04:00
|
|
|
"source": {
|
|
|
|
"index": "houses_sold_last_10_yrs"
|
|
|
|
},
|
|
|
|
"analysis": {
|
|
|
|
"regression": {
|
|
|
|
"dependent_variable": "price"
|
2019-11-22 15:06:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:TBD]
|
|
|
|
|
2019-12-13 05:48:21 -05:00
|
|
|
|
2019-11-22 15:06:10 -05:00
|
|
|
The API returns the following results:
|
|
|
|
|
|
|
|
[source,console-result]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"field_selection": [
|
|
|
|
{
|
|
|
|
"field": "number_of_bedrooms",
|
|
|
|
"mappings_types": ["integer"],
|
|
|
|
"is_included": true,
|
|
|
|
"is_required": false,
|
|
|
|
"feature_type": "numerical"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"field": "postcode",
|
|
|
|
"mappings_types": ["text"],
|
|
|
|
"is_included": false,
|
|
|
|
"is_required": false,
|
|
|
|
"reason": "[postcode.keyword] is preferred because it is aggregatable"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"field": "postcode.keyword",
|
|
|
|
"mappings_types": ["keyword"],
|
|
|
|
"is_included": true,
|
|
|
|
"is_required": false,
|
|
|
|
"feature_type": "categorical"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"field": "price",
|
|
|
|
"mappings_types": ["float"],
|
|
|
|
"is_included": true,
|
|
|
|
"is_required": true,
|
|
|
|
"feature_type": "numerical"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"memory_estimation": {
|
|
|
|
"expected_memory_without_disk": "128MB",
|
|
|
|
"expected_memory_with_disk": "32MB"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----
|