examples/run_sweep.py
def main():
    """Main function to sweep parameters of a certain algorithm."""
    parser = argparse.ArgumentParser(
        description="Runs the speficied algorithm(s) on the MSAF "
        "formatted dataset.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("in_path",
                        action="store",
                        help="Input dataset")
    parser.add_argument("-f",
                        action="store",
                        dest="feature",
                        default="pcp",
                        type=str,
                        help="Type of features",
                        choices=["pcp", "tonnetz", "mfcc", "cqt", "tempogram"])
    parser.add_argument("-b",
                        action="store_true",
                        dest="annot_beats",
                        help="Use annotated beats",
                        default=False)
    parser.add_argument("-fs",
                        action="store_true",
                        dest="framesync",
                        help="Use frame-synchronous features",
                        default=False)
    parser.add_argument("-bid",
                        action="store",
                        help="Boundary algorithm identifier",
                        dest="boundaries_id",
                        default="gt",
                        choices=["gt"] +
                        io.get_all_boundary_algorithms())
    parser.add_argument("-lid",
                        action="store",
                        help="Label algorithm identifier",
                        dest="labels_id",
                        default=None,
                        choices=io.get_all_label_algorithms())
    parser.add_argument("-j",
                        action="store",
                        dest="n_jobs",
                        default=4,
                        type=int,
                        help="The number of threads to use")
    args = parser.parse_args()
    start_time = time.time()

    # Run the algorithm(s)
    process(args.in_path, annot_beats=args.annot_beats, feature=args.feature,
            framesync=args.framesync, boundaries_id=args.boundaries_id,
            labels_id=args.labels_id, n_jobs=args.n_jobs)

    # Done!
    logging.info("Done! Took %.2f seconds." % (time.time() - start_time))
def main():
    parser = argparse.ArgumentParser(
        description="Runs the speficied algorithm(s) on the MSAF "
        "formatted dataset.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("in_path",
                        action="store",
                        help="Input dataset")
    parser.add_argument("-f",
                        action="store",
                        dest="feature",
                        default="pcp",
                        type=str,
                        help="Type of features",
                        choices=["pcp", "tonnetz", "mfcc", "cqt", "tempogram"])
    parser.add_argument("-b",
                        action="store_true",
                        dest="annot_beats",
                        help="Use annotated beats",
                        default=False)
    parser.add_argument("-fs",
                        action="store_true",
                        dest="framesync",
                        help="Use frame-synchronous features",
                        default=False)
    parser.add_argument("-bid",
                        action="store",
                        help="Boundary algorithm identifier",
                        dest="boundaries_id",
                        default="gt",
                        choices=["gt"] +
                        io.get_all_boundary_algorithms())
    parser.add_argument("-lid",
                        action="store",
                        help="Label algorithm identifier",
                        dest="labels_id",
                        default=None,
                        choices=io.get_all_label_algorithms())
    parser.add_argument("-j",
                        action="store",
                        dest="n_jobs",
                        default=4,
                        type=int,
                        help="The number of threads to use")
    args = parser.parse_args()
    start_time = time.time()

    # Run the algorithm(s)
    process(args.in_path, annot_beats=args.annot_beats, feature=args.feature,
            framesync=args.framesync, boundaries_id=args.boundaries_id,
            labels_id=args.labels_id, n_jobs=args.n_jobs)

    # Done!
    logging.info("Done! Took %.2f seconds." % (time.time() - start_time))
def main ( ) : parser = argparse . ArgumentParser ( description = "Runs the speficied algorithm(s) on the MSAF " "formatted dataset." , formatter_class = argparse . ArgumentDefaultsHelpFormatter ) parser . add_argument ( "in_path" , action = "store" , help = "Input dataset" ) parser . add_argument ( "-f" , action = "store" , dest = "feature" , default = "pcp" , type = str , help = "Type of features" , choices = [ "pcp" , "tonnetz" , "mfcc" , "cqt" , "tempogram" ] ) parser . add_argument ( "-b" , action = "store_true" , dest = "annot_beats" , help = "Use annotated beats" , default = False ) parser . add_argument ( "-fs" , action = "store_true" , dest = "framesync" , help = "Use frame-synchronous features" , default = False ) parser . add_argument ( "-bid" , action = "store" , help = "Boundary algorithm identifier" , dest = "boundaries_id" , default = "gt" , choices = [ "gt" ] + io . get_all_boundary_algorithms ( ) ) parser . add_argument ( "-lid" , action = "store" , help = "Label algorithm identifier" , dest = "labels_id" , default = None , choices = io . get_all_label_algorithms ( ) ) parser . add_argument ( "-j" , action = "store" , dest = "n_jobs" , default = 4 , type = int , help = "The number of threads to use" ) args = parser . parse_args ( ) start_time = time . time ( ) # Run the algorithm(s) process ( args . in_path , annot_beats = args . annot_beats , feature = args . feature , framesync = args . framesync , boundaries_id = args . boundaries_id , labels_id = args . labels_id , n_jobs = args . n_jobs ) # Done! logging . info ( "Done! Took %.2f seconds." % ( time . time ( ) - start_time ) )
Main function to sweep parameters of a certain algorithm.
Main function to sweep parameters of a certain algorithm .