getDataInsights

3 min read

Automatically discovering interesting patterns from multi-dimensional data.

getDataInsights

(data: Datum[], options?: InsightOptions) => { insights: InsightInfo[], homogeneousInsights?: HomogeneousInsightInfo[] }

Run different algorithms from multi-dimensional data to discover interesting patterns in the data, and perform unified evaluation of different types of patterns, and return high-quality data insights based on scores.

  • InsightOptions configure the pipeline of Auto-Insights.
PropertiesTypeDescriptionDefault
measuresMeasure[]Specify the fields as measures and the corresponding aggregation methods.All quantitative (numeric) fields
dimensionsDimensions[]Specify the dimensions involved in the calculation.All categorical, time fields
insightTypesInsightType[]Specify the types of insight.['category_outlier', 'trend', 'change_point', 'time_series_outlier', 'majority','low_variance'](All supported types)
limitnumberLimit on the number of insights.30
visualizationboolean | VisualizationOptionson / off the output of visualization scheme, or visualization options.false
impactMeasuresImpactMeasure[]Measures for Impact score.none
impactWeightnumber ∈(0, 1)Insight score = Impact score * impactWeight + Significance * (1 - impactWeight).0.3
homogeneousbooleanon/off extra homogeneous insight extraction.false
ignoreSubspacebooleanWhether to close the search for subspaces.false
  • VisualizationOptions Insight output visualization options
PropertiesTypeDescriptionDefault
summaryTypetext|schemapure text or text schema to description insight summary'text'
  • InsightInfo|HomogeneousInsightInfo Insight information.
PropertiesTypeDescriptionExample
subspaceSubspaceThe subspace of the data subject[{ dimension: 'Year', value: '2000' }](subspace: Year = 2000)
dimensionsstring[]The dimensions of the data subject['country']
measuresMeasure[]The measures of the data subject[{ field: 'life_expect', method: 'MEAN' }]
dataDatum[]data[{ country: 'China', life_expect: 61 }]
patternsPatternInfo[]The collection of patterns in the data[{ type: 'outlier', significance: 0.98, dimension: 'country', measure: 'life_expect', index: 5, x: 'china', y: '43' }, ...]
visualizationSchemasVisualizationSchema[]The insight visualization scheme, including chart type, title, insight description, and chart configuration (based on G2Plot)[{ type: 'column_chart', caption: string, insightSummaries: string[] | IPhrase[][], chartSchema: G2PlotConfig }]

IPhrase Description of phrase

Phrase descriptions are distinguished by type, which is divided into text phrases and entity phrases, and entity phrases are used to mark lexical attributes. The current descriptions in the lite-insight module involve entity types such as

  • 'metric_name': Metric Name;
  • 'metric_value': Metric Value;
  • 'trend_desc': Trend Description;
  • 'dim_value': Dimension Value;
export type IPhrase = ITextPhrase | IEntityPhrase;

export interface ITextPhrase {
  type: 'text';
  value: string;
}

export interface IEntityPhrase {
  type: 'entity';
  value?: string;
  metadata?: {
    entityType: 'metric_name' | 'metric_value' | 'trend_desc' | 'dim_value';
  };
}

Usage

  • Specify the measures and dimensions involved in the calculation, and the number of insights returned.
import { getDataInsights } from '@antv/lite-insight';

getDataInsights(data, {
  limit: 30,
  dimensions: ['year', 'country'],
  measures: [
    { field: 'life_expect', method: 'MEAN' },
    { field: 'pop', method: 'SUM' },
    { field: 'fertility', method: 'MEAN' },
  ]
});
  • Set the measures of the impact score, and adjust the calculation weight of the relevant factors (significance, impact) in the calculation of the insight score.
import { getDataInsights } from '@antv/lite-insight';


getDataInsights(data, {
  impactWeight: 0.5,
  impactMeasures: [
    { field: 'life_expect', method: 'COUNT' },
    { field: 'pop', method: 'SUM' },
  ]
});
  • Enable the extraction of homogeneous data patterns.
import { getDataInsights } from '@antv/lite-insight';

const result = getDataInsights(data, {
  homogeneous: true
});

const { insights, homogeneousInsights } = result;
console.log(homogeneousInsights);

getDataInsightsAsync

(data: Datum[], options?: InsightOptions) => Promise<{ insights: InsightInfo[], homogeneousInsights?: HomogeneousInsightInfo[] }>

Async version of getDataInsights.