当前位置: 首页>>代码示例>>Python>>正文


Python Solver.verbose方法代码示例

本文整理汇总了Python中pysb.integrate.Solver.verbose方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.verbose方法的具体用法?Python Solver.verbose怎么用?Python Solver.verbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pysb.integrate.Solver的用法示例。


在下文中一共展示了Solver.verbose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: simulation

# 需要导入模块: from pysb.integrate import Solver [as 别名]
# 或者: from pysb.integrate.Solver import verbose [as 别名]
    print p,result.x[i] # For visualization
    k_result.append(result.x[i])
    
# Store IC results in an empty list that is appended with an empty list for each iteration of ICs. The inner empty list is filled with the 
# IC values from the previous simulation (or initial for first - index + IC list (1 list) * 3 (items in list) + 7 (after all rate parameters).
# The previous result is then overwritten with the new parameters (using same equation above) - values are printed to screen
ic_result = []
for n in range(len(ICs())):
    ic_result.append([])
    print ICs()[n]," = [",
    for i,p in enumerate(model.parameters[:3]):
        print str(result.x[i+n*3+7]) + ",",
        ic_result[-1].append(result.x[i+n*3+7])
    print "]"

### Plotting parameter optimized model output ###
# Append a numpy array of 0s with rate parameters (last 7) and ICs (first 3). The rate parameters are the same for all the model outputs, 
# while the ICs change. In each iteration, the parameter values are saved, normalized, and plotted.
param_values = np.zeros(len(model.parameters))
param_values[3:] = k_result
for i, ic in enumerate(ICs()):
    param_values[:3] = ic_result[i] # N lists that contain 3 numbers
    solver.verbose = False
    solver.run(param_values=param_values) # saved in array - species y, obs in yobs, ic is 3 element list
    nl2_sim = np.log2(solver.yobs["Obs_All"]/solver.yobs["Obs_All"][0]) # making it nl2
    plt.figure(i)
    plt.plot(time, nl2_sim, 'go-', ms = 12, mfc = "None", mew = 2, mec = "g")
    plt.xlabel('Time')
    plt.ylabel('Population Doublings (nl2)')
    plt.title('Parameter Estimation')
plt.show()
开发者ID:coreyhayford,项目名称:ThreeStateMelanoma,代码行数:33,代码来源:temp.py


注:本文中的pysb.integrate.Solver.verbose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。