GitHub
deepbox/datasets

Built-in & External Datasets

Built-in loaders plus remote, text, image, and Kaggle dataset helpers.
Data sources
type ImageDataset
export type ImageDataset = { /** Flattened image data tensor of shape (nSamples, nPixels) */ readonly data: Tensor; /** Integer label tensor of shape (nSamples,) */ readonly target: Tensor; /** Number of classes */ read…
Result of an image dataset fetch.
type KaggleCredentials
export type KaggleCredentials = { /** Kaggle username. */ readonly username: string; /** Kaggle API key. */ readonly key: string; };
Kaggle dataset integration for Deepbox.
type KaggleDatasetInfo
export type KaggleDatasetInfo = { readonly id: string; readonly title: string; readonly subtitle: string; readonly totalBytes: number; readonly fileCount: number; readonly lastUpdated: string; readonly downloadCount: nu…
Metadata about a Kaggle dataset.
type KaggleDownloadResult
export type KaggleDownloadResult = { /** Raw file data as Uint8Array (may be a ZIP archive). */ readonly data: Uint8Array; /** The filename. */ readonly filename: string; /** Content type from the response. */ readonly…
Result of a Kaggle dataset download.
type KaggleFetchOptions
export type KaggleFetchOptions = { /** API credentials. If not provided, reads from ~/.kaggle/kaggle.json. */ readonly credentials?: KaggleCredentials; /** Specific file within the dataset to download. Default: all file…
Options for fetching a Kaggle dataset.
type Dataset
export type Dataset = { data: Tensor; target: Tensor; featureNames: string[]; targetNames?: string[]; description: string; images?: Tensor; };
Standard dataset structure returned by all built-in dataset loaders.
type FetchCSVDatasetOptions
export type FetchCSVDatasetOptions = { /** URL of the CSV file to fetch. */ readonly url: string; /** 0-based column index to use as the target variable. Defaults to last column. */ readonly targetColumn?: number; /** W…
Options for .
type RemoteDataset
export type RemoteDataset = { readonly data: Tensor; readonly target: Tensor; readonly featureNames: string[]; readonly targetName: string; readonly description: string; };
Result of a remote dataset fetch.
type TextDataset
export type TextDataset = { /** Array of text documents */ readonly texts: string[]; /** Integer label tensor of shape (nSamples,) */ readonly target: Tensor; /** Number of classes */ readonly nClasses: number; /** Clas…
Result of a text dataset fetch.
fetchCIFAR10
export declare function fetchCIFAR10(options?: { /** Base URL override for custom mirrors */ readonly baseUrl?: string; /** Maximum number of samples to load (default: all) */ readonly maxSamples?: number; /** Which split to load: 'train' (50k) or 'test' (10k) */ readonly split?: "train" | "test"; }): Promise<ImageDataset>;

Fetch the CIFAR-10 image classification dataset.

fetchMNIST
export declare function fetchMNIST(options?: { /** Base URL override for custom mirrors */ readonly baseUrl?: string; /** Maximum number of samples to load (default: all) */ readonly maxSamples?: number; /** Which split to load: 'train' (60k) or 'test' (10k) */ readonly split?: "train" | "test"; }): Promise<ImageDataset>;

Fetch the MNIST handwritten digits dataset.

fetchKaggleDataset
export declare function fetchKaggleDataset(datasetId: string, options?: KaggleFetchOptions): Promise<KaggleDownloadResult>;

Download a Kaggle dataset or specific file.

fetchKaggleDatasetInfo
export declare function fetchKaggleDatasetInfo(datasetId: string, options?: KaggleFetchOptions): Promise<KaggleDatasetInfo>;

Fetch metadata for a Kaggle dataset.

listKaggleFiles
export declare function listKaggleFiles(datasetId: string, options?: KaggleFetchOptions): Promise<{ name: string; totalBytes: number; }[]>;

List files in a Kaggle dataset.

readKaggleCredentials
export declare function readKaggleCredentials(): Promise<KaggleCredentials | undefined>;

Read Kaggle credentials from the standard kaggle.json file.

searchKaggleDatasets
export declare function searchKaggleDatasets(query: string, options?: KaggleFetchOptions): Promise<KaggleDatasetInfo[]>;

Search Kaggle datasets.

loadBreastCancer
export declare function loadBreastCancer(): Dataset;

Load the Breast Cancer Wisconsin (Diagnostic) dataset (UCI).

loadConcentricRings
export declare function loadConcentricRings(): Dataset;

Load the synthetic Concentric Rings classification dataset.

loadCropYield
export declare function loadCropYield(): Dataset;

Load the synthetic Crop Yield regression dataset.

loadCustomerSegments
export declare function loadCustomerSegments(): Dataset;

Load the synthetic Customer Segments clustering dataset.

loadDiabetes
export declare function loadDiabetes(): Dataset;

Load the Diabetes regression dataset (Efron et al., 2004).

loadDigits
export declare function loadDigits(): Dataset;

Load the Optical Recognition of Handwritten Digits dataset (UCI).

loadEnergyEfficiency
export declare function loadEnergyEfficiency(): Dataset;

Load the synthetic Energy Efficiency regression dataset.

loadFitnessScores
export declare function loadFitnessScores(): Dataset;

Load the synthetic Fitness Scores multi-output regression dataset.

loadFlowersExtended
export declare function loadFlowersExtended(): Dataset;

Load the synthetic Flowers Extended classification dataset.

loadFruitQuality
export declare function loadFruitQuality(): Dataset;

Load the synthetic Fruit Quality classification dataset.

loadGaussianIslands
export declare function loadGaussianIslands(): Dataset;

Load the synthetic Gaussian Islands classification dataset.

loadHousingMini
export declare function loadHousingMini(): Dataset;

Load the synthetic Housing-Mini regression dataset.

loadIris
export declare function loadIris(): Dataset;

Load the Iris dataset (R.

loadLeafShapes
export declare function loadLeafShapes(): Dataset;

Load the synthetic Leaf Shapes classification dataset.

loadLinnerud
export declare function loadLinnerud(): Dataset;

Load the synthetic Linnerud multi-output regression dataset.

loadMoonsMulti
export declare function loadMoonsMulti(): Dataset;

Load the synthetic Moons-Multi classification dataset.

loadPerfectlySeparable
export declare function loadPerfectlySeparable(): Dataset;

Load the synthetic Perfectly Separable classification dataset.

loadPlantGrowth
export declare function loadPlantGrowth(): Dataset;

Load the synthetic Plant Growth regression dataset.

loadSeedMorphology
export declare function loadSeedMorphology(): Dataset;

Load the synthetic Seed Morphology classification dataset.

loadSensorStates
export declare function loadSensorStates(): Dataset;

Load the synthetic Sensor States classification dataset.

loadSpiralArms
export declare function loadSpiralArms(): Dataset;

Load the synthetic Spiral Arms classification dataset.

loadStudentPerformance
export declare function loadStudentPerformance(): Dataset;

Load the synthetic Student Performance classification dataset.

loadTrafficConditions
export declare function loadTrafficConditions(): Dataset;

Load the synthetic Traffic Conditions classification dataset.

loadWeatherOutcomes
export declare function loadWeatherOutcomes(): Dataset;

Load the synthetic Weather Outcomes multi-output regression dataset.

loadWine
export declare function loadWine(): Dataset;

Load the Wine recognition dataset (UCI).

fetchCSVDataset
export declare function fetchCSVDataset(options: FetchCSVDatasetOptions): Promise<RemoteDataset>;

Fetch a CSV dataset from a remote URL and parse it into tensors.

parseCSV
export declare function parseCSV(text: string, options?: { readonly targetColumn?: number; readonly header?: boolean; readonly separator?: string; }): RemoteDataset;

Parse a CSV string into a RemoteDataset.

fetch20Newsgroups
export declare function fetch20Newsgroups(options?: { /** Which subset: 'train', 'test', or 'all' (default: 'all') */ readonly subset?: "train" | "test" | "all"; /** Maximum number of samples to load */ readonly maxSamples?: number; /** Base URL override for custom mirror */ readonly baseUrl?: string; /** When true, return synthetic placeholder data on fetch failure. Default: false */ readonly allowSyntheticFallback?: boolean; }): Promise<TextDataset>;

Fetch the 20 Newsgroups text classification dataset.

fetchIMDB
export declare function fetchIMDB(options?: { /** Which subset: 'train', 'test', or 'all' (default: 'all') */ readonly subset?: "train" | "test" | "all"; /** Maximum number of samples to load */ readonly maxSamples?: number; /** Base URL override for custom mirror */ readonly baseUrl?: string; /** When true, return synthetic placeholder data on fetch failure. Default: false */ readonly allowSyntheticFallback?: boolean; }): Promise<TextDataset>;

Fetch the IMDB movie review sentiment dataset.

datasets-builtin.ts
import {  fetch20Newsgroups,  fetchCSVDataset,  loadDigits,  loadIris,} from "deepbox/datasets";console.log(loadIris().data.shape, loadIris().target.shape);console.log(loadDigits().data.shape);console.log(await fetchCSVDataset({ url: "https://example.com/data.csv" }));console.log(await fetch20Newsgroups({ subset: "train" }));