Nodes/ComfyUI Neural Network Toolkit NNT /NNT Time Series Data Loader
ComfyUI Node

NNT Time Series Data Loader

Classic forecasting datasets, preprocessed into sequences

By inventorado·Created 2 years ago·Updated 2 years ago· 69
NNT Time Series Data Loader
    • time_series_data
    • features_targets
    • dataset_info
    • dataset_stats
    datasetairline_passengers
    start_date1949-01
    end_date1960-12
    frequencyM
    preprocessingNone
    fill_missingforward
    return_typesingle_series
    sequence_length60
    prediction_horizon12
    custom_filepath

    Airline passengers, sunspots, co2 levels, gas prices - the classic time series every forecasting tutorial has used for fifty years, all built in and ready to load. NNT Time Series Data Loader is the pack's bridge to time series work: it pulls a named dataset (or your own CSV), slices it to a date range, applies preprocessing, and hands back windowed tensors you can feed into an RNN or LSTM stack. If the rest of the pack is your image-and-text playground, this node is the "sequence data" corner of the sandbox.

    The headline feature is that it doesn't just dump a tensor on you. It does the stats-modeling housekeeping too - missing-value filling, stationarity and seasonality tests - and returns a stats dictionary alongside the data. For a learning tool, having a machine tell you "this series is non-stationary, so difference it" is worth a lot.

    How it works

    Pick a dataset from eleven built-in options (default airline_passengers), optionally narrow it with start_date/end_date (strings like 1949-01), set the frequency (M, D, W, Y, Q, H), and the node loads it from statsmodels, caching the raw CSV into ComfyUI/models/timeseries_datasets/ on first use. The preprocessing menu handles the classic moves - standardize, normalize, log, difference, box-cox - and fill_missing handles gaps with forward/backward/linear fills.

    The return_type dropdown changes what you get:

    • single_series - the raw series as a tensor.
    • multi_series - multiple lagged series, for looking at the data as a set of shifted views.
    • features_targets - actual training windows: sequence_length (default 60) steps of history as features, prediction_horizon (default 12) steps ahead as targets. This is the one you want for training a forecaster.

    custom_filepath lets you load any CSV (with a date column as index) instead of the built-ins.

    Outputs: time_series_data, features_targets (empty unless you asked for windows), dataset_info (a string summary), and dataset_stats - a DICT holding original/processed shapes, missing-value count, stationarity test result, seasonality test result, and mean/std/min/max/skew/kurtosis. Wire dataset_stats into a string node or just read it in the console.

    Where it fits and what bites

    The natural companion here is the pack's NntDefineRNNLayer / LSTM layers: load airline_passengers with return_type=features_targets, feed features_targets into an LSTM model as your training/target data, train, and you've built a tiny forecasting demo end to end.

    Gotchas worth knowing. The statsmodels datasets are small and old - that's the point (tutorial-grade), but don't expect modern data. box-cox needs strictly positive values; if your series has zeros the preprocessing throws, so reach for log or difference instead. And the start_date/end_date strings are parsed against the dataset's natural frequency, so mismatched granularity can silently give you a slice you didn't intend - check dataset_info before training on it.

    Install

    Pack-level install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/inventorado/ComfyUI_NNT.git
    cd ComfyUI_NNT
    pip install -r requirements.txt
    

    Restart ComfyUI (or Manager → "ComfyUI Neural Network Toolkit NNT"). This node specifically needs statsmodels and scipy, both in the pack requirements. Full install is heavy - torch, sklearn, transformers, onnx, shap pinned 0.41.0 - so budget a few minutes on first run. It's a niche node, but for anyone learning sequence models in ComfyUI, it's the easiest on-ramp available.

    CategoryNNT Neural Network Toolkit/Data Loading

    Inputs (10)

    NameTypeDefaultDescription
    datasetCOMBOairline_passengers11 options: airline_passengers, sunspots, mortality_rates, livestock, electricity_consumption, gas_prices, +5
    start_dateSTRING1949-01
    end_dateSTRING1960-12
    frequencyCOMBOM6 options: M, D, W, Y, Q, H
    preprocessingCOMBONone6 options: None, standardize, normalize, log, difference, box-cox
    fill_missingCOMBOforward4 options: forward, backward, linear, none
    return_typeCOMBOsingle_series3 options: single_series, multi_series, features_targets
    sequence_lengthINT601–1000
    prediction_horizonINT121–100
    custom_filepathoptSTRING

    Outputs (4)

    NameTypeDescription
    time_series_dataTENSOR
    features_targetsTENSOR
    dataset_infoSTRING
    dataset_statsDICT