parent
3611fc76f7
commit
0152fbe4ac
|
@ -40,6 +40,7 @@ class SensorFeatures:
|
||||||
print("SensorFeatures initialized.")
|
print("SensorFeatures initialized.")
|
||||||
|
|
||||||
def set_sensor_data(self):
|
def set_sensor_data(self):
|
||||||
|
print("Querying database ...")
|
||||||
if "proximity" in self.data_types:
|
if "proximity" in self.data_types:
|
||||||
self.df_proximity = proximity.get_proximity_data(
|
self.df_proximity = proximity.get_proximity_data(
|
||||||
self.participants_usernames
|
self.participants_usernames
|
||||||
|
@ -65,6 +66,7 @@ class SensorFeatures:
|
||||||
raise KeyError("This data type has not been implemented.")
|
raise KeyError("This data type has not been implemented.")
|
||||||
|
|
||||||
def calculate_features(self):
|
def calculate_features(self):
|
||||||
|
print("Calculating features ...")
|
||||||
if "proximity" in self.data_types:
|
if "proximity" in self.data_types:
|
||||||
self.df_proximity_counts = proximity.count_proximity(
|
self.df_proximity_counts = proximity.count_proximity(
|
||||||
self.df_proximity, self.grouping_variable
|
self.df_proximity, self.grouping_variable
|
||||||
|
@ -137,6 +139,7 @@ class Labels:
|
||||||
print("Labels initialized.")
|
print("Labels initialized.")
|
||||||
|
|
||||||
def set_labels(self):
|
def set_labels(self):
|
||||||
|
print("Querying database ...")
|
||||||
self.df_esm = esm.get_esm_data(self.participants_usernames)
|
self.df_esm = esm.get_esm_data(self.participants_usernames)
|
||||||
print("Got ESM data from the DB.")
|
print("Got ESM data from the DB.")
|
||||||
self.df_esm_preprocessed = esm.preprocess_esm(self.df_esm)
|
self.df_esm_preprocessed = esm.preprocess_esm(self.df_esm)
|
||||||
|
@ -162,6 +165,7 @@ class Labels:
|
||||||
raise KeyError("This questionnaire has not been implemented as a label.")
|
raise KeyError("This questionnaire has not been implemented as a label.")
|
||||||
|
|
||||||
def aggregate_labels(self):
|
def aggregate_labels(self):
|
||||||
|
print("Aggregating labels ...")
|
||||||
self.df_esm_means = (
|
self.df_esm_means = (
|
||||||
self.df_esm_clean.groupby(
|
self.df_esm_clean.groupby(
|
||||||
["participant_id", "questionnaire_id"] + self.grouping_variable
|
["participant_id", "questionnaire_id"] + self.grouping_variable
|
||||||
|
@ -207,6 +211,7 @@ class ModelValidation:
|
||||||
print("Validation method set.")
|
print("Validation method set.")
|
||||||
|
|
||||||
def cross_validate(self):
|
def cross_validate(self):
|
||||||
|
print("Running cross validation ...")
|
||||||
if self.model is None:
|
if self.model is None:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"Please, specify a machine learning model first, by setting the .model attribute. "
|
"Please, specify a machine learning model first, by setting the .model attribute. "
|
||||||
|
|
Loading…
Reference in New Issue