예제 #1
0
def main():
    parser = OptionParser(usage="usage: %prog [options] feature_file output_file meta_file")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file",)

    (options, args) = parser.parse_args()

    if len(args) != 3:
        parser.error("wrong number of arguments")

    config = GyroConfig.load(options.config)

    features = gyrodata.readCsvData(args[0])
    output = gyrodata.readCsvData(args[1])
    # global variable for simplicity
    global metadataPath
    metadataPath = args[2]
    model = getModel(config)

    # normalize features/output (may be false assumption)
    features = [[float(x) for x in l] for l in features]

    print ""
    accuracy = runData(config, features, output)
    # Output accuracy correctly
    if model.isDiscrete:
        print "Accuracy: " + "%.2f" % (accuracy * 100) + "%"
    else:
        print "Average Absolute Error: " + "%.2f" % accuracy
예제 #2
0
def main():
    parser = OptionParser(usage="usage: %prog [options] data")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file for features",)

    parser.add_option("-o", "--output",
            action="store",
            dest="output",
            default="filtered.csv",
            help="Output file of features",)

    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.error("wrong number of arguments")

    config = GyroConfig.load(options.config)

    data = gyrodata.readMetadata(args[0])
    features = [extractFeatures(entry, config) for entry in data]
    gyrodata.writeCsvData(features, options.output)
예제 #3
0
def main():
    parser = OptionParser(usage="usage: %prog [options] feature_file output_file meta_file")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file",)

    (options, args) = parser.parse_args()

    if len(args) != 3:
        parser.error("wrong number of arguments")

    config = GyroConfig.load(options.config)

    features = gyrodata.readCsvData(args[0])
    output = gyrodata.readCsvData(args[1])

    # normalize features/output (may be false assumption)
    features = [[float(x) for x in l] for l in features]

    print ""
    runData(config, features, output)