Skip to content
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

[ML] DF Analytics Classification: ensure confusion matrix can be fetched #53629

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Dec 19, 2019

Summary

NOTE This will need to be updated with additional changes (elastic/elasticsearch#50219) to the endpoint that just went in. I'll ping when it's ready for another review. Apologies
-- This has been updated and is ready for a final look.

Add dependent_variable field type check before hitting the _evaluate endpoint for the confusion matrix.

Accounts for changes to the _evaluate endpoint introduced in elastic/ml-cpp#877 in which the .keyword suffix will no longer be needed for boolean or integer dependent variable fields

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@alvarezmelissa87 alvarezmelissa87 added :ml v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Data Frame Analytics ML data frame analytics features v7.6.0 labels Dec 19, 2019
@alvarezmelissa87 alvarezmelissa87 requested a review from a team as a code owner December 19, 2019 20:19
@alvarezmelissa87 alvarezmelissa87 self-assigned this Dec 19, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

await newJobCapsService.initializeFromIndexPattern(indexPattern);
// Check dependent_variable field type to see if .keyword suffix is required for evaluate endpoint
const { fields } = newJobCapsService;
const depVarFieldType = fields.find((field: any) => field.name === dependentVariable)?.type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By saying this field is any you're losing the type information that you get from free from the fields array.
there is no need to add a type here at all as it knows it's a Field[]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - removed in 0a79e2a39475beff24b51a40e78f6d6d3e806cca

@@ -37,8 +38,12 @@ import {
} from '../../../../common/analytics';
import { LoadingPanel } from '../loading_panel';
import { getColumnData } from './column_data';
import { useKibanaContext } from '../../../../../contexts/kibana';
import { newJobCapsService } from '../../../../../services/new_job_capabilities_service';
import { getIndexPatternIdFromName } from '../../../../../../application/util/index_utils';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this goes one level too deep. it doesn't need to go outside application

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated in 0a79e2a39475beff24b51a40e78f6d6d3e806cca


const defaultPanelWidth = 500;
const NO_KEYWORD_FIELDTYPES = ['boolean', 'integer'];
Copy link
Member

@jgowdyelastic jgowdyelastic Dec 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be
const NO_KEYWORD_FIELDTYPES = [ES_FIELD_TYPES.BOOLEAN, ES_FIELD_TYPES.INTEGER];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 0a79e2a39475beff24b51a40e78f6d6d3e806cca

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question on the IndexPattern import, but otherwise LGTM

@@ -7,6 +7,7 @@
import React, { FC, useState, useEffect, Fragment } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { IndexPattern } from 'ui/index_patterns';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at kibana_context.ts can this import be from src/plugins/data/public - IndexPatternsContract ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the type should be IIndexPattern from the same location.
I plan to change all of our uses of IndexPattern to be of that type in future NP work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 0a79e2a39475beff24b51a40e78f6d6d3e806cca

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-df-classification-evaluate-update branch from 0a79e2a to 4f4a4eb Compare December 28, 2019 20:56
@elastic elastic deleted a comment from elasticmachine Dec 28, 2019
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest edits LGTM

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-df-classification-evaluate-update branch from 4f4a4eb to 6c6689c Compare January 7, 2020 15:05
@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-df-classification-evaluate-update branch from 1b12463 to c22a2ab Compare January 7, 2020 15:56
Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@peteharverson peteharverson self-requested a review January 8, 2020 11:48
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running against the latest ES mini stack build, the confusion matrix isn't being displayed for the classification jobs I've run.

From the call to the _evaluate endpoint, I see errors in the network tab of the form:

{"statusCode":400,"error":"Bad Request","message":"[status_exception] No documents found containing both [stabf, ml.stabf_prediction.keyword] fields"}

and a call to the es_search endpoint is failing with:

{"statusCode":400,"error":"Bad Request","message":"[query_shard_exception] No mapping found for [ml.stabf_prediction.keyword] in order to sort on, with { index_uuid=\"1-YoKSD5TWGllOcCrGZCoQ\" & index=\"electrical_grid_stab_class\" }"}

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested latest edits and LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 merged commit fc948a0 into elastic:master Jan 8, 2020
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Jan 8, 2020
…hed (elastic#53629)

* check depVar field type before adding keyword suffix for evaluate endpoint

* update indexPattern type and use FIELD types

* add keyword suffix if field type is keyword

* keyword suffix added if depVar is of type keyword AND text
@alvarezmelissa87 alvarezmelissa87 deleted the ml-df-classification-evaluate-update branch January 8, 2020 18:40
alvarezmelissa87 added a commit that referenced this pull request Jan 8, 2020
…hed (#53629) (#54288)

* check depVar field type before adding keyword suffix for evaluate endpoint

* update indexPattern type and use FIELD types

* add keyword suffix if field type is keyword

* keyword suffix added if depVar is of type keyword AND text
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 9, 2020
* master: (23 commits)
  [Vis: Default editor] Reactify the timelion editor (elastic#52990)
  [Discover] fix histogram min interval (elastic#53979)
  [Telemetry] [Monitoring] Only retry fetching usage once monito… (elastic#54309)
  [docs][APM] Add runtime index config documentation (elastic#53907)
  [SIEM] Detection engine timeline (elastic#53783)
  Filter scripted fields preview field list to source fields (elastic#53826)
  Management - New platform api (elastic#52579)
  Reset region and Account when switching inventory (elastic#54287)
  [SIEM] [Case] Case workflow api schema (elastic#51535)
  Code coverage setup on CI (elastic#49003)
  [ML] DF Analytics Results: adds link to docs (elastic#54189)
  Update schemas boolean, byteSize, and duration to coerce strings (elastic#54177)
  [Metrics UI] Pass relevant shouldAllowEdit capabilities into SettingsPage (elastic#49781)
  [Canvas] Fixes bugs with autoplay and refresh (elastic#53149)
  [ML] DF Analytics Classification: ensure confusion matrix can be fetched (elastic#53629)
  Fix Vega react eslint errors (elastic#54259)
  Remove non existing codeowners (elastic#54274)
  use correct type (elastic#54244)
  [Dashboard] Removing 100% as dshDashboardViewport height (elastic#54263)
  add `examples/` to no-restricted-path config (elastic#54252)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Frame Analytics ML data frame analytics features :ml release_note:skip Skip the PR/issue when compiling release notes v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants