界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
数据与研究 · SKILL.md

data-setup

data-setup

【数据与研究】Prepare NannyML reference/analysis data, choose chunking and thresholds, use bundled datasets, and monitor data quality or summary statistics.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: data-setup description: "Prepare NannyML reference/analysis data, choose chunking and thresholds, use bundled datasets, and monitor data quality or summary statistics." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

Data Setup

Use this sub-skill when the task is about preparing tabular data for NannyML monitoring, choosing reference/analysis columns, configuring chunks and thresholds, selecting built-in datasets, or running data-quality and summary-statistic calculators.

Route performance estimation/calculation to performance-monitoring, drift detection/ranking to drift-monitoring, and YAML/CLI automation to cli-and-automation.

Quick routing

Common setup path

  1. Choose the data period split: reference for baseline expectations, analysis for monitored records.
  2. Identify semantic columns: timestamp, model features, prediction label, prediction probability/probabilities, target labels, join keys, and any columns excluded from monitoring.
  3. Pick chunking: fixed size, fixed count, period-based, or an explicit chunker.
  4. Decide thresholds: defaults, constant thresholds, or standard-deviation thresholds per metric/method/calculator.
  5. Run data-quality or summary-stat checks before or alongside drift/performance workflows.
  6. Convert results to flat DataFrames for assertions/logs and plot only filtered views when the output is large.

Data-quality quick examples

import nannyml as nml

reference, analysis, _ = nml.load_synthetic_car_loan_data_quality_dataset()
all_features = ['car_value', 'salary_range', 'debt_to_income_ratio', 'loan_length', 'repaid_loan_on_prev_car', 'size_of_downpayment', 'driver_tenure']

missing = nml.MissingValuesCalculator(
    column_names=all_features,
    timestamp_column_name='timestamp',
    chunk_size=5000,
).fit(reference).calculate(analysis)

unseen = nml.UnseenValuesCalculator(
    column_names=['salary_range', 'repaid_loan_on_prev_car', 'size_of_downpayment'],
    timestamp_column_name='timestamp',
    chunk_size=5000,
).fit(reference).calculate(analysis)

range_result = nml.NumericalRangeCalculator(
    column_names=['car_value', 'debt_to_income_ratio', 'loan_length'],
    timestamp_column_name='timestamp',
    chunk_size=5000,
).fit(reference).calculate(analysis)

Chunking quick examples

# Fixed-size chunks.
calc = nml.MissingValuesCalculator(column_names=all_features, chunk_size=5000)

# Fixed number of chunks.
calc = nml.MissingValuesCalculator(column_names=all_features, chunk_number=10)

# Time-period chunks require a timestamp column.
calc = nml.MissingValuesCalculator(column_names=all_features, timestamp_column_name='timestamp', chunk_period='W')

# Explicit chunker when incomplete-chunk behavior matters.
chunker = nml.SizeBasedChunker(chunk_size=5000, incomplete='append', timestamp_column_name='timestamp')
calc = nml.MissingValuesCalculator(column_names=all_features, chunker=chunker)

Threshold quick examples

threshold = nml.ConstantThreshold(lower=None, upper=0.02)
missing = nml.MissingValuesCalculator(column_names=['car_value'], threshold=threshold)

thresholds = {'jensen_shannon': nml.StandardDeviationThreshold(std_lower_multiplier=None, std_upper_multiplier=2)}
drift = nml.UnivariateDriftCalculator(column_names=['car_value'], continuous_methods=['jensen_shannon'], thresholds=thresholds)

Decision points

  • Use MissingValuesCalculator for NaN/missing-rate or missing-count monitoring.
  • Use UnseenValuesCalculator only on categorical columns or columns that should be treated as categorical.
  • Use NumericalRangeCalculator only on continuous columns.
  • Use summary statistics when the user wants simple aggregate monitors rather than formal drift tests.
  • Use PeriodBasedChunker or chunk_period only when a timestamp column is present and parseable.
  • Use to_df(multilevel=False) when exporting or inspecting result columns programmatically.
  • Use built-in datasets for reproducible examples rather than inventing large fixtures.

Route elsewhere

我的收藏