Beispiel #1
0
    log.info("Extracting features...")
    features.extrair(benchmark, prog)
    log.info("Processing...")
    ini = time.time()
    programs = _oneOut(benchmark, prog)
    _process(programs)
    fim = time.time()
    log.debug("\t Process Time: " + str(fim - ini))


def _process(programs):
    ml = ML(programs)
    f = open("features.csv", "r")
    out = open("featuresml.txt", "w")
    next(f)
    for linha in f:
        data = linha.strip("\n")
        id = linha.split(",")[0]
        res = ml.prediction(data.split(","))
        out.write(str(id) + "," + str(res) + "\n")
    out.close()
    f.close()


def _oneOut(benchmark, prog):
    return [p for p in benchmark.programs() if p not in prog]


if __name__ == '__main__':
    b = benchmarks.create(3)
    execute(b, 'JGFSeriesBenchSizeB')
Beispiel #2
0
        return comando


def execute(bench, prog):
    print "Executando: " + prog
    config.remover()
    comando = bench.command(prog)
    print comando
    ini = time.time()
    subprocess.call(comando)
    fim = time.time()
    print "    Tempo: " + str(fim - ini)
    copyfile(config.DADOS + "/counter.txt",
             config.DADOS + "/counter_" + prog + ".txt")


def processarArgumentos():
    parser = argparse.ArgumentParser(description='Script para o Contador',
                                     formatter_class=RawTextHelpFormatter)
    parser.add_argument("-b", default=0, type=int, help=benchmarks.help())
    parser.add_argument("-p", required="True", help="Nome do programa")
    return parser.parse_args()


if __name__ == '__main__':
    args = processarArgumentos()
    print "*** Counter ***"
    config.criarDiretorios()
    bench = benchmarks.create(args.b)
    execute(Contador(bench), args.p)
Beispiel #3
0
    n = len(df)
    df.loc[n] = df.loc[i]
    return n


def alterarLinha(df, i, plano):
    x = 1
    for s in plano:
        st = "O" + str(x)
        x = x + 1
        df.set_value(i, st, s)
    for j in xrange(config.ML_LEN - (x - 1)):
        st = "O" + str(j + x)
        df.set_value(i, st, "0")


def processar(tempos, prog, level):
    print "Processando Caracteristicas..."
    df = pd.read_csv("features.csv")
    #tam = len(binary_repr(lab.tamanho()-1))
    adicionarColunas(df)
    adicionarLinhas(df, tempos)
    df.to_csv(config.TREINOS + "/treino_" + level + "_" + prog + ".csv",
              index=False)


if __name__ == '__main__':
    print("Extraindo caracteristicas...")
    #executar(BenchExpOne(None))
    extrair(benchmarks.create(1), 'fop')