def get_trials_group_by_folder_name():
    import copy
    if (get_trials_group_by_folder_name.done):
        return copy.deepcopy(
            get_trials_group_by_folder_name.trials_group_by_folder_name)

    import load_csv_data
    trials_group_by_folder_name = load_csv_data.run(
        success_path=training_config.success_path,
        interested_data_fields=training_config.interested_data_fields,
        preprocessing_normalize=False,
        preprocessing_scaling=False)

    get_trials_group_by_folder_name.done = True
    get_trials_group_by_folder_name.trials_group_by_folder_name = trials_group_by_folder_name
    return copy.deepcopy(
        get_trials_group_by_folder_name.trials_group_by_folder_name)
def get_trials_group_by_folder_name(training_config, data_class='success'):
    import load_csv_data
    import copy

    if data_class == 'success':
        data_path = training_config.success_path
    elif data_class == 'test_success':
        data_path = training_config.test_success_data_path
    else:
        raise Exception("unknown data class %s" % data_class)

    trials_group_by_folder_name = load_csv_data.run(
        data_path=data_path,
        interested_data_fields=training_config.interested_data_fields,
        preprocessing_normalize=training_config.preprocessing_normalize,
        preprocessing_scaling=training_config.preprocessing_scaling,
        norm_style=training_config.norm_style)

    trials_group_by_folder_name
    return trials_group_by_folder_name
Example #3
0
sys.path.append("/home/birl_wu/TICC")
import TICC_solver as TICC
import numpy as np
import sys
import load_csv_data
import ipdb
base_path = 'anomaly_data_mix'
interested_data_fields = [
    '.wrench_stamped.wrench.force.x',
    '.wrench_stamped.wrench.force.y',
    '.wrench_stamped.wrench.force.z',
    '.wrench_stamped.wrench.torque.x',
    '.wrench_stamped.wrench.torque.y',
    '.wrench_stamped.wrench.torque.z',
]
all_trial_data = load_csv_data.run(base_path, interested_data_fields)
all_trial_data = all_trial_data.values()
for i in range(len(all_trial_data)):
    if i == 0:
        _temp = all_trial_data[i]
    else:
        _temp = np.concatenate((_temp, all_trial_data[i]), axis=0)
np.savetxt('anomaly_data.txt', _temp, delimiter=',')
fname = 'anomaly_data.txt'

(cluster_assignment, cluster_MRFs) = TICC.solve(window_size=5,
                                                number_of_clusters=2,
                                                lambda_parameter=11e-2,
                                                beta=100,
                                                maxIters=100,
                                                threshold=2e-5,