Module Expr Str ImportFrom alias ImportFrom alias Import alias identifier Import alias ImportFrom alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad kwarg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr BinOpDiv BinOpMult NameLoad BinOpSub NameLoad Num Num Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr BinOpSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Str If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr CompareEq SubscriptLoad NameLoad ExtSlice Slice Index Num Num Assign NameStore Call AttributeLoad NameLoad attr CompareEq SubscriptLoad NameLoad ExtSlice Slice Index Num Num Assign SubscriptStore NameLoad Index TupleLoad NameLoad Num Num Assign SubscriptStore NameLoad Index TupleLoad NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword Num Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Return AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr TupleLoad SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice Index Num TupleLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice Index Num Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice Index Num keyword TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad Num Assign NameStore Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad BinOpAdd NameLoad Num NameLoad body Assign SubscriptStore NameLoad ExtSlice Index NameLoad Slice ListLoad NameLoad NameLoad SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad NameLoad NameLoad AugAssignAdd NameStore Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr CompareGtE SubscriptLoad NameLoad ExtSlice Slice Index Num Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad ExtSlice Index AttributeLoad NameLoad attr Slice Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr CompareEq SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice Index Num Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr CompareEq SubscriptLoad AttributeLoad NameLoad attr ExtSlice Slice Index Num Num Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Print BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad NameLoad Print BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Str Call NameLoad Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad Call NameLoad AttributeLoad NameLoad attr Str Return TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Import alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Return Call NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Pass decorator_list NameLoad decorator_list
N/A N/A 
GraphData.py

Data object that represents word counts across a collection of documents.

Terminology
-------
* Vocab : The finite collection of possible words.  
    {apple, berry, cardamom, fruit, pear, walnut}
  We assume this set has a fixed ordering, so each word is associated 
  with a particular integer in the set 0, 1, ... vocab_size-1
     0: apple        3: fruit
     1: berry        4: pear
     2: cardamom     5: walnut
* Document : a collection of words, observed together from the same source
  For example: 
      "apple, berry, berry, pear, pear, pear, walnut"

* nDoc : number of documents in the current, in-memory dataset
* nDocTotal : total number of docs, in entire dataset (for online applications)
 AdmixMinibatchIterator AdmixMinibatchIterator DataObj DataObj N/A numpy np N/A scipy.sparse util RandUtil GraphData N/A DataObj N/A __init__ N/A N/A self edge_val edge_exclude nNodeTotal TrueParams N/A None None None None kwargs N/A N/A  Constructor for WordsData object

        Args
        -------
        edge_id : the source and receiver node ids that have present edges
        edge_weight : this might be a vector of all ones if binary graph, if it contains heldout, those are set to -1
        nNodeTotal : total number of nodes
        TrueParams : None [default], or dict of attributes
        edge_exclude: nDistinctEdges x 3 (row id, column id, value) of edges that shouldn't be used during inference
     N/A edge_val N/A N/A np asarray N/A N/A np squeeze edge_val dtype N/A np int16 N/A N/A self nNodeTotal N/A int nNodeTotal N/A N/A self nEdgeTotal N/A N/A nNodeTotal N/A nNodeTotal 1 2 N/A N/A self nPosEdges N/A len edge_val N/A N/A self nAbsEdges N/A N/A self nEdgeTotal N/A self nPosEdges N/A N/A self graphType undirected N/A N/A edge_exclude None N/A N/A N/A self nExcludeEdges N/A len edge_exclude N/A ind0 N/A N/A np nonzero N/A N/A edge_exclude N/A N/A N/A 2 0 N/A ind1 N/A N/A np nonzero N/A N/A edge_exclude N/A N/A N/A 2 1 N/A N/A edge_exclude N/A N/A ind0 2 -1 N/A N/A edge_exclude N/A N/A ind1 2 -2 N/A edge_val_test N/A N/A np concatenate N/A edge_val edge_exclude axis 0 N/A N/A self edge_val edge_val_test N/A N/A N/A self edge_val edge_val N/A N/A TrueParams None N/A N/A N/A self TrueParams TrueParams N/A N/A self sparseY N/A N/A self to_sparse_matrix N/A to_sparse_matrix N/A N/A self N/A N/A N/A  Make sparse matrix counting vocab usage across all words in dataset

        Returns
        --------
        C : sparse (CSC-format) matrix, of shape nObs-x-vocab_size, where
             C[n,v] = word_count[n] iff word_id[n] = v
                      0 otherwise
             That is, each word token n is represented by one entire row
                      with only one non-zero entry: at column word_id[n]

     N/A N/A hasattr self __sparseMat__ N/A N/A N/A self __sparseMat__ N/A N/A self __sparseMat__ N/A N/A N/A scipy sparse csc_matrix N/A N/A N/A self edge_val N/A N/A N/A 2 N/A N/A N/A np int64 N/A N/A self edge_val N/A N/A N/A 0 N/A N/A np int64 N/A N/A self edge_val N/A N/A N/A 1 shape N/A N/A self nNodeTotal N/A self nNodeTotal N/A N/A self __sparseMat__ N/A get_edges_all N/A N/A self N/A N/A N/A  Typically expensive, but for small graphs we can get an edge list for all pairwise edges
    This is an E (total number of edges) x 3 matrix
    Column 1 = row id
    Column 2 = col id
    Column 3 = edge_value (i.e 0,1 or (-1,-2) for heldout edges respectively
     N/A E N/A self nEdgeTotal N/A N N/A self nNodeTotal N/A edges N/A N/A np zeros N/A E 3 N/A e 0 N/A ii N/A xrange N N/A N/A jj N/A xrange N/A ii 1 N N/A N/A N/A edges N/A N/A e N/A N/A ii jj N/A N/A self sparseY N/A N/A ii jj N/A e 1 N/A N/A N/A np asarray N/A N/A np squeeze edges dtype N/A np int8 N/A N/A self indTrain N/A N/A np asarray N/A N/A np squeeze N/A N/A np nonzero N/A N/A edges N/A N/A N/A 2 0 N/A N/A self edges N/A edges N/A N/A N/A self indTrain N/A N/A N/A self ind0 N/A N/A np asarray N/A N/A np squeeze N/A N/A np nonzero N/A N/A N/A self edges N/A N/A N/A 2 0 N/A N/A self ind1 N/A N/A np asarray N/A N/A np squeeze N/A N/A np nonzero N/A N/A N/A self edges N/A N/A N/A 2 1 N/A N/A self nEdgeTotal N/A len N/A self edges N/A N/A self nObs N/A self nEdgeTotal N/A N/A N/A N/A Total number of training edges:  N/A str N/A self nEdgeTotal / N/A str E N/A N/A N/A N/A N/A N/A Total number of zero/ones within training:  ( N/A str N/A len N/A self ind0 / N/A str N/A len N/A self ind1 ) N/A N/A N/A self edges N/A self ind0 N/A self ind1 N/A self indTrain N/A read_from_mat N/A N/A cls matfilepath N/A kwargs N/A N/A  Creates an instance of WordsData from Matlab matfile
     N/A scipy.io N/A InDict N/A N/A N/A scipy io loadmat matfilepath kwargs N/A N/A cls InDict N/A classmethod read_from_db N/A N/A cls dbpath sqlquery vocab_size nDocTotal N/A None None N/A N/A N/A classmethod N/A