@formant/ava 3.4.1-formant
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/ava.min.js +1 -0
- package/esm/advisor/advise-pipeline/advicesForChart.js +68 -0
- package/esm/advisor/advise-pipeline/data-to-advices.js +241 -0
- package/esm/advisor/advise-pipeline/index.js +1 -0
- package/esm/advisor/advise-pipeline/spec-mapping.js +500 -0
- package/esm/advisor/advisor.js +35 -0
- package/esm/advisor/constants.js +13 -0
- package/esm/advisor/index.js +2 -0
- package/esm/advisor/lint-pipeline/check-rules.js +43 -0
- package/esm/advisor/lint-pipeline/getChartType.js +109 -0
- package/esm/advisor/lint-pipeline/index.js +0 -0
- package/esm/advisor/lint-pipeline/lintRules.js +32 -0
- package/esm/advisor/ruler/index.js +74 -0
- package/esm/advisor/ruler/rules/aggregation-single-row.js +21 -0
- package/esm/advisor/ruler/rules/all-can-be-table.js +17 -0
- package/esm/advisor/ruler/rules/bar-series-qty.js +36 -0
- package/esm/advisor/ruler/rules/bar-without-axis-min.js +41 -0
- package/esm/advisor/ruler/rules/constants.js +6 -0
- package/esm/advisor/ruler/rules/data-check.js +40 -0
- package/esm/advisor/ruler/rules/data-field-qty.js +26 -0
- package/esm/advisor/ruler/rules/diff-pie-sector.js +33 -0
- package/esm/advisor/ruler/rules/index.js +68 -0
- package/esm/advisor/ruler/rules/landscape-or-portrait.js +40 -0
- package/esm/advisor/ruler/rules/limit-series.js +47 -0
- package/esm/advisor/ruler/rules/line-field-time-ordinal.js +25 -0
- package/esm/advisor/ruler/rules/no-redundant-field.js +32 -0
- package/esm/advisor/ruler/rules/nominal-enum-combinatorial.js +54 -0
- package/esm/advisor/ruler/rules/purpose-check.js +27 -0
- package/esm/advisor/ruler/rules/series-qty-limit.js +34 -0
- package/esm/advisor/ruler/rules/x-axis-line-fading.js +41 -0
- package/esm/advisor/ruler/types.js +1 -0
- package/esm/advisor/ruler/utils.js +54 -0
- package/esm/advisor/types.js +1 -0
- package/esm/advisor/utils/clone.js +32 -0
- package/esm/advisor/utils/compare.js +14 -0
- package/esm/advisor/utils/computeScore.js +25 -0
- package/esm/advisor/utils/deep-mix.js +76 -0
- package/esm/advisor/utils/hasSubset.js +3 -0
- package/esm/advisor/utils/index.js +8 -0
- package/esm/advisor/utils/inferDataType.js +70 -0
- package/esm/advisor/utils/intersects.js +3 -0
- package/esm/advisor/utils/isNil.js +4 -0
- package/esm/ckb/base.js +1310 -0
- package/esm/ckb/ckb.js +55 -0
- package/esm/ckb/constants.js +197 -0
- package/esm/ckb/i18n/index.js +23 -0
- package/esm/ckb/i18n/types.js +1 -0
- package/esm/ckb/i18n/zh-CN.js +525 -0
- package/esm/ckb/index.js +14 -0
- package/esm/ckb/types.js +1 -0
- package/esm/common/types.js +1 -0
- package/esm/data/analysis/field/index.js +336 -0
- package/esm/data/analysis/field/types.js +1 -0
- package/esm/data/analysis/graph/index.js +170 -0
- package/esm/data/analysis/graph/types.js +1 -0
- package/esm/data/analysis/index.js +1 -0
- package/esm/data/analysis/types.js +1 -0
- package/esm/data/dataset/field/baseFrame.js +76 -0
- package/esm/data/dataset/field/dataFrame.js +556 -0
- package/esm/data/dataset/field/index.js +3 -0
- package/esm/data/dataset/field/series.js +149 -0
- package/esm/data/dataset/field/types.js +1 -0
- package/esm/data/dataset/field/utils.js +58 -0
- package/esm/data/dataset/graph/index.js +186 -0
- package/esm/data/dataset/graph/types.js +1 -0
- package/esm/data/dataset/graph/utils.js +15 -0
- package/esm/data/dataset/index.js +1 -0
- package/esm/data/dataset/types.js +1 -0
- package/esm/data/index.js +5 -0
- package/esm/data/statistics/IQR.js +49 -0
- package/esm/data/statistics/base.js +248 -0
- package/esm/data/statistics/bayesian.js +25 -0
- package/esm/data/statistics/buishand-u.js +19 -0
- package/esm/data/statistics/caches.js +28 -0
- package/esm/data/statistics/cdf.js +25 -0
- package/esm/data/statistics/constants.js +12 -0
- package/esm/data/statistics/index.js +7 -0
- package/esm/data/statistics/lowess.js +80 -0
- package/esm/data/statistics/mannkendall-test.js +50 -0
- package/esm/data/statistics/maxabs.js +9 -0
- package/esm/data/statistics/pcorrtest.js +76 -0
- package/esm/data/statistics/pettitt-test.js +33 -0
- package/esm/data/statistics/quantile.js +56 -0
- package/esm/data/statistics/types.js +1 -0
- package/esm/data/statistics/vector.js +67 -0
- package/esm/data/statistics/window.js +55 -0
- package/esm/data/types.js +2 -0
- package/esm/data/utils/common.js +58 -0
- package/esm/data/utils/index.js +5 -0
- package/esm/data/utils/isType/constants.js +24 -0
- package/esm/data/utils/isType/index.js +2 -0
- package/esm/data/utils/isType/isDateString.js +104 -0
- package/esm/data/utils/isType/isType.js +78 -0
- package/esm/index.js +11 -0
- package/esm/insight/algorithms/base/compare.js +40 -0
- package/esm/insight/algorithms/categoryOutlier.js +4 -0
- package/esm/insight/algorithms/changePoint.js +10 -0
- package/esm/insight/algorithms/index.js +3 -0
- package/esm/insight/algorithms/trendDirection.js +4 -0
- package/esm/insight/chart/constants.js +25 -0
- package/esm/insight/chart/generator/homogeneous.js +70 -0
- package/esm/insight/chart/generator/index.js +2 -0
- package/esm/insight/chart/generator/insights.js +16 -0
- package/esm/insight/chart/index.js +4 -0
- package/esm/insight/chart/strategy/augmentedMarks/categoryOutlier.js +30 -0
- package/esm/insight/chart/strategy/augmentedMarks/changePoint.js +42 -0
- package/esm/insight/chart/strategy/augmentedMarks/correlation.js +6 -0
- package/esm/insight/chart/strategy/augmentedMarks/homogeneous.js +5 -0
- package/esm/insight/chart/strategy/augmentedMarks/index.js +8 -0
- package/esm/insight/chart/strategy/augmentedMarks/lowVariance.js +23 -0
- package/esm/insight/chart/strategy/augmentedMarks/majority.js +5 -0
- package/esm/insight/chart/strategy/augmentedMarks/timeSeriesOutlier.js +82 -0
- package/esm/insight/chart/strategy/augmentedMarks/trend.js +26 -0
- package/esm/insight/chart/strategy/chart.js +45 -0
- package/esm/insight/chart/strategy/commonMarks/areaMark.js +12 -0
- package/esm/insight/chart/strategy/commonMarks/index.js +5 -0
- package/esm/insight/chart/strategy/commonMarks/intervalMark.js +14 -0
- package/esm/insight/chart/strategy/commonMarks/lineMark.js +34 -0
- package/esm/insight/chart/strategy/commonMarks/pointMark.js +17 -0
- package/esm/insight/chart/strategy/commonMarks/textMark.js +28 -0
- package/esm/insight/chart/strategy/index.js +4 -0
- package/esm/insight/chart/strategy/viewSpec.js +16 -0
- package/esm/insight/chart/types.js +1 -0
- package/esm/insight/chart/utils.js +4 -0
- package/esm/insight/constant.js +21 -0
- package/esm/insight/index.js +5 -0
- package/esm/insight/insights/checkers.js +97 -0
- package/esm/insight/insights/extractors/categoryOutlier.js +90 -0
- package/esm/insight/insights/extractors/changePoint.js +55 -0
- package/esm/insight/insights/extractors/correlation.js +38 -0
- package/esm/insight/insights/extractors/homogeneous.js +98 -0
- package/esm/insight/insights/extractors/lowVariance.js +49 -0
- package/esm/insight/insights/extractors/majority.js +66 -0
- package/esm/insight/insights/extractors/timeSeriesOutlier.js +61 -0
- package/esm/insight/insights/extractors/trend.js +49 -0
- package/esm/insight/insights/index.js +28 -0
- package/esm/insight/insights/util.js +77 -0
- package/esm/insight/narrative/factory.js +22 -0
- package/esm/insight/narrative/index.js +14 -0
- package/esm/insight/narrative/strategy/base.js +6 -0
- package/esm/insight/narrative/strategy/categoryOutlier.js +74 -0
- package/esm/insight/narrative/strategy/changePoint.js +52 -0
- package/esm/insight/narrative/strategy/commonness.js +45 -0
- package/esm/insight/narrative/strategy/correlation.js +51 -0
- package/esm/insight/narrative/strategy/exception.js +70 -0
- package/esm/insight/narrative/strategy/helpers.js +25 -0
- package/esm/insight/narrative/strategy/index.js +13 -0
- package/esm/insight/narrative/strategy/lowVariance.js +48 -0
- package/esm/insight/narrative/strategy/majority.js +62 -0
- package/esm/insight/narrative/strategy/timeSeriesOutlier.js +92 -0
- package/esm/insight/narrative/strategy/trend.js +57 -0
- package/esm/insight/pipeline/extract.js +236 -0
- package/esm/insight/pipeline/index.js +11 -0
- package/esm/insight/pipeline/insight.js +81 -0
- package/esm/insight/pipeline/preprocess.js +33 -0
- package/esm/insight/pipeline/specificInsight.js +71 -0
- package/esm/insight/pipeline/util.js +14 -0
- package/esm/insight/pipeline/visualize.js +41 -0
- package/esm/insight/types.js +1 -0
- package/esm/insight/utils/aggregate.js +87 -0
- package/esm/insight/utils/common.js +35 -0
- package/esm/ntv/generate/generateTextSpec.js +157 -0
- package/esm/ntv/generate/index.js +5 -0
- package/esm/ntv/generate/types.js +1 -0
- package/esm/ntv/generate/utils.js +86 -0
- package/esm/ntv/index.js +4 -0
- package/esm/ntv/schema/common.js +1 -0
- package/esm/ntv/schema/index.js +4 -0
- package/esm/ntv/schema/paragraph.js +1 -0
- package/esm/ntv/schema/phrase.js +52 -0
- package/esm/ntv/schema/structure.js +1 -0
- package/esm/ntv/types.js +1 -0
- package/esm/ntv/utils/index.js +1 -0
- package/esm/ntv/utils/isSpecType.js +58 -0
- package/esm/utils/arr2map.js +7 -0
- package/esm/utils/dataFormat.js +32 -0
- package/esm/utils/index.js +3 -0
- package/esm/utils/isType.js +14 -0
- package/lib/advisor/advise-pipeline/advicesForChart.d.ts +13 -0
- package/lib/advisor/advise-pipeline/advicesForChart.js +73 -0
- package/lib/advisor/advise-pipeline/data-to-advices.d.ts +22 -0
- package/lib/advisor/advise-pipeline/data-to-advices.js +245 -0
- package/lib/advisor/advise-pipeline/index.d.ts +1 -0
- package/lib/advisor/advise-pipeline/index.js +5 -0
- package/lib/advisor/advise-pipeline/spec-mapping.d.ts +14 -0
- package/lib/advisor/advise-pipeline/spec-mapping.js +504 -0
- package/lib/advisor/advisor.d.ts +18 -0
- package/lib/advisor/advisor.js +38 -0
- package/lib/advisor/constants.d.ts +1 -0
- package/lib/advisor/constants.js +16 -0
- package/lib/advisor/index.d.ts +2 -0
- package/lib/advisor/index.js +7 -0
- package/lib/advisor/lint-pipeline/check-rules.d.ts +4 -0
- package/lib/advisor/lint-pipeline/check-rules.js +47 -0
- package/lib/advisor/lint-pipeline/getChartType.d.ts +7 -0
- package/lib/advisor/lint-pipeline/getChartType.js +113 -0
- package/lib/advisor/lint-pipeline/index.d.ts +0 -0
- package/lib/advisor/lint-pipeline/index.js +0 -0
- package/lib/advisor/lint-pipeline/lintRules.d.ts +5 -0
- package/lib/advisor/lint-pipeline/lintRules.js +36 -0
- package/lib/advisor/ruler/index.d.ts +21 -0
- package/lib/advisor/ruler/index.js +80 -0
- package/lib/advisor/ruler/rules/aggregation-single-row.d.ts +2 -0
- package/lib/advisor/ruler/rules/aggregation-single-row.js +24 -0
- package/lib/advisor/ruler/rules/all-can-be-table.d.ts +2 -0
- package/lib/advisor/ruler/rules/all-can-be-table.js +20 -0
- package/lib/advisor/ruler/rules/bar-series-qty.d.ts +2 -0
- package/lib/advisor/ruler/rules/bar-series-qty.js +39 -0
- package/lib/advisor/ruler/rules/bar-without-axis-min.d.ts +2 -0
- package/lib/advisor/ruler/rules/bar-without-axis-min.js +44 -0
- package/lib/advisor/ruler/rules/constants.d.ts +6 -0
- package/lib/advisor/ruler/rules/constants.js +9 -0
- package/lib/advisor/ruler/rules/data-check.d.ts +2 -0
- package/lib/advisor/ruler/rules/data-check.js +43 -0
- package/lib/advisor/ruler/rules/data-field-qty.d.ts +2 -0
- package/lib/advisor/ruler/rules/data-field-qty.js +29 -0
- package/lib/advisor/ruler/rules/diff-pie-sector.d.ts +2 -0
- package/lib/advisor/ruler/rules/diff-pie-sector.js +36 -0
- package/lib/advisor/ruler/rules/index.d.ts +19 -0
- package/lib/advisor/ruler/rules/index.js +71 -0
- package/lib/advisor/ruler/rules/landscape-or-portrait.d.ts +2 -0
- package/lib/advisor/ruler/rules/landscape-or-portrait.js +43 -0
- package/lib/advisor/ruler/rules/limit-series.d.ts +2 -0
- package/lib/advisor/ruler/rules/limit-series.js +50 -0
- package/lib/advisor/ruler/rules/line-field-time-ordinal.d.ts +2 -0
- package/lib/advisor/ruler/rules/line-field-time-ordinal.js +28 -0
- package/lib/advisor/ruler/rules/no-redundant-field.d.ts +2 -0
- package/lib/advisor/ruler/rules/no-redundant-field.js +35 -0
- package/lib/advisor/ruler/rules/nominal-enum-combinatorial.d.ts +2 -0
- package/lib/advisor/ruler/rules/nominal-enum-combinatorial.js +57 -0
- package/lib/advisor/ruler/rules/purpose-check.d.ts +2 -0
- package/lib/advisor/ruler/rules/purpose-check.js +30 -0
- package/lib/advisor/ruler/rules/series-qty-limit.d.ts +2 -0
- package/lib/advisor/ruler/rules/series-qty-limit.js +37 -0
- package/lib/advisor/ruler/rules/x-axis-line-fading.d.ts +2 -0
- package/lib/advisor/ruler/rules/x-axis-line-fading.js +44 -0
- package/lib/advisor/ruler/types.d.ts +125 -0
- package/lib/advisor/ruler/types.js +2 -0
- package/lib/advisor/ruler/utils.d.ts +10 -0
- package/lib/advisor/ruler/utils.js +61 -0
- package/lib/advisor/types.d.ts +218 -0
- package/lib/advisor/types.js +4 -0
- package/lib/advisor/utils/clone.d.ts +2 -0
- package/lib/advisor/utils/clone.js +34 -0
- package/lib/advisor/utils/compare.d.ts +3 -0
- package/lib/advisor/utils/compare.js +17 -0
- package/lib/advisor/utils/computeScore.d.ts +7 -0
- package/lib/advisor/utils/computeScore.js +27 -0
- package/lib/advisor/utils/deep-mix.d.ts +2 -0
- package/lib/advisor/utils/deep-mix.js +78 -0
- package/lib/advisor/utils/hasSubset.d.ts +1 -0
- package/lib/advisor/utils/hasSubset.js +7 -0
- package/lib/advisor/utils/index.d.ts +5 -0
- package/lib/advisor/utils/index.js +19 -0
- package/lib/advisor/utils/inferDataType.d.ts +6 -0
- package/lib/advisor/utils/inferDataType.js +75 -0
- package/lib/advisor/utils/intersects.d.ts +1 -0
- package/lib/advisor/utils/intersects.js +7 -0
- package/lib/advisor/utils/isNil.d.ts +2 -0
- package/lib/advisor/utils/isNil.js +6 -0
- package/lib/ckb/base.d.ts +2 -0
- package/lib/ckb/base.js +1313 -0
- package/lib/ckb/ckb.d.ts +8 -0
- package/lib/ckb/ckb.js +59 -0
- package/lib/ckb/constants.d.ts +79 -0
- package/lib/ckb/constants.js +200 -0
- package/lib/ckb/i18n/index.d.ts +10 -0
- package/lib/ckb/i18n/index.js +27 -0
- package/lib/ckb/i18n/types.d.ts +52 -0
- package/lib/ckb/i18n/types.js +2 -0
- package/lib/ckb/i18n/zh-CN.d.ts +7 -0
- package/lib/ckb/i18n/zh-CN.js +528 -0
- package/lib/ckb/index.d.ts +4 -0
- package/lib/ckb/index.js +20 -0
- package/lib/ckb/types.d.ts +185 -0
- package/lib/ckb/types.js +2 -0
- package/lib/common/types.d.ts +14 -0
- package/lib/common/types.js +2 -0
- package/lib/data/analysis/field/index.d.ts +79 -0
- package/lib/data/analysis/field/index.js +355 -0
- package/lib/data/analysis/field/types.d.ts +99 -0
- package/lib/data/analysis/field/types.js +2 -0
- package/lib/data/analysis/graph/index.d.ts +28 -0
- package/lib/data/analysis/graph/index.js +178 -0
- package/lib/data/analysis/graph/types.d.ts +62 -0
- package/lib/data/analysis/graph/types.js +2 -0
- package/lib/data/analysis/index.d.ts +1 -0
- package/lib/data/analysis/index.js +5 -0
- package/lib/data/analysis/types.d.ts +1 -0
- package/lib/data/analysis/types.js +2 -0
- package/lib/data/dataset/field/baseFrame.d.ts +30 -0
- package/lib/data/dataset/field/baseFrame.js +78 -0
- package/lib/data/dataset/field/dataFrame.d.ts +35 -0
- package/lib/data/dataset/field/dataFrame.js +558 -0
- package/lib/data/dataset/field/index.d.ts +3 -0
- package/lib/data/dataset/field/index.js +8 -0
- package/lib/data/dataset/field/series.d.ts +18 -0
- package/lib/data/dataset/field/series.js +151 -0
- package/lib/data/dataset/field/types.d.ts +54 -0
- package/lib/data/dataset/field/types.js +2 -0
- package/lib/data/dataset/field/utils.d.ts +13 -0
- package/lib/data/dataset/field/utils.js +68 -0
- package/lib/data/dataset/graph/index.d.ts +18 -0
- package/lib/data/dataset/graph/index.js +188 -0
- package/lib/data/dataset/graph/types.d.ts +35 -0
- package/lib/data/dataset/graph/types.js +2 -0
- package/lib/data/dataset/graph/utils.d.ts +1 -0
- package/lib/data/dataset/graph/utils.js +19 -0
- package/lib/data/dataset/index.d.ts +1 -0
- package/lib/data/dataset/index.js +4 -0
- package/lib/data/dataset/types.d.ts +1 -0
- package/lib/data/dataset/types.js +4 -0
- package/lib/data/index.d.ts +5 -0
- package/lib/data/index.js +8 -0
- package/lib/data/statistics/IQR.d.ts +21 -0
- package/lib/data/statistics/IQR.js +53 -0
- package/lib/data/statistics/base.d.ts +106 -0
- package/lib/data/statistics/base.js +271 -0
- package/lib/data/statistics/bayesian.d.ts +5 -0
- package/lib/data/statistics/bayesian.js +30 -0
- package/lib/data/statistics/buishand-u.d.ts +7 -0
- package/lib/data/statistics/buishand-u.js +23 -0
- package/lib/data/statistics/caches.d.ts +13 -0
- package/lib/data/statistics/caches.js +33 -0
- package/lib/data/statistics/cdf.d.ts +7 -0
- package/lib/data/statistics/cdf.js +29 -0
- package/lib/data/statistics/constants.d.ts +5 -0
- package/lib/data/statistics/constants.js +15 -0
- package/lib/data/statistics/index.d.ts +7 -0
- package/lib/data/statistics/index.js +14 -0
- package/lib/data/statistics/lowess.d.ts +10 -0
- package/lib/data/statistics/lowess.js +87 -0
- package/lib/data/statistics/mannkendall-test.d.ts +15 -0
- package/lib/data/statistics/mannkendall-test.js +54 -0
- package/lib/data/statistics/maxabs.d.ts +5 -0
- package/lib/data/statistics/maxabs.js +13 -0
- package/lib/data/statistics/pcorrtest.d.ts +3 -0
- package/lib/data/statistics/pcorrtest.js +80 -0
- package/lib/data/statistics/pettitt-test.d.ts +9 -0
- package/lib/data/statistics/pettitt-test.js +38 -0
- package/lib/data/statistics/quantile.d.ts +16 -0
- package/lib/data/statistics/quantile.js +61 -0
- package/lib/data/statistics/types.d.ts +70 -0
- package/lib/data/statistics/types.js +2 -0
- package/lib/data/statistics/vector.d.ts +15 -0
- package/lib/data/statistics/vector.js +78 -0
- package/lib/data/statistics/window.d.ts +12 -0
- package/lib/data/statistics/window.js +60 -0
- package/lib/data/types.d.ts +2 -0
- package/lib/data/types.js +5 -0
- package/lib/data/utils/common.d.ts +26 -0
- package/lib/data/utils/common.js +67 -0
- package/lib/data/utils/index.d.ts +2 -0
- package/lib/data/utils/index.js +8 -0
- package/lib/data/utils/isType/constants.d.ts +15 -0
- package/lib/data/utils/isType/constants.js +27 -0
- package/lib/data/utils/isType/index.d.ts +2 -0
- package/lib/data/utils/isType/index.js +5 -0
- package/lib/data/utils/isType/isDateString.d.ts +18 -0
- package/lib/data/utils/isType/isDateString.js +111 -0
- package/lib/data/utils/isType/isType.d.ts +13 -0
- package/lib/data/utils/isType/isType.js +94 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +75 -0
- package/lib/insight/algorithms/base/compare.d.ts +14 -0
- package/lib/insight/algorithms/base/compare.js +45 -0
- package/lib/insight/algorithms/categoryOutlier.d.ts +4 -0
- package/lib/insight/algorithms/categoryOutlier.js +7 -0
- package/lib/insight/algorithms/changePoint.d.ts +10 -0
- package/lib/insight/algorithms/changePoint.js +13 -0
- package/lib/insight/algorithms/index.d.ts +3 -0
- package/lib/insight/algorithms/index.js +6 -0
- package/lib/insight/algorithms/trendDirection.d.ts +4 -0
- package/lib/insight/algorithms/trendDirection.js +7 -0
- package/lib/insight/chart/constants.d.ts +13 -0
- package/lib/insight/chart/constants.js +28 -0
- package/lib/insight/chart/generator/homogeneous.d.ts +3 -0
- package/lib/insight/chart/generator/homogeneous.js +75 -0
- package/lib/insight/chart/generator/index.d.ts +2 -0
- package/lib/insight/chart/generator/index.js +5 -0
- package/lib/insight/chart/generator/insights.d.ts +3 -0
- package/lib/insight/chart/generator/insights.js +20 -0
- package/lib/insight/chart/index.d.ts +4 -0
- package/lib/insight/chart/index.js +7 -0
- package/lib/insight/chart/strategy/augmentedMarks/categoryOutlier.d.ts +5 -0
- package/lib/insight/chart/strategy/augmentedMarks/categoryOutlier.js +35 -0
- package/lib/insight/chart/strategy/augmentedMarks/changePoint.d.ts +5 -0
- package/lib/insight/chart/strategy/augmentedMarks/changePoint.js +47 -0
- package/lib/insight/chart/strategy/augmentedMarks/correlation.d.ts +3 -0
- package/lib/insight/chart/strategy/augmentedMarks/correlation.js +10 -0
- package/lib/insight/chart/strategy/augmentedMarks/homogeneous.d.ts +3 -0
- package/lib/insight/chart/strategy/augmentedMarks/homogeneous.js +9 -0
- package/lib/insight/chart/strategy/augmentedMarks/index.d.ts +8 -0
- package/lib/insight/chart/strategy/augmentedMarks/index.js +24 -0
- package/lib/insight/chart/strategy/augmentedMarks/lowVariance.d.ts +5 -0
- package/lib/insight/chart/strategy/augmentedMarks/lowVariance.js +28 -0
- package/lib/insight/chart/strategy/augmentedMarks/majority.d.ts +3 -0
- package/lib/insight/chart/strategy/augmentedMarks/majority.js +9 -0
- package/lib/insight/chart/strategy/augmentedMarks/timeSeriesOutlier.d.ts +5 -0
- package/lib/insight/chart/strategy/augmentedMarks/timeSeriesOutlier.js +87 -0
- package/lib/insight/chart/strategy/augmentedMarks/trend.d.ts +5 -0
- package/lib/insight/chart/strategy/augmentedMarks/trend.js +31 -0
- package/lib/insight/chart/strategy/chart.d.ts +7 -0
- package/lib/insight/chart/strategy/chart.js +49 -0
- package/lib/insight/chart/strategy/commonMarks/areaMark.d.ts +3 -0
- package/lib/insight/chart/strategy/commonMarks/areaMark.js +16 -0
- package/lib/insight/chart/strategy/commonMarks/index.d.ts +5 -0
- package/lib/insight/chart/strategy/commonMarks/index.js +13 -0
- package/lib/insight/chart/strategy/commonMarks/intervalMark.d.ts +5 -0
- package/lib/insight/chart/strategy/commonMarks/intervalMark.js +18 -0
- package/lib/insight/chart/strategy/commonMarks/lineMark.d.ts +3 -0
- package/lib/insight/chart/strategy/commonMarks/lineMark.js +38 -0
- package/lib/insight/chart/strategy/commonMarks/pointMark.d.ts +5 -0
- package/lib/insight/chart/strategy/commonMarks/pointMark.js +21 -0
- package/lib/insight/chart/strategy/commonMarks/textMark.d.ts +5 -0
- package/lib/insight/chart/strategy/commonMarks/textMark.js +32 -0
- package/lib/insight/chart/strategy/index.d.ts +4 -0
- package/lib/insight/chart/strategy/index.js +10 -0
- package/lib/insight/chart/strategy/viewSpec.d.ts +3 -0
- package/lib/insight/chart/strategy/viewSpec.js +20 -0
- package/lib/insight/chart/types.d.ts +60 -0
- package/lib/insight/chart/types.js +2 -0
- package/lib/insight/chart/utils.d.ts +3 -0
- package/lib/insight/chart/utils.js +8 -0
- package/lib/insight/constant.d.ts +12 -0
- package/lib/insight/constant.js +24 -0
- package/lib/insight/index.d.ts +6 -0
- package/lib/insight/index.js +13 -0
- package/lib/insight/insights/checkers.d.ts +16 -0
- package/lib/insight/insights/checkers.js +107 -0
- package/lib/insight/insights/extractors/categoryOutlier.d.ts +12 -0
- package/lib/insight/insights/extractors/categoryOutlier.js +95 -0
- package/lib/insight/insights/extractors/changePoint.d.ts +8 -0
- package/lib/insight/insights/extractors/changePoint.js +60 -0
- package/lib/insight/insights/extractors/correlation.d.ts +9 -0
- package/lib/insight/insights/extractors/correlation.js +43 -0
- package/lib/insight/insights/extractors/homogeneous.d.ts +4 -0
- package/lib/insight/insights/extractors/homogeneous.js +103 -0
- package/lib/insight/insights/extractors/lowVariance.d.ts +8 -0
- package/lib/insight/insights/extractors/lowVariance.js +54 -0
- package/lib/insight/insights/extractors/majority.d.ts +10 -0
- package/lib/insight/insights/extractors/majority.js +71 -0
- package/lib/insight/insights/extractors/timeSeriesOutlier.d.ts +2 -0
- package/lib/insight/insights/extractors/timeSeriesOutlier.js +65 -0
- package/lib/insight/insights/extractors/trend.d.ts +9 -0
- package/lib/insight/insights/extractors/trend.js +54 -0
- package/lib/insight/insights/index.d.ts +12 -0
- package/lib/insight/insights/index.js +32 -0
- package/lib/insight/insights/util.d.ts +13 -0
- package/lib/insight/insights/util.js +87 -0
- package/lib/insight/narrative/factory.d.ts +6 -0
- package/lib/insight/narrative/factory.js +25 -0
- package/lib/insight/narrative/index.d.ts +3 -0
- package/lib/insight/narrative/index.js +18 -0
- package/lib/insight/narrative/strategy/base.d.ts +9 -0
- package/lib/insight/narrative/strategy/base.js +9 -0
- package/lib/insight/narrative/strategy/categoryOutlier.d.ts +9 -0
- package/lib/insight/narrative/strategy/categoryOutlier.js +76 -0
- package/lib/insight/narrative/strategy/changePoint.d.ts +8 -0
- package/lib/insight/narrative/strategy/changePoint.js +54 -0
- package/lib/insight/narrative/strategy/commonness.d.ts +9 -0
- package/lib/insight/narrative/strategy/commonness.js +47 -0
- package/lib/insight/narrative/strategy/correlation.d.ts +8 -0
- package/lib/insight/narrative/strategy/correlation.js +53 -0
- package/lib/insight/narrative/strategy/exception.d.ts +10 -0
- package/lib/insight/narrative/strategy/exception.js +72 -0
- package/lib/insight/narrative/strategy/helpers.d.ts +5 -0
- package/lib/insight/narrative/strategy/helpers.js +31 -0
- package/lib/insight/narrative/strategy/index.d.ts +9 -0
- package/lib/insight/narrative/strategy/index.js +28 -0
- package/lib/insight/narrative/strategy/lowVariance.d.ts +8 -0
- package/lib/insight/narrative/strategy/lowVariance.js +50 -0
- package/lib/insight/narrative/strategy/majority.d.ts +8 -0
- package/lib/insight/narrative/strategy/majority.js +64 -0
- package/lib/insight/narrative/strategy/timeSeriesOutlier.d.ts +8 -0
- package/lib/insight/narrative/strategy/timeSeriesOutlier.js +94 -0
- package/lib/insight/narrative/strategy/trend.d.ts +8 -0
- package/lib/insight/narrative/strategy/trend.js +59 -0
- package/lib/insight/pipeline/extract.d.ts +13 -0
- package/lib/insight/pipeline/extract.js +243 -0
- package/lib/insight/pipeline/index.d.ts +2 -0
- package/lib/insight/pipeline/index.js +15 -0
- package/lib/insight/pipeline/insight.d.ts +10 -0
- package/lib/insight/pipeline/insight.js +86 -0
- package/lib/insight/pipeline/preprocess.d.ts +6 -0
- package/lib/insight/pipeline/preprocess.js +39 -0
- package/lib/insight/pipeline/specificInsight.d.ts +11 -0
- package/lib/insight/pipeline/specificInsight.js +79 -0
- package/lib/insight/pipeline/util.d.ts +5 -0
- package/lib/insight/pipeline/util.js +20 -0
- package/lib/insight/pipeline/visualize.d.ts +3 -0
- package/lib/insight/pipeline/visualize.js +46 -0
- package/lib/insight/types.d.ts +238 -0
- package/lib/insight/types.js +2 -0
- package/lib/insight/utils/aggregate.d.ts +7 -0
- package/lib/insight/utils/aggregate.js +93 -0
- package/lib/insight/utils/common.d.ts +3 -0
- package/lib/insight/utils/common.js +41 -0
- package/lib/ntv/generate/generateTextSpec.d.ts +9 -0
- package/lib/ntv/generate/generateTextSpec.js +160 -0
- package/lib/ntv/generate/index.d.ts +2 -0
- package/lib/ntv/generate/index.js +12 -0
- package/lib/ntv/generate/types.d.ts +58 -0
- package/lib/ntv/generate/types.js +2 -0
- package/lib/ntv/generate/utils.d.ts +29 -0
- package/lib/ntv/generate/utils.js +96 -0
- package/lib/ntv/index.d.ts +4 -0
- package/lib/ntv/index.js +10 -0
- package/lib/ntv/schema/common.d.ts +17 -0
- package/lib/ntv/schema/common.js +2 -0
- package/lib/ntv/schema/index.d.ts +4 -0
- package/lib/ntv/schema/index.js +7 -0
- package/lib/ntv/schema/paragraph.d.ts +34 -0
- package/lib/ntv/schema/paragraph.js +2 -0
- package/lib/ntv/schema/phrase.d.ts +70 -0
- package/lib/ntv/schema/phrase.js +55 -0
- package/lib/ntv/schema/structure.d.ts +18 -0
- package/lib/ntv/schema/structure.js +2 -0
- package/lib/ntv/types.d.ts +2 -0
- package/lib/ntv/types.js +2 -0
- package/lib/ntv/utils/index.d.ts +1 -0
- package/lib/ntv/utils/index.js +4 -0
- package/lib/ntv/utils/isSpecType.d.ts +17 -0
- package/lib/ntv/utils/isSpecType.js +76 -0
- package/lib/utils/arr2map.d.ts +1 -0
- package/lib/utils/arr2map.js +11 -0
- package/lib/utils/dataFormat.d.ts +11 -0
- package/lib/utils/dataFormat.js +35 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +8 -0
- package/lib/utils/isType.d.ts +4 -0
- package/lib/utils/isType.js +21 -0
- package/package.json +88 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.intervalMarkStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var constants_1 = require("../../constants");
|
|
6
|
+
/** get mark for point patterns, the patterns should have same dimension and measure */
|
|
7
|
+
var intervalMarkStrategy = function (patterns, config) {
|
|
8
|
+
var data = patterns.map(function (_a) {
|
|
9
|
+
var x = _a.x, y = _a.y;
|
|
10
|
+
return ({ x: x, y: y });
|
|
11
|
+
});
|
|
12
|
+
var intervalMark = tslib_1.__assign(tslib_1.__assign({ type: 'interval', data: data, encode: {
|
|
13
|
+
x: 'x',
|
|
14
|
+
y: 'y',
|
|
15
|
+
} }, config), { style: tslib_1.__assign(tslib_1.__assign({}, config === null || config === void 0 ? void 0 : config.style), { fill: constants_1.INSIGHT_COLOR_PLATTE.outlier }) });
|
|
16
|
+
return intervalMark;
|
|
17
|
+
};
|
|
18
|
+
exports.intervalMarkStrategy = intervalMarkStrategy;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lineMarkStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var constants_1 = require("../../constants");
|
|
6
|
+
var lineMarkStrategy = function (_a, _b) {
|
|
7
|
+
var points = _a.points, x = _a.x, y = _a.y;
|
|
8
|
+
var encode = _b.encode, style = _b.style, label = _b.label, tooltip = _b.tooltip;
|
|
9
|
+
var common = {
|
|
10
|
+
style: tslib_1.__assign({ lineDash: [2, 2], stroke: constants_1.INSIGHT_COLOR_PLATTE.highlight }, style),
|
|
11
|
+
labels: label
|
|
12
|
+
? [
|
|
13
|
+
{
|
|
14
|
+
text: label,
|
|
15
|
+
selector: 'last',
|
|
16
|
+
position: 'right',
|
|
17
|
+
style: {
|
|
18
|
+
textBaseline: 'bottom',
|
|
19
|
+
textAlign: 'end',
|
|
20
|
+
dy: -24,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
: undefined,
|
|
25
|
+
tooltip: tooltip,
|
|
26
|
+
};
|
|
27
|
+
if (points) {
|
|
28
|
+
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'line', data: points, encode: tslib_1.__assign({ x: 'x', y: 'y' }, encode) });
|
|
29
|
+
}
|
|
30
|
+
if (x) {
|
|
31
|
+
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'lineX', data: [x] });
|
|
32
|
+
}
|
|
33
|
+
if (y) {
|
|
34
|
+
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'lineY', data: [y] });
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
38
|
+
exports.lineMarkStrategy = lineMarkStrategy;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PointMark } from '@antv/g2';
|
|
2
|
+
import { PointPatternInfo } from '../../../types';
|
|
3
|
+
import { PointMarkConfig } from '../../types';
|
|
4
|
+
/** get mark for point patterns, the patterns should have same dimension and measure */
|
|
5
|
+
export declare const pointMarkStrategy: (patterns: PointPatternInfo[], config: PointMarkConfig) => PointMark;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pointMarkStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var lodash_1 = require("lodash");
|
|
6
|
+
/** get mark for point patterns, the patterns should have same dimension and measure */
|
|
7
|
+
var pointMarkStrategy = function (patterns, config) {
|
|
8
|
+
var data = [];
|
|
9
|
+
patterns.forEach(function (_a) {
|
|
10
|
+
var x = _a.x, y = _a.y;
|
|
11
|
+
if ((0, lodash_1.isNil)(x) || (0, lodash_1.isNil)(y))
|
|
12
|
+
return;
|
|
13
|
+
data.push({ x: x, y: y });
|
|
14
|
+
});
|
|
15
|
+
var pointMark = tslib_1.__assign({ type: 'point', data: data, encode: {
|
|
16
|
+
x: 'x',
|
|
17
|
+
y: 'y',
|
|
18
|
+
} }, config);
|
|
19
|
+
return pointMark;
|
|
20
|
+
};
|
|
21
|
+
exports.pointMarkStrategy = pointMarkStrategy;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextMark } from '@antv/g2';
|
|
2
|
+
import { PointPatternInfo } from '../../../types';
|
|
3
|
+
import { TextMarkConfig } from '../../types';
|
|
4
|
+
/** get mark for point patterns, the patterns should have same dimension and measure */
|
|
5
|
+
export declare const textMarkStrategy: (patterns: PointPatternInfo[], textConfig?: TextMarkConfig) => TextMark;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textMarkStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var lodash_1 = require("lodash");
|
|
6
|
+
var constants_1 = require("../../constants");
|
|
7
|
+
/** get mark for point patterns, the patterns should have same dimension and measure */
|
|
8
|
+
var textMarkStrategy = function (patterns, textConfig) {
|
|
9
|
+
var _a = textConfig || {}, style = _a.style, label = _a.label, formatter = _a.formatter;
|
|
10
|
+
var _b = patterns[0], measure = _b.measure, dimension = _b.dimension;
|
|
11
|
+
var data = patterns.map(function (pattern) {
|
|
12
|
+
var _a;
|
|
13
|
+
var customLabel = (0, lodash_1.isFunction)(label) ? label(pattern) : label;
|
|
14
|
+
var value = (0, lodash_1.isFunction)(formatter) ? formatter(pattern.y) : pattern.y;
|
|
15
|
+
return _a = {},
|
|
16
|
+
_a[dimension] = pattern.x,
|
|
17
|
+
_a[measure] = pattern.y,
|
|
18
|
+
_a.label = customLabel !== null && customLabel !== void 0 ? customLabel : "".concat(pattern.x, "\n").concat(value),
|
|
19
|
+
_a;
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
type: 'text',
|
|
23
|
+
data: data,
|
|
24
|
+
encode: {
|
|
25
|
+
x: dimension,
|
|
26
|
+
y: measure,
|
|
27
|
+
text: 'label',
|
|
28
|
+
},
|
|
29
|
+
style: tslib_1.__assign(tslib_1.__assign({}, constants_1.TEXT_STYLE), style),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.textMarkStrategy = textMarkStrategy;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.viewSpecStrategy = exports.insight2ChartStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var chart_1 = require("./chart");
|
|
6
|
+
Object.defineProperty(exports, "insight2ChartStrategy", { enumerable: true, get: function () { return chart_1.insight2ChartStrategy; } });
|
|
7
|
+
var viewSpec_1 = require("./viewSpec");
|
|
8
|
+
Object.defineProperty(exports, "viewSpecStrategy", { enumerable: true, get: function () { return viewSpec_1.viewSpecStrategy; } });
|
|
9
|
+
tslib_1.__exportStar(require("./commonMarks"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./augmentedMarks"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.viewSpecStrategy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var viewSpecStrategy = function (marks, insight) {
|
|
6
|
+
// majority insight pattern visualizes as 'pie', should not use y nice (G2 handle it as rescale y, the pie chart will be less than 100%)
|
|
7
|
+
var isMajorityPattern = insight.patterns.map(function (pattern) { return pattern.type; }).includes('majority');
|
|
8
|
+
var viewConfig = isMajorityPattern
|
|
9
|
+
? { scale: { y: { nice: false } } }
|
|
10
|
+
: {
|
|
11
|
+
scale: { y: { nice: true } },
|
|
12
|
+
};
|
|
13
|
+
return tslib_1.__assign({ type: 'view', theme: 'classic', axis: {
|
|
14
|
+
x: { labelAutoHide: true, labelAutoRotate: false, title: false },
|
|
15
|
+
y: { title: false },
|
|
16
|
+
}, interaction: {
|
|
17
|
+
tooltip: { groupName: false },
|
|
18
|
+
}, legend: false, children: marks }, viewConfig);
|
|
19
|
+
};
|
|
20
|
+
exports.viewSpecStrategy = viewSpecStrategy;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AreaMark, IntervalMark, LineMark, Mark, PointMark, TextMark } from '@antv/g2';
|
|
2
|
+
import type { Datum } from '../types';
|
|
3
|
+
type LabelType = string | ((d: Datum) => string);
|
|
4
|
+
export type TextMarkConfig = {
|
|
5
|
+
label?: LabelType;
|
|
6
|
+
style?: Mark['style'];
|
|
7
|
+
formatter?: (value: number) => string;
|
|
8
|
+
};
|
|
9
|
+
export type PointMarkConfig = {
|
|
10
|
+
style?: Mark['style'];
|
|
11
|
+
tooltip?: Mark['tooltip'];
|
|
12
|
+
};
|
|
13
|
+
export type LineMarkData = {
|
|
14
|
+
/** draw a vertical line at x value */
|
|
15
|
+
x?: number;
|
|
16
|
+
/** draw a horizontal line at y value */
|
|
17
|
+
y?: number;
|
|
18
|
+
/** draw a line using specific points */
|
|
19
|
+
points?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export type LineMarkConfig = {
|
|
25
|
+
encode?: Mark['encode'];
|
|
26
|
+
label?: string;
|
|
27
|
+
style?: Mark['style'];
|
|
28
|
+
tooltip?: Mark['tooltip'];
|
|
29
|
+
};
|
|
30
|
+
export type AreaMarkData = {
|
|
31
|
+
x: number;
|
|
32
|
+
y: [number, number];
|
|
33
|
+
}[];
|
|
34
|
+
export type AreaMarkConfig = {
|
|
35
|
+
encode?: Mark['encode'];
|
|
36
|
+
style?: Mark['style'];
|
|
37
|
+
tooltip?: Mark['tooltip'];
|
|
38
|
+
};
|
|
39
|
+
export type IntervalMarkConfig = {
|
|
40
|
+
style?: Mark['style'];
|
|
41
|
+
};
|
|
42
|
+
export type ChangePointMark = {
|
|
43
|
+
changePoint: (PointMark | TextMark)[];
|
|
44
|
+
};
|
|
45
|
+
export type TrendMark = {
|
|
46
|
+
trendLine: LineMark[];
|
|
47
|
+
};
|
|
48
|
+
export type TimeSeriesOutlierMark = {
|
|
49
|
+
trendLine: LineMark[];
|
|
50
|
+
anomalyArea: AreaMark[];
|
|
51
|
+
outliers?: PointMark[];
|
|
52
|
+
};
|
|
53
|
+
export type CategoryOutlierMark = {
|
|
54
|
+
categoryOutlier: (IntervalMark | TextMark)[];
|
|
55
|
+
};
|
|
56
|
+
export type LowVarianceMark = {
|
|
57
|
+
meanLine: LineMark[];
|
|
58
|
+
};
|
|
59
|
+
export type AugmentedMarks = ChangePointMark[] | TrendMark[] | TimeSeriesOutlierMark[] | CategoryOutlierMark[] | LowVarianceMark[];
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.augmentedMarks2Marks = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var augmentedMarks2Marks = function (augmentedMarks) {
|
|
6
|
+
return (0, lodash_1.flattenDeep)((0, lodash_1.map)(augmentedMarks, function (augmentedMark) { return Object.values(augmentedMark); }));
|
|
7
|
+
};
|
|
8
|
+
exports.augmentedMarks2Marks = augmentedMarks2Marks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SIGNIFICANCE_BENCHMARK = 0.95;
|
|
2
|
+
export declare const SIGNIFICANCE_LEVEL = 0.05;
|
|
3
|
+
export declare const INSIGHT_SCORE_BENCHMARK = 0.01;
|
|
4
|
+
export declare const IMPACT_SCORE_WEIGHT = 0.2;
|
|
5
|
+
export declare const INSIGHT_DEFAULT_LIMIT = 20;
|
|
6
|
+
export declare const IQR_K = 1.5;
|
|
7
|
+
export declare const LOWESS_N_STEPS = 2;
|
|
8
|
+
export declare const PATTERN_TYPES: readonly ["category_outlier", "trend", "change_point", "time_series_outlier", "majority", "low_variance", "correlation"];
|
|
9
|
+
export declare const HOMOGENEOUS_PATTERN_TYPES: readonly ["commonness", "exception"];
|
|
10
|
+
export declare const VERIFICATION_FAILURE_INFO = "The input does not meet the requirements.";
|
|
11
|
+
export declare const NO_PATTERN_INFO = "No insights were found at the specified significance threshold.";
|
|
12
|
+
export declare const CHANGE_POINT_SIGNIFICANCE_BENCHMARK = 0.15;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHANGE_POINT_SIGNIFICANCE_BENCHMARK = exports.NO_PATTERN_INFO = exports.VERIFICATION_FAILURE_INFO = exports.HOMOGENEOUS_PATTERN_TYPES = exports.PATTERN_TYPES = exports.LOWESS_N_STEPS = exports.IQR_K = exports.INSIGHT_DEFAULT_LIMIT = exports.IMPACT_SCORE_WEIGHT = exports.INSIGHT_SCORE_BENCHMARK = exports.SIGNIFICANCE_LEVEL = exports.SIGNIFICANCE_BENCHMARK = void 0;
|
|
4
|
+
// Should be confidence level. Is the SIGNIFICANCE_BENCHMARK naming correct? by @pddpd
|
|
5
|
+
exports.SIGNIFICANCE_BENCHMARK = 0.95;
|
|
6
|
+
exports.SIGNIFICANCE_LEVEL = 0.05;
|
|
7
|
+
exports.INSIGHT_SCORE_BENCHMARK = 0.01;
|
|
8
|
+
exports.IMPACT_SCORE_WEIGHT = 0.2;
|
|
9
|
+
exports.INSIGHT_DEFAULT_LIMIT = 20;
|
|
10
|
+
exports.IQR_K = 1.5;
|
|
11
|
+
exports.LOWESS_N_STEPS = 2;
|
|
12
|
+
exports.PATTERN_TYPES = [
|
|
13
|
+
'category_outlier',
|
|
14
|
+
'trend',
|
|
15
|
+
'change_point',
|
|
16
|
+
'time_series_outlier',
|
|
17
|
+
'majority',
|
|
18
|
+
'low_variance',
|
|
19
|
+
'correlation',
|
|
20
|
+
];
|
|
21
|
+
exports.HOMOGENEOUS_PATTERN_TYPES = ['commonness', 'exception'];
|
|
22
|
+
exports.VERIFICATION_FAILURE_INFO = 'The input does not meet the requirements.';
|
|
23
|
+
exports.NO_PATTERN_INFO = 'No insights were found at the specified significance threshold.';
|
|
24
|
+
exports.CHANGE_POINT_SIGNIFICANCE_BENCHMARK = 0.15;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getInsights } from './pipeline';
|
|
2
|
+
export { insightPatternsExtractor } from './insights';
|
|
3
|
+
export { generateInsightVisualizationSpec } from './pipeline/visualize';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { getSpecificInsight } from './pipeline/specificInsight';
|
|
6
|
+
export type { AugmentedMarks } from './chart';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSpecificInsight = exports.generateInsightVisualizationSpec = exports.insightPatternsExtractor = exports.getInsights = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var pipeline_1 = require("./pipeline");
|
|
6
|
+
Object.defineProperty(exports, "getInsights", { enumerable: true, get: function () { return pipeline_1.getInsights; } });
|
|
7
|
+
var insights_1 = require("./insights");
|
|
8
|
+
Object.defineProperty(exports, "insightPatternsExtractor", { enumerable: true, get: function () { return insights_1.insightPatternsExtractor; } });
|
|
9
|
+
var visualize_1 = require("./pipeline/visualize");
|
|
10
|
+
Object.defineProperty(exports, "generateInsightVisualizationSpec", { enumerable: true, get: function () { return visualize_1.generateInsightVisualizationSpec; } });
|
|
11
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
12
|
+
var specificInsight_1 = require("./pipeline/specificInsight");
|
|
13
|
+
Object.defineProperty(exports, "getSpecificInsight", { enumerable: true, get: function () { return specificInsight_1.getSpecificInsight; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Datum, SubjectInfo, InsightType, DataProperty } from '../types';
|
|
2
|
+
import type { LevelOfMeasurement } from '../../ckb';
|
|
3
|
+
export type ExtractorChecker = (props: {
|
|
4
|
+
data: Datum[];
|
|
5
|
+
subjectInfo: SubjectInfo;
|
|
6
|
+
fieldPropsMap: Record<string, DataProperty>;
|
|
7
|
+
lom?: LevelOfMeasurement | LevelOfMeasurement[];
|
|
8
|
+
}) => true | string;
|
|
9
|
+
export declare const trendChecker: ExtractorChecker;
|
|
10
|
+
export declare const categoryOutlierChecker: ExtractorChecker;
|
|
11
|
+
export declare const changePointChecker: ExtractorChecker;
|
|
12
|
+
export declare const timeSeriesChecker: ExtractorChecker;
|
|
13
|
+
export declare const majorityChecker: ExtractorChecker;
|
|
14
|
+
export declare const lowVarianceChecker: ExtractorChecker;
|
|
15
|
+
export declare const correlationChecker: ExtractorChecker;
|
|
16
|
+
export declare const ExtractorCheckers: Partial<Record<InsightType, ExtractorChecker>>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractorCheckers = exports.correlationChecker = exports.lowVarianceChecker = exports.majorityChecker = exports.timeSeriesChecker = exports.changePointChecker = exports.categoryOutlierChecker = exports.trendChecker = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var fieldsQuantityChecker = function (subjectInfo, dimensionsQuantity, measuresQuantity) {
|
|
6
|
+
var dimensions = subjectInfo.dimensions, measures = subjectInfo.measures;
|
|
7
|
+
if (dimensions.length === dimensionsQuantity && measures.length === measuresQuantity)
|
|
8
|
+
return true;
|
|
9
|
+
return false;
|
|
10
|
+
};
|
|
11
|
+
var generalCheckerFor1M1D = function (_a) {
|
|
12
|
+
var _b, _c, _d, _e;
|
|
13
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap, lom = _a.lom;
|
|
14
|
+
var dimensions = subjectInfo.dimensions;
|
|
15
|
+
// check data length
|
|
16
|
+
if ((data === null || data === void 0 ? void 0 : data.length) < 3)
|
|
17
|
+
return 'The data length is less than 3. ';
|
|
18
|
+
// check field quantity
|
|
19
|
+
if (!fieldsQuantityChecker(subjectInfo, 1, 1))
|
|
20
|
+
return 'The length of the measure or dimension is not 1. ';
|
|
21
|
+
// check dimension type
|
|
22
|
+
if (Array.isArray(lom)
|
|
23
|
+
? !((_c = (0, lodash_1.intersection)((_b = fieldPropsMap[dimensions[0]]) === null || _b === void 0 ? void 0 : _b.levelOfMeasurements, lom)) === null || _c === void 0 ? void 0 : _c.length)
|
|
24
|
+
: !((_e = (_d = fieldPropsMap[dimensions[0]]) === null || _d === void 0 ? void 0 : _d.levelOfMeasurements) === null || _e === void 0 ? void 0 : _e.includes(lom)))
|
|
25
|
+
return "The type of the dimension field is not included in the option ".concat(Array.isArray(lom) ? lom : [lom], ". ");
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
var trendChecker = function (_a) {
|
|
29
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
30
|
+
return generalCheckerFor1M1D({ data: data, subjectInfo: subjectInfo, fieldPropsMap: fieldPropsMap, lom: 'Time' });
|
|
31
|
+
};
|
|
32
|
+
exports.trendChecker = trendChecker;
|
|
33
|
+
var categoryOutlierChecker = function (_a) {
|
|
34
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
35
|
+
return generalCheckerFor1M1D({ data: data, subjectInfo: subjectInfo, fieldPropsMap: fieldPropsMap, lom: ['Nominal', 'Discrete', 'Ordinal'] });
|
|
36
|
+
};
|
|
37
|
+
exports.categoryOutlierChecker = categoryOutlierChecker;
|
|
38
|
+
var changePointChecker = function (_a) {
|
|
39
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
40
|
+
return generalCheckerFor1M1D({ data: data, subjectInfo: subjectInfo, fieldPropsMap: fieldPropsMap, lom: 'Time' });
|
|
41
|
+
};
|
|
42
|
+
exports.changePointChecker = changePointChecker;
|
|
43
|
+
var timeSeriesChecker = function (_a) {
|
|
44
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
45
|
+
return generalCheckerFor1M1D({ data: data, subjectInfo: subjectInfo, fieldPropsMap: fieldPropsMap, lom: 'Time' });
|
|
46
|
+
};
|
|
47
|
+
exports.timeSeriesChecker = timeSeriesChecker;
|
|
48
|
+
var majorityChecker = function (_a) {
|
|
49
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
50
|
+
var checkerFor1M1D = generalCheckerFor1M1D({
|
|
51
|
+
data: data,
|
|
52
|
+
subjectInfo: subjectInfo,
|
|
53
|
+
fieldPropsMap: fieldPropsMap,
|
|
54
|
+
lom: ['Nominal', 'Discrete', 'Ordinal', 'Time'],
|
|
55
|
+
});
|
|
56
|
+
if (checkerFor1M1D !== true)
|
|
57
|
+
return checkerFor1M1D;
|
|
58
|
+
var measures = subjectInfo.measures;
|
|
59
|
+
if (!['count', 'sum'].includes(measures[0].method))
|
|
60
|
+
return 'Measure is not aggregated in sum or count mode. ';
|
|
61
|
+
return true;
|
|
62
|
+
};
|
|
63
|
+
exports.majorityChecker = majorityChecker;
|
|
64
|
+
var lowVarianceChecker = function (_a) {
|
|
65
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
66
|
+
var checkerFor1M1D = generalCheckerFor1M1D({
|
|
67
|
+
data: data,
|
|
68
|
+
subjectInfo: subjectInfo,
|
|
69
|
+
fieldPropsMap: fieldPropsMap,
|
|
70
|
+
lom: ['Nominal', 'Discrete', 'Ordinal'],
|
|
71
|
+
});
|
|
72
|
+
if (checkerFor1M1D !== true)
|
|
73
|
+
return checkerFor1M1D;
|
|
74
|
+
var measures = subjectInfo.measures;
|
|
75
|
+
// 低方差检验使用变异系数 sigma/mean 作为检验统计量,要求均值不能为0
|
|
76
|
+
if (['float', 'integer'].includes(fieldPropsMap[measures[0].fieldName].recommendation)) {
|
|
77
|
+
if (fieldPropsMap[measures[0].fieldName].mean !== 0)
|
|
78
|
+
return true;
|
|
79
|
+
return 'The low variance test uses the coefficient of variation sigma/mean as the test statistic and requires that the mean cannot be 0. ';
|
|
80
|
+
}
|
|
81
|
+
return 'The recommended data type of measure is not float or integer. ';
|
|
82
|
+
};
|
|
83
|
+
exports.lowVarianceChecker = lowVarianceChecker;
|
|
84
|
+
var correlationChecker = function (_a) {
|
|
85
|
+
var _b, _c;
|
|
86
|
+
var data = _a.data, subjectInfo = _a.subjectInfo, fieldPropsMap = _a.fieldPropsMap;
|
|
87
|
+
var measures = subjectInfo.measures;
|
|
88
|
+
// check data length
|
|
89
|
+
if ((data === null || data === void 0 ? void 0 : data.length) < 3)
|
|
90
|
+
return 'The data length is less than 3. ';
|
|
91
|
+
// check field quantity
|
|
92
|
+
if (measures.length !== 2)
|
|
93
|
+
return 'The length of the measure or dimension is not 2. ';
|
|
94
|
+
if (!((_b = fieldPropsMap[measures[0].fieldName].levelOfMeasurements) === null || _b === void 0 ? void 0 : _b.includes('Continuous')) ||
|
|
95
|
+
!((_c = fieldPropsMap[measures[1].fieldName].levelOfMeasurements) === null || _c === void 0 ? void 0 : _c.includes('Continuous')))
|
|
96
|
+
return 'Level of measurement is not continuous. ';
|
|
97
|
+
return true;
|
|
98
|
+
};
|
|
99
|
+
exports.correlationChecker = correlationChecker;
|
|
100
|
+
exports.ExtractorCheckers = {
|
|
101
|
+
category_outlier: exports.categoryOutlierChecker,
|
|
102
|
+
trend: exports.trendChecker,
|
|
103
|
+
change_point: exports.changePointChecker,
|
|
104
|
+
time_series_outlier: exports.timeSeriesChecker,
|
|
105
|
+
low_variance: exports.lowVarianceChecker,
|
|
106
|
+
correlation: exports.correlationChecker,
|
|
107
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CategoryOutlierInfo, GetPatternInfo, OutlierParameter } from '../../types';
|
|
2
|
+
type OutlierItem = {
|
|
3
|
+
index: number;
|
|
4
|
+
significance: number;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const findOutliers: (values: number[], outlierParameter?: OutlierParameter) => {
|
|
8
|
+
outliers: OutlierItem[];
|
|
9
|
+
thresholds: [number, number];
|
|
10
|
+
};
|
|
11
|
+
export declare const getCategoryOutlierInfo: GetPatternInfo<CategoryOutlierInfo>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCategoryOutlierInfo = exports.findOutliers = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var lodash_1 = require("lodash");
|
|
6
|
+
var data_1 = require("../../../data");
|
|
7
|
+
var algorithms_1 = require("../../algorithms");
|
|
8
|
+
var constant_1 = require("../../constant");
|
|
9
|
+
var util_1 = require("../util");
|
|
10
|
+
var findOutliers = function (values, outlierParameter) {
|
|
11
|
+
var _a = outlierParameter || {}, method = _a.method, iqrK = _a.iqrK, _b = _a.confidenceInterval, confidenceInterval = _b === void 0 ? constant_1.SIGNIFICANCE_BENCHMARK : _b;
|
|
12
|
+
var outliers = [];
|
|
13
|
+
var thresholds = [];
|
|
14
|
+
var candidates = values.map(function (item, index) {
|
|
15
|
+
return { index: index, value: item };
|
|
16
|
+
});
|
|
17
|
+
if (method !== 'p-value') {
|
|
18
|
+
var IQRResult = algorithms_1.categoryOutlier.IQR(values, { k: iqrK !== null && iqrK !== void 0 ? iqrK : constant_1.IQR_K });
|
|
19
|
+
var lowerOutlierIndexes = IQRResult.lower.indexes;
|
|
20
|
+
var upperOutlierIndexes = IQRResult.upper.indexes;
|
|
21
|
+
tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(lowerOutlierIndexes), false), tslib_1.__read(upperOutlierIndexes), false).forEach(function (index) {
|
|
22
|
+
var value = values[index];
|
|
23
|
+
var pValue = (candidates.findIndex(function (item) { return item.value === value; }) + 1) / values.length;
|
|
24
|
+
// two-sided
|
|
25
|
+
var significance = pValue > 0.5 ? pValue : 1 - pValue;
|
|
26
|
+
outliers.push({
|
|
27
|
+
index: index,
|
|
28
|
+
value: value,
|
|
29
|
+
significance: significance,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
thresholds.push(IQRResult.lower.threshold, IQRResult.upper.threshold);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
var sortedCandidates = (0, lodash_1.orderBy)(candidates, function (item) { return Math.abs((0, data_1.mean)(values) - item.value); }, ['desc']);
|
|
36
|
+
thresholds.push.apply(thresholds, tslib_1.__spreadArray([], tslib_1.__read((0, util_1.calculateOutlierThresholds)(values, confidenceInterval, 'two-sided')), false));
|
|
37
|
+
for (var i = 0; i < sortedCandidates.length; i += 1) {
|
|
38
|
+
var candidate = sortedCandidates[i];
|
|
39
|
+
var value = candidate.value, index = candidate.index;
|
|
40
|
+
var pValue = (0, util_1.calculatePValue)(values, value, 'two-sided');
|
|
41
|
+
var significance = 1 - pValue;
|
|
42
|
+
if (significance < confidenceInterval) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
outliers.push({
|
|
46
|
+
index: index,
|
|
47
|
+
value: value,
|
|
48
|
+
significance: significance,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { outliers: outliers, thresholds: thresholds };
|
|
53
|
+
};
|
|
54
|
+
exports.findOutliers = findOutliers;
|
|
55
|
+
var getCategoryOutlierInfo = function (props) {
|
|
56
|
+
var valid = (0, util_1.preValidation)(props);
|
|
57
|
+
var insightType = 'category_outlier';
|
|
58
|
+
if ((0, lodash_1.isString)(valid))
|
|
59
|
+
return (0, util_1.getNonSignificantInsight)({ detailInfo: valid, insightType: insightType, infoType: 'verificationFailure' });
|
|
60
|
+
var _a = (0, util_1.getAlgorithmCommonInput)(props), dimension = _a.dimension, values = _a.values, measure = _a.measure;
|
|
61
|
+
if ((0, lodash_1.isNil)(dimension) || (0, lodash_1.isNil)(measure))
|
|
62
|
+
return (0, util_1.getNonSignificantInsight)({
|
|
63
|
+
detailInfo: 'Measure or dimension is empty.',
|
|
64
|
+
insightType: insightType,
|
|
65
|
+
infoType: 'verificationFailure',
|
|
66
|
+
});
|
|
67
|
+
if ((0, data_1.distinct)(values) === 1)
|
|
68
|
+
return (0, util_1.getNonSignificantInsight)({
|
|
69
|
+
insightType: insightType,
|
|
70
|
+
infoType: 'noInsight',
|
|
71
|
+
customInfo: { info: 'Each value in the data is the same. No outliers were found.' },
|
|
72
|
+
});
|
|
73
|
+
var data = props.data;
|
|
74
|
+
var outlierParameter = (0, lodash_1.get)(props, 'options.algorithmParameter.outlier');
|
|
75
|
+
var outliers = (0, exports.findOutliers)(values, outlierParameter).outliers;
|
|
76
|
+
if (outliers.length === 0) {
|
|
77
|
+
var info = "No outliers were found using method ".concat((outlierParameter === null || outlierParameter === void 0 ? void 0 : outlierParameter.method) !== 'p-value' ? 'Inter Quartile Range' : 'Normal Distribution test', ".");
|
|
78
|
+
return (0, util_1.getNonSignificantInsight)({ insightType: insightType, infoType: 'noInsight', customInfo: { info: info } });
|
|
79
|
+
}
|
|
80
|
+
var categoryOutliers = outliers.map(function (item) {
|
|
81
|
+
var index = item.index, significance = item.significance;
|
|
82
|
+
return {
|
|
83
|
+
type: insightType,
|
|
84
|
+
dimension: dimension,
|
|
85
|
+
measure: measure,
|
|
86
|
+
significance: significance,
|
|
87
|
+
index: index,
|
|
88
|
+
x: data[index][dimension],
|
|
89
|
+
y: data[index][measure],
|
|
90
|
+
significantInsight: true,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
return categoryOutliers;
|
|
94
|
+
};
|
|
95
|
+
exports.getCategoryOutlierInfo = getCategoryOutlierInfo;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChangePointInfo, CommonParameter, GetPatternInfo } from '../../types';
|
|
2
|
+
type ChangePointItem = {
|
|
3
|
+
index: number;
|
|
4
|
+
significance: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const findChangePoints: (series: number[], changePointsParameter: CommonParameter) => ChangePointItem[];
|
|
7
|
+
export declare const getChangePointInfo: GetPatternInfo<ChangePointInfo>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChangePointInfo = exports.findChangePoints = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var algorithms_1 = require("../../algorithms");
|
|
6
|
+
var util_1 = require("../util");
|
|
7
|
+
var constant_1 = require("../../constant");
|
|
8
|
+
var findChangePoints = function (series, changePointsParameter) {
|
|
9
|
+
var _a;
|
|
10
|
+
var results = algorithms_1.changePoint.Bayesian(series);
|
|
11
|
+
var changePointsResult = [];
|
|
12
|
+
// significanceBenchmark is equivalent to the confidence interval in hypothesis testing
|
|
13
|
+
var significanceBenchmark = 1 - ((_a = changePointsParameter === null || changePointsParameter === void 0 ? void 0 : changePointsParameter.threshold) !== null && _a !== void 0 ? _a : constant_1.CHANGE_POINT_SIGNIFICANCE_BENCHMARK);
|
|
14
|
+
results.forEach(function (item) {
|
|
15
|
+
// item.significance is similar to confidence interval
|
|
16
|
+
if ((item === null || item === void 0 ? void 0 : item.index) >= 0 && (item === null || item === void 0 ? void 0 : item.significance) >= significanceBenchmark) {
|
|
17
|
+
changePointsResult.push(item);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return changePointsResult;
|
|
21
|
+
};
|
|
22
|
+
exports.findChangePoints = findChangePoints;
|
|
23
|
+
var getChangePointInfo = function (props) {
|
|
24
|
+
var valid = (0, util_1.preValidation)(props);
|
|
25
|
+
var insightType = 'change_point';
|
|
26
|
+
if ((0, lodash_1.isString)(valid))
|
|
27
|
+
return (0, util_1.getNonSignificantInsight)({ detailInfo: valid, insightType: insightType, infoType: 'verificationFailure' });
|
|
28
|
+
var data = props.data;
|
|
29
|
+
var _a = (0, util_1.getAlgorithmCommonInput)(props), dimension = _a.dimension, values = _a.values, measure = _a.measure;
|
|
30
|
+
if ((0, lodash_1.isNil)(dimension) || (0, lodash_1.isNil)(measure))
|
|
31
|
+
return (0, util_1.getNonSignificantInsight)({
|
|
32
|
+
detailInfo: 'Measure or dimension is empty.',
|
|
33
|
+
insightType: insightType,
|
|
34
|
+
infoType: 'verificationFailure',
|
|
35
|
+
});
|
|
36
|
+
var changePointsParameter = (0, lodash_1.get)(props, 'options.algorithmParameter.changePoint');
|
|
37
|
+
var changePoints = (0, exports.findChangePoints)(values, changePointsParameter);
|
|
38
|
+
if (changePoints.length === 0) {
|
|
39
|
+
var info = 'Bayesian Online Changepoint Detection does not pass.';
|
|
40
|
+
return (0, util_1.getNonSignificantInsight)({ insightType: insightType, infoType: 'noInsight', customInfo: { info: info } });
|
|
41
|
+
}
|
|
42
|
+
var outliers = [];
|
|
43
|
+
changePoints.forEach(function (item) {
|
|
44
|
+
var index = item.index, significance = item.significance;
|
|
45
|
+
if (!(0, lodash_1.isNil)(data[index])) {
|
|
46
|
+
outliers.push({
|
|
47
|
+
type: insightType,
|
|
48
|
+
dimension: dimension,
|
|
49
|
+
measure: measure,
|
|
50
|
+
significance: significance,
|
|
51
|
+
index: index,
|
|
52
|
+
x: data[index][dimension],
|
|
53
|
+
y: data[index][measure],
|
|
54
|
+
significantInsight: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return outliers;
|
|
59
|
+
};
|
|
60
|
+
exports.getChangePointInfo = getChangePointInfo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PCorrTestParameter } from '../../../data/statistics/types';
|
|
2
|
+
import { CorrelationInfo, GetPatternInfo } from '../../types';
|
|
3
|
+
type CorrelationResult = {
|
|
4
|
+
significance: number;
|
|
5
|
+
pcorr: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function findCorrelation(x: number[], y: number[], pCorrTestParameter?: PCorrTestParameter): CorrelationResult | null;
|
|
8
|
+
export declare const getCorrelationInfo: GetPatternInfo<CorrelationInfo>;
|
|
9
|
+
export {};
|