Module Expr Str Import alias Import alias Import alias Import alias identifier Import alias Import alias Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore ListLoad Str Str Assign NameStore ListLoad Str Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad kwarg body Expr Str Assign NameStore CompareIsNot NameLoad NameLoad AugAssignBitAnd NameStore CompareIsNot NameLoad NameLoad AugAssignBitAnd NameStore CompareIsNot NameLoad NameLoad AugAssignBitAnd NameStore CompareIsNot NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Num keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Num keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Num keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore Call NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad Str keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad If CompareIn NameLoad NameLoad body Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str NameLoad orelse Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str NameLoad If CompareIs Call NameLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad orelse Assign NameStore NameLoad Assign NameStore NameLoad If CompareIn NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad SubscriptLoad NameLoad Index Str Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad If CompareEq NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str keyword ListLoad Assign NameStore SubscriptLoad NameLoad Index Str If CompareIn NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad NameLoad orelse If CompareIn NameLoad NameLoad body Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index Str Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Str If CompareIn Str NameLoad body Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str If BoolOpOr CompareEq NameLoad Str CompareEq NameLoad Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse Raise Call NameLoad BinOpAdd Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias Import alias Assign NameStore Call NameLoad For NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore SubscriptLoad Call AttributeLoad SubscriptLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Index Num attr Str Index Num With Call NameLoad NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return TupleLoad NameLoad Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str Import alias If CompareGt Call AttributeLoad NameLoad attr Str Num body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num If CompareGt Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Slice Num Assign NameStore BinOpMod Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr BinOpAdd NameLoad Call NameLoad NameLoad attr Num Num Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Assign NameStore SubscriptLoad NameLoad Index Str If CompareIsNot Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Return Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Assign AttributeStore NameLoad attr ListLoad Assign NameStore Call AttributeLoad NameLoad attr Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
 User-facing executable script for contining saved runs from Run.py
    
  Quickstart (Command Line)
  -------
  To continue a run associated with data, model, algorithm, and job name
  for 10 more laps, do

  $ python -m bnpy.ContinueRun <Data> <AllocModel> <ObsModel> <AlgName> <job> --nLap 10
  
  Usage
  -------
  TODO: write better doc
 N/A os N/A sys N/A logging N/A numpy np N/A bnpy N/A argparse N/A BNPYArgParser N/A N/A bnpy ioutil BNPYArgParser N/A Log N/A N/A logging getLogger bnpy N/A N/A N/A Log setLevel N/A logging DEBUG N/A FullDataAlgSet N/A EM VB N/A OnlineDataAlgSet N/A soVB moVB continueRun N/A N/A dataName allocModelName obsModelName algName doSaveToDisk doWriteStdOut N/A None None None None True True kwargs N/A N/A  Fit specified model to data with learning algorithm.
    
      Usage
      -------
      TODO

      Args
      -------
      dataName : either one of
                  * bnpy Data object,
                  * string filesystem path of a Data module within BNPYDATADIR
      allocModelName : string name of allocation (latent structure) model
                        {MixModel, DPMixModel, AdmixModel, HMM, etc.}
      obsModelName : string name of observation (likelihood) model
                        {Gauss, ZMGauss, WordCount, etc.}
      algName : string name of algorithm
                        {EM, VB, moVB, soVB}
      Returns
      -------
      hmodel : best model fit to the dataset (across nTask runs)
      LP : local parameters of that best model on the dataset
   N/A hasReqArgs N/A dataName None N/A hasReqArgs N/A allocModelName None N/A hasReqArgs N/A obsModelName None N/A hasReqArgs N/A algName None N/A hasReqArgs N/A N/A ReqArgs N/A dict dataName dataName allocModelName allocModelName obsModelName obsModelName algName algName N/A N/A ReqArgs N/A N/A BNPYArgParser parseRequiredArgs N/A dataName N/A ReqArgs N/A dataName N/A allocModelName N/A ReqArgs N/A allocModelName N/A obsModelName N/A ReqArgs N/A obsModelName N/A algName N/A ReqArgs N/A algName N/A parser N/A N/A argparse ArgumentParser N/A N/A N/A parser add_argument --jobname default defaultjob N/A N/A N/A parser add_argument --taskid default 1 type int N/A N/A N/A parser add_argument --startLap default 1.0 type float N/A N/A N/A parser add_argument --nLap default 10 type int N/A N/A argDict ignored N/A N/A BNPYArgParser applyParserToKwArgDict parser kwargs N/A N/A hmodel LP Info N/A _continue_task_internal N/A argDict N/A jobname N/A argDict N/A taskid N/A argDict N/A startLap N/A argDict N/A nLap dataName allocModelName obsModelName algName ReqArgs doSaveToDisk doWriteStdOut N/A N/A hmodel LP Info N/A _continue_task_internal N/A N/A jobname taskid startLap nLap dataName allocModelName obsModelName algName ReqArgs doSaveToDisk doWriteStdOut N/A N/A N/A  Internal method (should never be called by end-user!)
      Executes learning for a particular job and particular taskid.
      
      Returns
      -------
        hmodel : bnpy HModel, fit to the data
        LP : Local parameter (LP) dict for the specific dataset
        RunInfo : dict of information about the run, with fields
                'evBound' log evidence for hmodel on the specified dataset
                'evTrace' vector of evBound at every traceEvery laps
   N/A algseed N/A createUniqueRandomSeed jobname taskID taskid N/A dataorderseed N/A createUniqueRandomSeed taskID taskid N/A taskoutpath N/A getOutputPath ReqArgs jobname taskID taskid N/A N/A configLoggingToConsoleAndFile taskoutpath doSaveToDisk doWriteStdOut N/A ModelReader N/A N/A bnpy ioutil ModelReader N/A N/A hmodel startLap N/A N/A ModelReader loadModelForLap taskoutpath startLap N/A N/A KwArgs UnkArgs N/A readArgsFromFile taskoutpath N/A N/A algName FullDataAlgSet N/A N/A N/A N/A KwArgs N/A algName N/A nLap nLap N/A N/A N/A N/A KwArgs N/A OnlineDataPrefs N/A nLap nLap N/A N/A N/A KwArgs N/A OnlineDataPrefs N/A startLap startLap N/A N/A N/A type dataName str N/A N/A N/A Data InitData N/A loadData ReqArgs KwArgs UnkArgs dataorderseed N/A N/A Data dataName N/A InitData dataName N/A N/A algName OnlineDataAlgSet N/A N/A Data N/A N/A Data to_minibatch_iterator dataorderseed dataorderseed N/A KwArgs N/A OnlineDataPrefs N/A N/A N/A KwArgs N/A algName N/A startLap startLap N/A learnAlg N/A createLearnAlg Data hmodel ReqArgs KwArgs algseed algseed savepath taskoutpath N/A N/A taskid 1 N/A N/A N/A N/A Log info N/A N/A Data get_text_summary N/A N/A N/A Log info N/A N/A Data summarize_num_observations N/A N/A N/A Log info N/A N/A hmodel get_model_info N/A N/A N/A Log info N/A Learn Alg: %s. startLap %d N/A algName startLap N/A N/A N/A Log info N/A Trial %2d | alg. seed: %d | data order seed: %d N/A taskid algseed dataorderseed N/A N/A N/A Log info N/A savepath: %s taskoutpath N/A N/A LP RunInfo N/A N/A learnAlg fit hmodel Data N/A N/A hmodel LP RunInfo N/A loadData N/A N/A ReqArgs KwArgs DataArgs dataorderseed N/A N/A N/A  Load DataObj specified by the user, using particular random seed.
      Returns
      --------
      either 
        Data, InitData  
      or
        DataIterator, InitData

      InitData must be a bnpy.data.DataObj object.
      This DataObj is used for two early-stage steps in the training process
        (a) Constructing observation model so that it has appropriate dimensions
            For example, with 3D real data,
            can only model the observations with a Gaussian over 3D vectors. 
        (b) Initializing global model parameters
            Esp. in online settings, avoiding local optima might require using parameters
            that are initialized from a much bigger dataset than each individual batch.
      For most full dataset learning scenarios, InitData can be the same as Data.
   N/A N/A N/A N/A sys path append N/A N/A os environ N/A BNPYDATADIR N/A datamod N/A __import__ N/A ReqArgs N/A dataName fromlist N/A N/A algName N/A ReqArgs N/A algName N/A N/A algName FullDataAlgSet N/A N/A Data N/A N/A datamod get_data DataArgs N/A N/A Data Data N/A N/A N/A algName OnlineDataAlgSet N/A N/A N/A N/A KwArgs N/A algName N/A nLap N/A N/A KwArgs N/A OnlineDataPrefs N/A nLap N/A InitData N/A N/A datamod get_data DataArgs N/A OnlineDataArgs N/A KwArgs N/A OnlineDataPrefs N/A N/A OnlineDataArgs N/A dataorderseed dataorderseed N/A N/A N/A OnlineDataArgs update DataArgs N/A DataIterator N/A N/A datamod get_minibatch_iterator OnlineDataArgs N/A N/A DataIterator InitData N/A createModel N/A N/A Data ReqArgs KwArgs N/A N/A N/A  Creates a bnpy HModel object for the given Data
      This object is responsible for:
       * storing global parameters
       * providing methods to perform model-specific subroutines for learning,
          such as calc_local_params (E-step) or get_global_suff_stats
      Returns
      -------
      hmodel : bnpy.HModel object, whose allocModel is of type ReqArgs['allocModelName']
                                    and obsModel is of type ReqArgs['obsModelName']
               This model has fully defined prior distribution parameters,
                 but *will not* have initialized global parameters.
               It must be initialized via hmodel.init_global_params(...) before use.
   N/A algName N/A ReqArgs N/A algName N/A aName N/A ReqArgs N/A allocModelName N/A oName N/A ReqArgs N/A obsModelName N/A aPriorDict N/A KwArgs N/A aName N/A oPriorDict N/A KwArgs N/A oName N/A hmodel N/A N/A N/A bnpy HModel CreateEntireModel algName aName oName aPriorDict oPriorDict Data N/A hmodel N/A createLearnAlg N/A N/A Data model ReqArgs KwArgs algseed savepath N/A 0 None N/A N/A  Creates a bnpy LearnAlg object for the given Data and model
      This object is responsible for:
        * preparing a directory to save the data (savepath)
        * setting appropriate random seeds specific to the *learning algorithm*
          
    Returns
    -------
    learnAlg : LearnAlg [or subclass] object
               type defined by ArgDict['algName'], one of {EM, VB, soVB, moVB}
   N/A algName N/A ReqArgs N/A algName N/A algP N/A KwArgs N/A algName N/A N/A birth KwArgs N/A N/A N/A algP N/A birth N/A KwArgs N/A birth N/A N/A merge KwArgs N/A N/A N/A algP N/A merge N/A KwArgs N/A merge N/A outputP N/A KwArgs N/A OutputPrefs N/A N/A N/A algName EM N/A algName VB N/A N/A learnAlg N/A N/A N/A bnpy learnalg VBLearnAlg savedir savepath seed algseed algParams algP outputParams outputP N/A N/A N/A algName soVB N/A N/A learnAlg N/A N/A N/A bnpy learnalg StochasticOnlineVBLearnAlg savedir savepath seed algseed algParams algP outputParams outputP N/A N/A N/A algName moVB N/A N/A learnAlg N/A N/A N/A bnpy learnalg MemoizedOnlineVBLearnAlg savedir savepath seed algseed algParams algP outputParams outputP N/A N/A N/A NotImplementedError N/A Unknown learning algorithm  algName N/A learnAlg N/A readArgsFromFile N/A N/A taskoutpath N/A N/A N/A  Read args as key/val pairs from plain-text file
      so that we can figure out what settings were used for a saved run
   N/A json N/A glob N/A KwArgs N/A dict N/A argfilepath N/A N/A glob glob N/A N/A N/A os path join taskoutpath args-*.txt N/A N/A pathparts N/A N/A argfilepath split N/A N/A os path sep N/A curKey N/A N/A N/A N/A N/A N/A N/A pathparts N/A -1 split - N/A 1 split .txt N/A 0 N/A N/A open argfilepath r f N/A N/A curDict N/A N/A json load f N/A N/A KwArgs N/A curKey curDict N/A N/A KwArgs N/A dict N/A createUniqueRandomSeed N/A N/A jobname taskID N/A 0 N/A N/A  Get unique seed for a random number generator,
       deterministically using the jobname and taskID.
      This seed is reproducible on any machine, regardless of OS or 32/64 arch.
      Returns
      -------
      seed : integer seed for a random number generator,
                such as numpy's RandomState object.
   N/A hashlib N/A N/A N/A N/A jobname count - 0 N/A N/A jobname N/A N/A N/A jobname split - N/A 0 N/A N/A N/A len jobname 5 N/A N/A jobname N/A jobname N/A 5 N/A seed N/A N/A int N/A N/A N/A N/A hashlib md5 N/A jobname N/A str taskID hexdigest 16 10000000.0 N/A N/A int seed N/A getOutputPath N/A N/A ReqArgs jobname taskID N/A 0 N/A N/A  Get a valid file system path for writing output from learning alg execution.
      Returns
      --------
      outpath : absolute path to a directory on this file system.
                Note: this directory may not exist yet.
   N/A dataName N/A ReqArgs N/A dataName N/A N/A N/A type dataName str N/A N/A dataName N/A N/A dataName get_short_name N/A N/A N/A N/A os path join N/A N/A os environ N/A BNPYOUTDIR dataName N/A ReqArgs N/A allocModelName N/A ReqArgs N/A obsModelName N/A ReqArgs N/A algName jobname N/A str taskID N/A configLoggingToConsoleAndFile N/A N/A taskoutpath doSaveToDisk doWriteStdOut N/A True True N/A N/A N/A Log handlers N/A N/A formatter N/A N/A logging Formatter %(message)s N/A doSaveToDisk N/A N/A fh N/A N/A logging FileHandler N/A N/A N/A os path join taskoutpath transcript.txt N/A N/A N/A fh setLevel N/A logging DEBUG N/A N/A N/A fh setFormatter formatter N/A N/A N/A Log addHandler fh N/A doWriteStdOut N/A N/A ch N/A N/A logging StreamHandler N/A sys stdout N/A N/A N/A ch setLevel N/A logging DEBUG N/A N/A N/A ch setFormatter formatter N/A N/A N/A Log addHandler ch N/A N/A N/A doSaveToDisk N/A doWriteStdOut N/A N/A N/A N/A Log addHandler N/A N/A logging NullHandler N/A N/A N/A __name__ __main__ N/A N/A N/A continueRun