Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with the Elastic Stack

You're reading from   Machine Learning with the Elastic Stack Expert techniques to integrate machine learning with distributed search and analytics

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781788477543
Length 304 pages
Edition 1st Edition
Arrow right icon
Authors (2):
Arrow left icon
Bahaaldine Azarmi Bahaaldine Azarmi
Author Profile Icon Bahaaldine Azarmi
Bahaaldine Azarmi
Rich Collier Rich Collier
Author Profile Icon Rich Collier
Rich Collier
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface Machine Learning for IT FREE CHAPTER Installing the Elastic Stack with Machine Learning Event Change Detection IT Operational Analytics and Root Cause Analysis Security Analytics with Elastic Machine Learning Alerting on ML Analysis Using Elastic ML Data in Kibana Dashboards Using Elastic ML with Kibana Canvas Forecasting ML Tips and Tricks Other Books You May Enjoy

Using ML on scripted fields

In some cases, it might be necessary to analyze the relationship of fields within documents. Elasticsearch gives us the ability to create scripted fields (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html) that allow us to programmatically combine individual fields into new fields; ML can then leverage that!

For example, let's say you have daily documents that summarize your product sales and that your documents have two fields, Amount and Count:

{
...
    "Count": 160,
    "Amount": 7200
...
}

We could easily define a use case in which we were interested in the per item cost (Amount/Count). To do so, we would define the ML job to focus on the new field (perhaps we'll call it per_item_cost and use the mean function on it):

PUT _xpack/ml/anomaly_detectors/my_job {
    &quot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime