Example #1
0
def main():
    try:
        parser = get_args_parser()
        args = parser.parse_args()
        if args.command == "predict_proba":
            predict_proba(args.input_path, args.model_path, args.device)
        elif args.command == "predict":
            print(predict(args.input_path, args.model_path, args.device))
        elif args.command == "learn":
            learn(args.location, args.num_samples, args.device)
        elif args.command == "crossval":
            crossval(path=args.model_path)
        elif args.command in ["locations", "ls"]:
            locations(args.model_path)
        elif args.command == "rename":
            rename_label(args.label, args.new_label)
            print("Retraining model...")
            train_model()
        elif args.command == "train":
            train_model(args.model_path)
        else:
            parser.print_help()
            parser.exit(1)
    except (KeyboardInterrupt, SystemExit):
        exit()
Example #2
0
def main():
    if "predict_proba" == sys.argv[1]:
        predict_proba()
    elif "predict" == sys.argv[1]:
        predict()
    elif "learn" in sys.argv[1] and len(sys.argv) == 4:
        category = sys.argv[2]
        n = int(sys.argv[3])
        learn(category, n)
    elif "crossval" in sys.argv[1]:
        crossval()
Example #3
0
def main():
    parser = get_args_parser()
    args = parser.parse_args()
    if args.command == "predict_proba":
        predict_proba()
    elif args.command == "predict":
        predict()
    elif args.command == "learn":
        learn(args.location, args.num_samples)
    elif args.command == "crossval":
        crossval()
    else:
        parser.print_help()
        parser.exit(1)
Example #4
0
def main():
    parser = get_args_parser()
    args = parser.parse_args()
    if args.command == "predict_proba":
        predict_proba()
    elif args.command == "predict":
        predict()
    elif args.command == "learn":
        learn(args.location, args.num_samples)
    elif args.command == "crossval":
        crossval()
    elif args.command == "locations":
        locations()
    else:
        parser.print_help()
        parser.exit(1)
Example #5
0
def main():
    parser = get_args_parser()
    args = parser.parse_args()
    if args.command == "predict_proba":
        predict_proba()
    elif args.command == "predict":
        print(predict())
    elif args.command == "learn":
        learn(args.location, args.num_samples)
    elif args.command == "crossval":
        crossval()
    elif args.command in ["locations", "ls"]:
        locations()
    elif args.command == "rename":
        rename_label(args.label, args.new_label)
        print("Retraining model...")
        train_model()
    else:
        parser.print_help()
        parser.exit(1)
Example #6
0
def test_crossval():
    X, y = mock_get_train_data()
    pipeline = mock_get_model()
    return crossval(pipeline, X, y, folds=2, n=1)
Example #7
0
def test_crossval():
    X, y = mock_get_train_data()
    pipeline = mock_get_model()
    assert crossval(pipeline, X, y, folds=2, n=1)