Ejemplo n.º 1
0
import scipy.io
import os
import numpy as np
import imp
import sys
import argparse
# import networkx as nx

import bnpy
from bnpy.util.StateSeqUtil import convertStateSeq_MAT2list
from bnpy.ioutil import BNPYArgParser
from bnpy.viz.TaskRanker import rankTasksForSingleJobOnDisk
from bnpy.viz import TaskRanker
from bnpy.viz import PlotUtil
pylab = PlotUtil.pylab
PlotUtil.ConfigPylabDefaults(pylab)


def plotSingleJob(dataName,
                  jobname,
                  taskids='1',
                  lap=None,
                  showELBOInTitle=True,
                  cmap='gray',
                  title='',
                  mixZs=False):
    ''' Visualize results of single run
    '''

    # Parse the jobpath, and create example task paths
    jobpath = os.path.join(os.path.expandvars('$BNPYOUTDIR'), dataName,
Ejemplo n.º 2
0
import numpy as np

from scipy.special import gammaln, digamma
from bnpy.viz import PlotUtil

pylab = PlotUtil.pylab
PlotUtil.ConfigPylabDefaults(
    pylab, **{
        'figure.subplot.left': 0.23,
        'figure.subplot.bottom': 0.23
    })


def make_phi_grid(ngrid=1000, min_phi=-20, max_phi=-1e-10):
    phi_grid = np.linspace(min_phi, max_phi, ngrid)
    return phi_grid


def make_mu_grid(ngrid=1000, min_mu=1e-10, max_mu=20):
    mu_grid = np.linspace(min_mu, max_mu, ngrid)
    return mu_grid


def phi2mu(phi_grid):
    mu_grid = -0.5 * 1.0 / phi_grid
    return mu_grid


def mu2phi(mu_grid):
    phi_grid = -0.5 * 1.0 / mu_grid
    return phi_grid