Exemple #1
0
    import os.path
    from pybot.utils.db_utils import AttrDict

    # Parse directory
    parser = argparse.ArgumentParser(description='Run UW RGB-D training')
    parser.add_argument('-c',
                        '--classifier',
                        type=str,
                        required=True,
                        help="Classifier path")
    args = parser.parse_args()

    clf_path = os.path.expanduser(args.classifier)
    # try:

    cinfo = AttrDict.load(clf_path)

    cm = metrics.confusion_matrix(cinfo.test_target, cinfo.pred_target)
    # print ' Confusion matrix (Test): %s' % (cm)
    print(' Accuracy score (Test): %4.3f' %
          (metrics.accuracy_score(cinfo.test_target, cinfo.pred_target)))
    print(' Report (Test):\n %s' % (metrics.classification_report(
        cinfo.test_target, cinfo.pred_target,
        target_names=cinfo.target_names)))

    # plot_roc_curve(cinfo.test_target, cinfo.pred_score)

    # except:
    #     raise RuntimeError('Error loading classfier %s' % clf_path )

    # rtarget_names = cinfo.target_names
Exemple #2
0
 def load(cls, path):
     db = AttrDict.load(path)
     return cls.from_dict(db)