[DBG] more bug fixes in exampledataset fm data-dev
[DBG] more bug fixes in exampledataset fm data-dev
@@ -15,10 +15,22 @@ def preprocess_example(rawdata=None):
class DatasetExample(DatasetBase):
"""
DatasetExample class is a variant of Dataset that takes in any arbitrary user defined data and process it into standard Dataset format.
+ It also enables the user to specifies arbitrary subset or split methods.
"""
def __init__(self, rawdata=None,preprocess=preprocess_example):
measurements,descriptors,obs_descriptors,channel_descriptors=preprocess(rawdata)
+ if (measurements.ndim==2):
+ self.measurements = measurements
+ self.n_set = 1
+ self.n_obs,self.n_channel = self.measurements.shape
+ elif (measurements.ndim==3):
+ self.measurements = measurements
+ self.n_set,self.n_obs,self.n_channel = self.measurements.shape
+ self.descriptors = descriptors
+ self.obs_descriptors = obs_descriptors
+ self.channel_descriptors = channel_descriptors
+
def split_obs(self, by):
""" Returns a list Datasets splited by obs
Args:
@@ -40,20 +52,22 @@ class DatasetExample(DatasetBase):
"""
# TODO
- def subset_obs(self, value):
- """ Returns a subsetted Dataset defined by certain obs
+ def subset_obs(self, by, value):
+ """ Returns a subsetted Dataset defined by certain obs value
Args:
- value (HashMap<String,Float or String>): the value by which the subset selection is made from obs dimension
+ by(String): the descriptor by which the subset selection is made from obs dimension
+ value: the value by which the subset selection is made from obs dimension
Returns:
Dataset, with subset defined by the selected obs_descriptor
"""
# TODO
- def subset_channel(self, value):
- """ Returns a subsetted Dataset defined by certain channel
+ def subset_channel(self, by, value):
+ """ Returns a subsetted Dataset defined by certain channel value
Args:
- value (HashMap<String,Float or String>): the value by which the subset selection is made from channel dimension
+ by(String): the descriptor by which the subset selection is made from channel dimension
+ value: the value by which the subset selection is made from channel dimension
Returns:
Dataset, with subset defined by the selected channel_descriptor
