【问题标题】:Plotting trace while sampling in pymc在 pymc 中采样时绘制跟踪
【发布时间】:2014-12-11 14:31:21
【问题描述】:

有没有什么方法可以自动绘制轨迹迭代次数?我正在使用一个相对昂贵的模型,不时检查一下链条的状态会很好。

【问题讨论】:

    标签: python pymc


    【解决方案1】:

    在 PyMC 2.3 中,您可以在控制台会话中使用 isample(在 IPython Notebooks 中不起作用)。这允许您暂停或将作业发送到后台。它看起来像这样:

    In [7]: M.isample(20000)
    ==============
     PyMC console
    ==============
    
            PyMC is now sampling. Use the following commands to query or pause the sampler.
    
    
            Commands:
              i -- index: print current iteration index
              p -- pause: interrupt sampling and return to the main console.
                          Sampling can be resumed later with icontinue().
              h -- halt:  stop sampling and truncate trace. Sampling cannot be
                          resumed for this chain.
              b -- bg:    return to the main console. The sampling will still
                          run in a background thread. There is a possibility of
                          malfunction if you interfere with the Sampler's
                          state or the database during sampling. Use this at your
                          own risk.
    
    pymc > p
    

    从长远来看,这可能是一种方便的检查方式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-03
      • 1970-01-01
      • 2018-04-23
      相关资源
      最近更新 更多