Skip to content

[7.11] [DOCS] Add scatterplot matrix to outlier detection example (#1507) #1537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 53 additions & 14 deletions docs/en/stack/ml/df-analytics/ecommerce-outliers.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ such that we get a new index that contains a sales summary for each customer.

In particular, create a {transform} that calculates the sum of the products
(`products.quantity`) and the sum of prices (`products.taxful_price`) in all of
the orders, grouped by customer (`customer_full_name`). Also include a value
the orders, grouped by customer (`customer_full_name.keyword`). Also include a value
count aggregation, so that we know how many orders (`order_id`) exist for each
customer.

You can preview the {transform} before you create it in {kib}:
You can preview the {transform} before you create it in *{stack-manage-app}*
> *Transforms*:

[role="screenshot"]
image::images/ecommerce-transform-preview.png["Creating a {transform} in {kib}"]
Expand Down Expand Up @@ -152,12 +153,26 @@ POST _data_frame/transforms/ecommerce-customer-sales/_start
. Create a {dfanalytics-job} to detect outliers in the new entity-centric index.
+
--
There is a wizard for creating {dfanalytics-jobs} on the
*Machine Learning* > *Data Frame Analytics* page in {kib}:
In the wizard on the *Machine Learning* > *Data Frame Analytics* page in {kib},
select your new index pattern then use the default values for {oldetection}. For
example:

[role="screenshot"]
image::images/ecommerce-outlier-job-1.png["Create a {dfanalytics-job} in {kib}"]

The wizard includes a scatterplot matrix, which enables you to explore the
relationships between the fields. You can use that information to help you
decide which fields to include or exclude from the analysis.

[role="screenshot"]
image::images/ecommerce-outlier-scatterplot.png["A scatterplot matrix for three fields in {kib}"]

If you want these charts to represent data from a larger sample size or from a
randomized selection of documents, you can change the default behavior. However,
a larger sample size might slow down the performance of the matrix and a
randomized selection might put more load on the cluster due to the more
intensive query.

Alternatively, you can use the
{ref}/put-dfanalytics.html[create {dfanalytics-jobs} API].

Expand Down Expand Up @@ -191,8 +206,8 @@ PUT _ml/data_frame/analytics/ecommerce
+
--
You can start, stop, and manage {dfanalytics-jobs} on the
*Machine Learning* > *Data Frame Analytics* page in {kib}. Alternatively, you
can use the {ref}/start-dfanalytics.html[start {dfanalytics-jobs}] and
*Machine Learning* > *Data Frame Analytics* page. Alternatively, you can use the
{ref}/start-dfanalytics.html[start {dfanalytics-jobs}] and
{ref}/stop-dfanalytics.html[stop {dfanalytics-jobs}] APIs.

.API example
Expand Down Expand Up @@ -248,16 +263,40 @@ The search results include the following {oldetection} scores:
[source,js]
--------------------------------------------------
...
"ml" : {
"outlier_score" : 0.9653657078742981,
"feature_influence.products.quantity.sum" : 0.00592468399554491,
"feature_influence.order_id.value_count" : 0.01975759118795395,
"feature_influence.products.taxful_price.sum" : 0.974317729473114
"ml" : {
"outlier_score" : 0.9706582427024841,
"feature_influence" : [
{
"feature_name" : "order_id.value_count",
"influence" : 0.015179949812591076
},
{
"feature_name" : "products.quantity.sum",
"influence" : 0.003752298653125763
},
{
"feature_name" : "products.taxful_price.sum",
"influence" : 0.9810677766799927
}
]
}
...
--------------------------------------------------
// NOTCONSOLE
====

{kib} also provides a scatterplot matrix in the results. Outliers with a score
that exceeds the threshold are highlighted in each chart:

[role="screenshot"]
image::images/outliers-scatterplot.png["View scatterplot in {oldetection} results"]

In addition to the sample size and random scoring options, there is a
*Dynamic size* option. If you enable this option, the size of each point is
affected by its {olscore}; that is to say, the largest points have the
highest {olscores}. The goal of these charts and options is to help you
visualize and explore the outliers within your data.

--

Now that you've found unusual behavior in the sample data set, consider how you
Expand All @@ -269,9 +308,9 @@ algorithms perform by using the evaluate {dfanalytics} API. See
TIP: If you do not want to keep the {transform} and the {dfanalytics-job}, you
can delete them in {kib} or use the
{ref}/delete-data-frame-transform.html[delete {transform} API] and
{ref}/delete-dfanalytics.html[delete {dfanalytics-job} API]. When
you delete {transforms} and {dfanalytics-jobs}, the destination indices and
{kib} index patterns remain.
{ref}/delete-dfanalytics.html[delete {dfanalytics-job} API]. When you delete
{transforms} and {dfanalytics-jobs} in {kib}, you have the option to also remove
the destination indices and index patterns.

If you want to see another example of {oldetection} in a Jupyter notebook,
https://github.com/elastic/examples/tree/master/Machine%20Learning/Outlier%20Detection/Introduction[click here].
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en/stack/ml/df-analytics/images/outliers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.