diff --git a/EIVPackage/EIVData/repeated_linear.py b/EIVPackage/EIVData/repeated_linear.py new file mode 100644 index 0000000000000000000000000000000000000000..6e0bd5376b8bac3631ee65590851a8da1480db5d --- /dev/null +++ b/EIVPackage/EIVData/repeated_linear.py @@ -0,0 +1,11 @@ +""" +Repeated sampling from the linear dataset. +""" +from EIVData import linear + +from EIVData.repeated_sampling import repeated_sampling + +fixed_seed = 0 + +load_data = repeated_sampling(dataclass=linear, + fixed_seed=fixed_seed) diff --git a/EIVPackage/EIVData/repeated_quadratic.py b/EIVPackage/EIVData/repeated_quadratic.py new file mode 100644 index 0000000000000000000000000000000000000000..4c409829be7ef006deff7812d79cb35e2717b6ae --- /dev/null +++ b/EIVPackage/EIVData/repeated_quadratic.py @@ -0,0 +1,11 @@ +""" +Repeated sampling from the quadratic dataset. +""" +from EIVData import quadratic + +from EIVData.repeated_sampling import repeated_sampling + +fixed_seed = 0 + +load_data = repeated_sampling(dataclass=quadratic, + fixed_seed=fixed_seed) diff --git a/EIVPackage/EIVData/repeated_sampling.py b/EIVPackage/EIVData/repeated_sampling.py index 771577de48c49bef96b06e7d05d72e52ceaefb57..465a20e81bddbc39cc0f26d869f875adf73439e1 100644 --- a/EIVPackage/EIVData/repeated_sampling.py +++ b/EIVPackage/EIVData/repeated_sampling.py @@ -1,3 +1,7 @@ +""" +Contains the class `repeated_sampling` that can be used to generate +datasets for repeated sampling from datasets with a ground truth. +""" import sys import torch @@ -6,6 +10,19 @@ from torch.utils.data import TensorDataset from EIVGeneral.manipulate_tensors import add_noise class repeated_sampling(): + """ + A class for repeated sampling from datasets with a known ground truth and + known input and output noise. The class `dataclass` should contain a + `load_data` routine that returns a ground truth and two positive floats + `x_noise_strength` and `y_noise_strength` that will be used as the standard + deviation of input and output noise. + :param dataclass: A module that contains a routine `load_data`, which + accepts the keyword `return_ground_truth` and returns the noisy and true + train and test datasets, and two positive floats `x_noise_strength` and + `y_noise_strength`. + :param fixed_seed: Integer. The seed to load the unnoisy ground truth, + defaults to 0. + """ def __init__(self, dataclass, fixed_seed=0): self.dataclass = dataclass self.fixed_seed = fixed_seed