from scripts.save_workspace import save #===INITIALIZATION===# Debug.DEBUG = 0 umafall = UMAFALL_Model() processing = Processing_DB_Files() project = Project() s = save() #window = 10 # Janela Fixa window = 30 # Melhor Janela persons = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] #persons = [7,8,9,10,11,12,13,14,15] for p in persons: data = umafall.load_training_data_by_people( p, additional_where="and body=2 and sensor=2") #MAGNETOMETER in WAIST print("Slicing Window....") data_tsfresh, y = umafall.slice_by_window_tsfresh(data, window) if data_tsfresh is None: continue y.index += 1 del data_tsfresh["activity"] classes_counts = y.value_counts() if len(classes_counts) > 1: relevant_features = extract_relevant_features(data_tsfresh, y, column_id='id', column_sort='time') s.save_var(
from scripts.save_workspace import save #===INITIALIZATION===# Debug.DEBUG = 0 umafall = UMAFALL_Model() processing = Processing_DB_Files() project = Project() s = save() #window = 10 # Janela Fixa window = 30 # Melhor Janela persons = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] #persons = [7,8,9,10,11,12,13,14,15] for p in persons: data = umafall.load_training_data_by_people( p, additional_where="") #ALL SENSORS print("Slicing Window....") data_tsfresh, y = umafall.slice_by_window_tsfresh(data, window) if data_tsfresh is None: continue y.index += 1 del data_tsfresh["activity"] classes_counts = y.value_counts() if len(classes_counts) > 1: relevant_features = extract_relevant_features(data_tsfresh, y, column_id='id', column_sort='time') s.save_var(
persons = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] get_accuracy = Get_Accuracy() balance_data = BalanceData() threshold_balance_data = 40 #Select de best windows t = time.time() best_model = ExtraTreesClassifier(n_estimators=1000, random_state=0) w_accuracies = pd.DataFrame(columns=["window", "accurary"]) p = 1 # pessoa com mais registros project.log( "=====================UMAFALL_SELECT_BEST_WINDOWS=====================", file="umafall_log_best_window.log") for w in range(10, 110, 10): print("Load data with window len = {}".format(w)) data = umafall.load_training_data_by_people( p, additional_where="and sensor=2 and body=2") print("Slicing Window....") data_tsfresh, y = umafall.slice_by_window_tsfresh(data, w) y.index += 1 del data_tsfresh["activity"] classes_counts = y.value_counts() if len(classes_counts) > 1: relevant_features = extract_relevant_features(data_tsfresh, y, column_id='id', column_sort='time') y = pd.DataFrame(y, columns=[umafall.label_tag]) balanced_data = balance_data.balance_data(relevant_features, y, threshold_balance_data)