Exemplo n.º 1
0
def main():
    ctrl = Controller()
    ctrl.load_dataset_from_file(DATASET_FILE_PATH)

    # load model
    model_name = 'bhmm'
    ctrl.load_model(MODEL_FILE_PATH, model_name)
    ctrl.create_model_agnostics(model_name)
    hm = ctrl.get_model(model_name)._obs_lbl_hashmap
    file_path = MODEL_FOLDER_PATH + '/' + MODEL_NAME + '.lime_sleeping.png'
    file_paths = [file_path]
    labels_to_explain=['sleeping']
    import numpy as np
    # typical for activation pattern for sleeping
    raw_feature_sleeping = np.array(
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], dtype=bool)
    ch_feature_sleeping = np.array(
        [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=bool)
    lf_feature_sleeping = np.array(
        [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=bool)
    data = ctrl._dataset # type: _Dataset
    ctrl.plot_and_save_explanation(
        model_name,
        ch_feature_sleeping,
        labels_to_explain,
        file_paths
    )
Exemplo n.º 2
0
def main():
    ctrl = Controller()
    ctrl.load_dataset_from_file(DATASET_FILE_PATH)

    # load model
    model_name = 'bhmm'
    ctrl.load_model(MODEL_FILE_PATH, model_name)
    ctrl.create_model_agnostics(model_name)
    file_path = MODEL_FOLDER_PATH + '/' + MODEL_NAME + '.feature_importance.png'
    ctrl.save_plot_feature_importance(model_name, file_path)