rr.experiment.database module

rr.experiment.database.get(protocol, subset, classes=['Other_Activity', 'Watch_TV', 'Sleep_Out_Of_Bed', 'Bathe', 'Cook_Breakfast', 'Dress', 'Toilet', 'Personal_Hygiene', 'Sleep', 'Read', 'Relax', 'Cook_Dinner', 'Drink', 'Eat_Breakfast', 'Morning_Meds', 'Evening_Meds', 'Wash_Breakfast_Dishes', 'Cook_Lunch', 'Wash_Dishes', 'Leave_Home', 'Cook', 'Enter_Home', 'Entertain_Guests', 'Wash_Dinner_Dishes', 'Phone', 'Groom', 'Step_Out', 'Eat_Dinner', 'Eat_Lunch', 'Wash_Lunch_Dishes', 'Bed_Toilet_Transition', 'Eat', 'Go_To_Sleep', 'Wake_Up', 'Work_At_Table'], variables=['lastSensorEventHours', 'lastSensorEventSeconds', 'lastSensorDayOfWeek', 'windowDuration', 'timeSinceLastSensorEvent', 'prevDominantSensor1', 'prevDominantSensor2', 'lastSensorID', 'lastSensorLocation', 'lastMotionLocation', 'complexity', 'activityChange', 'areaTransitions', 'numDistinctSensors', 'sensorCount-Bathroom', 'sensorCount-Bedroom', 'sensorCount-Chair', 'sensorCount-DiningRoom', 'sensorCount-Hall', 'sensorCount-Ignore', 'sensorCount-Kitchen', 'sensorCount-LivingRoom', 'sensorCount-Office', 'sensorCount-OutsideDoor', 'sensorCount-WorkArea', 'sensorElTime-Bathroom', 'sensorElTime-Bedroom', 'sensorElTime-Chair', 'sensorElTime-DiningRoom', 'sensorElTime-Hall', 'sensorElTime-Ignore', 'sensorElTime-Kitchen', 'sensorElTime-LivingRoom', 'sensorElTime-Office', 'sensorElTime-OutsideDoor', 'sensorElTime-WorkArea'], filepath='./data/csh101/csh101.ann.features.csv')

Get the desired subset

Parameters
  • protocol (str) – protocol to use

  • subset (str) – subset to extract (train or test)

  • classes (list) – list of desired classes

  • variables (list) – list of desired variables (features)

  • filepath (str) – path to the file containing the dataset to load

Returns

A PxQ 2D-array containing only the desired subset of samples with the Q desired features ret_y (numpy.ndarray): A 1D-array of length P containing only the labels corresponding to the subset ret_x

Return type

ret_x (numpy.ndarray)

Raises

None

rr.experiment.database.load(filepath='./data/csh101/csh101.ann.features.csv')

Loads the dataset

Parameters

filepath (str) – path to the file containing the dataset to load

Returns

A NxM 2D-array where each row corresponds to a sample and each column to a feature y (numpy.ndarray): A 1D-array of length N, where each element corresponds to a sample label

Return type

x (numpy.ndarray)

Raises

None

rr.experiment.database.split_data(x, y, subset, splits)

Splits the data set

Parameters
  • x (numpy.ndarray) – A NxM 2D-array where each row corresponds to a sample and each column to a feature

  • y (numpy.ndarray) – A 1D-array of length N, where each element corresponds to a sample label

  • subset (str) – subset to extract (train or test)

  • splits (dict) – a dictionary mapping the subsets to their dataset proportion and the random state to use for splitting

Returns

A PxM 2D-array containing only a subset of samples y_split (numpy.ndarray): A 1D-array of length P containing only the labels corresponding to the subset x_split

Return type

x_split (numpy.ndarray)

Raises

None