sample
table.sample
Documentation
Sample a table.
Samples are used to randomly select a subset of a
dataset, which helps test queries and workflows on
smaller versions of the original data, to adjust
parameters before a full run.
Origin
Authors Markus Binsteiner (markus@frkl.io)
Context
Tags core
Labels package: kiara_modules.core
References source_repo:
https://github.com/DHARPA-Project/kia…
documentation:
https://dharpa.org/kiara_modules.core/
module_doc:
https://dharpa.org/kiara_modules.core…
source_url:
https://github.com/DHARPA-Project/kia…
Module config
Field Type Description Required
─────────────────────────────────────────────────────
constants object Value constants no
for this module.
defaults object Value defaults no
for this module.
sample_type string The sample yes
method.
Module config -- no config --
Python class
class_name SampleTableModule
module_name kiara_modules.core.table
full_name kiara_modules.core.table.SampleTable…
Processing source code ─────────────────────────────────────────────────────
def process(self, inputs: ValueSet, outputs: Value…
sample_size: int = inputs.get_value_data("samp…
sample_type: str = self.get_config_value("samp…
if sample_size < 0:
raise KiaraProcessingException(
f"Invalid sample size '{sample_size}':…
)
input_name = self.get_value_type()
if input_name == "any":
input_name = "value_item"
value: Value = inputs.get_value_obj(input_name)
func = getattr(self, f"sample_{sample_type}")
result = func(value=value, sample_size=sample_…
outputs.set_value("sampled_value", result)
─────────────────────────────────────────────────────