Beispiel #1
0
def main():
    parser = optparse.OptionParser()
    parser.add_option("-r", "--runtime", dest="runtime", default=None)
    parser.add_option("-o", "--output", dest="output", default=None)

    (options, args) = parser.parse_args()

    if not options.runtime:
        print >> sys.stderr, "Error: --runtime is required"
        sys.exit(1)

    runtime = options.runtime
    bindings = loadBindings()

    b = bootstrap.Bootstrap(runtime,
                            bindings,
                            moduleId="titanium",
                            moduleName="Titanium")

    jsTemplate = open(os.path.join(thisDir, "bootstrap.js")).read()
    gperfTemplate = open(os.path.join(thisDir, "bootstrap.gperf")).read()

    outDir = genDir
    if options.output != None:
        outDir = options.output

    b.generateJS(jsTemplate, gperfTemplate, outDir)
Beispiel #2
0
def file_list_to_df(climb_files, control_files, sym_files):
    """
    Loads the likelihoods of all runs as a dict of DataFrames,
    and collapses symmetrical inds.
    """
    result_paths = zip(climb_files, control_files, sym_files)

    for i, (climb_file, control_file, sym_file) in enumerate(result_paths):
        try:
            B = bootstrap.Bootstrap(climb_file, control_file, sym_file)
        except tables.NoSuchNodeError:
            continue

        yield i, B.likdata
Beispiel #3
0
data_field1 = data_field1.reset_index()
data_field1.columns=['X','Y']

num_childtraingtest =4000  #子训练集个数
print('训练组数',num_childtraingtest)

# 3 结合6个仿真和4个现场 是10行数据,从10行数据中提取分布
childtest = ChidTraingTest.TraingTest(data_field1, num_childtraingtest)

# 4 bootstrap 采样
loops = 100
percetion_m_childTest = pd.DataFrame()
for i in range(0, num_childtraingtest * 10, 10) :
    data2 = childtest[i:i+10]
    # print( bootstrap.Bootstrap(data2) )
    percetion_m_childTest = percetion_m_childTest.append( bootstrap.Bootstrap(data2 , loops).ix[0] )

percetion_m_childTest = percetion_m_childTest.reset_index(drop= True)
percetion_m_childTest.columns = ['mux', 'muy', 'sigmax', 'sigmay']
# print(percetion_m_childTest)
percetion_m_childTest.to_excel('3.xlsx')

s3 = [np.mean(percetion_m_childTest['mux']), np.mean(percetion_m_childTest['muy']),
      np.mean(percetion_m_childTest['sigmax']), np.mean(percetion_m_childTest['sigmay'])]
print('所有的平均值,直接平均 :')
print(s3 )



# 4 聚类
s4 = k_means.k_means(percetion_m_childTest)
Beispiel #4
0
from oslo_config import cfg
from oslo_log import log
import bootstrap
import os
import service

conf = cfg.CONF
log.register_options(conf)
conf(project='pythontest', prog='pythontest-user', args=[])
#conf(defualt_config_files='/etc/pythontest.conf')
log.setup(conf, 'pythontest')

boot = bootstrap.Bootstrap(conf)
conf.drivers.transport = 'wsgi'
application = boot.transport()
app = application.app
#periodic_task = service.Periodic_Task(conf, boot._storage)

import time, threading
#def run_periodic_task():
	#threading.Thread.daemon = True
	#if conf.periodic_task_interval is None:
		#interval = 60*60*24
	#periodic_task.list_boss_pe_endpointt()
	#periodic_task.format_pe_list_result()
	#periodic_task.pe_contrast_to_local_db()
	#periodic_task.list_boss_ce_endpoint()
	#periodic_task.format_ce_list_result()
	#periodic_task.ce_contrast_to_local_db()
	#interval = conf.periodic_task_interval
	#t = threading.Timer(interval, run_periodic_task)
Beispiel #5
0
num_childtraingtest = 2

for j in range(100, 1000, 25):
    H.append(j)
    loops = j  #bootstrap采样循环次数,修改
    # print('训练组数',num_childtraingtest)
    # D =pd.DataFrame( index= num_childtraingtest)
    # 3 结合6个仿真和4个现场 是10行数据,从10行数据中提取分布
    childtest = ChidTraingTest.TraingTest(data_field1, num_childtraingtest)
    # 4 bootstrap 采样
    percetion_m_childTest = pd.DataFrame()
    for i in range(0, num_childtraingtest * 10, 10):
        data2 = childtest[i:i + 10]
        # print( bootstrap.Bootstrap(data2) )
        percetion_m_childTest = percetion_m_childTest.append(
            bootstrap.Bootstrap(data2, loops).ix[0])
    percetion_m_childTest = percetion_m_childTest.reset_index(drop=True)
    percetion_m_childTest.columns = ['mux', 'muy', 'sigmax', 'sigmay']

    s3 = [
        np.mean(percetion_m_childTest['mux']),
        np.mean(percetion_m_childTest['muy']),
        np.mean(percetion_m_childTest['sigmax']),
        np.mean(percetion_m_childTest['sigmay'])
    ]
    # print(s3)

    # 6误差平方和
    aa = [100, 120, 10, 15]
    d1 = 0
    for i in range(4):
Beispiel #6
0
def main():
    bs = bootstrap.Bootstrap('rhd.csv')
    conf_interval = bs.getBootstrapCIs(0.05, bs.X.iloc[[0]])
    print('confidence interval:', conf_interval)
    print('actual execution time:', bs.y.iloc[[0]])