Ejemplo n.º 1
0
 def setUp(self):
     dataset_dir = str(script_directory) + '/datasets/partial_dataset'
     self.data = load_act_assist(dataset_dir, subjects=[SUBJECT_ADMIN_NAME])
     self.data.df_activities = self.data.df_activities_admin
     self.rf_pipe = [('raw', BinaryEncoder(encode='raw')),
                     ('lbl', LabelEncoder(idle=True)),
                     ('drop_tidx', DropTimeIndex()),
                     ('classifier', RandomForestClassifier(random_state=42))
                     ]
     self.kde_pipe = [('raw', BinaryEncoder(encode='raw')),
                      ('drop_tidx', DropTimeIndex()),
                      ('classifier',
                       KernelDensity(kernel='gaussian', bandwidth=0.5))]
     self.svm_pipe = [('raw', BinaryEncoder(encode='raw')),
                      ('lbl', LabelEncoder(idle=True)),
                      ('drop_tidx', DropTimeIndex()), ('classifier', SVC())]
Ejemplo n.º 2
0
 def setUp(self):
     dataset_dir = str(script_directory) + '/datasets/partial_dataset'
     self.data = load_act_assist(dataset_dir, subjects=[SUBJECT_ADMIN_NAME])
     self.data.df_activities = self.data.df_activities_admin
     self.iris = load_iris()
Ejemplo n.º 3
0
 def setUp(self):
     dataset_dir = str(script_directory) + '/datasets/empty_dataset'
     self.data = load_act_assist(
         dataset_dir, subjects=[SUBJECT_ONE_NAME, SUBJECT_TWO_NAME])
Ejemplo n.º 4
0
 def setUp(self):
     dataset_dir = str(script_directory) + '/datasets/dirty_dataset'
     self.data = load_act_assist(dataset_dir, subjects=[SUBJECT_ADMIN_NAME])
Ejemplo n.º 5
0
        os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'act_assist.settings')
    else:
        logger.info('running in production mode')
        sys.path.append('/opt/activity_assistant/web')
        sys.path.append('/etc/opt/activity_assistant/')
        os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')

    import django
    django.setup()

    from backend.models import Dataset
    import settings
    from frontend.util import get_person_names, get_server
    from pyadlml.dataset import load_act_assist

    try:
        logger.info('loading dataset...')
        dataset = Dataset.objects.get(id=args.dataset_id)
        data = load_act_assist(dataset.path_to_folder, get_person_names())
        logger.info('generating plots for persons...')
        gen_plots_persons(dataset, data)
        logger.info('generating plots for devices...')
        gen_plots_devices(dataset, data)
    except KeyboardInterrupt:
        pass
    finally:
        logger.info('wrapping up service...')
        srv = get_server()
        srv.plot_gen_service_pid = None
        srv.save()
        logger.info('exited')