Forge.Source.Generator (Forge v0.1.1)
View SourceGenerator source that creates samples using a function.
Generates samples dynamically using a generator function that receives an index and returns a data map.
Options
:count- Number of samples to generate (required):generator- Function that takes index and returns data map (required):batch_size- Number of samples per fetch (default: count, all at once)
Examples
# Generate 100 random samples
source Forge.Source.Generator,
count: 100,
generator: fn index ->
%{id: index, value: :rand.uniform()}
end
# With batching
source Forge.Source.Generator,
count: 1000,
batch_size: 100,
generator: fn index ->
%{index: index, data: generate_data(index)}
end