コード例 #1
0
 def __init__(self):
     self.c = config.Configuration()
     keyFile = open('api_credentials.txt', 'r')
     self.key = keyFile.readline().rstrip()
     self.secret = keyFile.readline().rstrip()
     self.base_url = 'https://api.binance.com'
     self.trade_engine = Engine()
     self.performance = per.Performance()
コード例 #2
0
ファイル: q81solution.py プロジェクト: MohamedKharaev/UCI
# Put imports here
import nearestneighbor
import performance
import random
# Put code for performance analysis here


def setup(size):
    global rand_lst
    rand_lst = []
    for i in range(size):
        rand_lst.append((random.random(), random.random()), )


def code():
    global rand_lst
    nearestneighbor.closest_2d(rand_lst)


for i in range(0, 9):
    size = 100 * (2**i)
    p = performance.Performance(lambda: code(), lambda: setup(size), 5,
                                '\n\nNearest Neighbor, size = ' + str(size))
    p.evaluate()
    p.analyze()
コード例 #3
0
import performance
import ml_predict
import argparse

# code for testing the performance
performance_test = performance.Performance()
performance_test.run()

parser = argparse.ArgumentParser(description="Predict a robot movements in next 2 seconds")
parser.add_argument("--training", help = "file pattern to training data", default = "./inputs/training_data.txt")
parser.add_argument("--input", help = "file pattern to input data", default = "./inputs/test01.txt")
parser.add_argument("--output", help = "file pattern to output data", default = "./output.txt")


# KNN ML predictor performs much better. Therefore, we use it for our final
# output.
args = parser.parse_args()
predictor = ml_predict.MLPredictor(12, args.training)
predictions = predictor.make_prediction(args.input)[0]
print predictions

# output the predictions
with open(args.output, 'w') as f:
    for point in predictions:
        f.write(str(point[0])+','+str(point[1])+'\n')





コード例 #4
0
]  #编译关联文件
TestFile = ["timer/timer.c"]
#待测试测试文件
#/************************************************************/

import sys
sys.path.append(UnitPath + "python")
import common
import performance
import coverage
import index

#处理命令行
common.HandleCmdArg()
#执行代码
try:
    try:
        File = common.GenerateCmd(FilePath, UnitPath, GccFile)  #组装编译命令
        GccCmd = common.Gcc + " " + common.Args + " " + File + " -o test " + common.Libs
        common.Compile(GccCmd)  # 编译文件
        common.CreateDir()  #生存文件夹
        common.ExecuteTest()  #执行程序
        HtmlCover = coverage.Coverage(FilePath, UnitPath, common.ResultDir,
                                      common.Gcov, TestFile)  #生成覆盖率文件
        performance.Performance(UnitPath, common.ResultDir,
                                common.Gprof)  #生成性能文件
        index.Index(UnitPath, common.ResultDir, HtmlCover)  #生成index文件
    except UserWarning:
        print "编译出错(complie was fault!)"
finally:
    common.CleanUp(UnitPath)  #清理现场