-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumbskulltypes.py
48 lines (39 loc) · 2.03 KB
/
numbskulltypes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""TODO."""
from __future__ import print_function, absolute_import
import numpy as np
# TODO (shared with DW): space optimization:
# 1. use smaller ints for some fields
# 2. replace a[x].length with a[x+1].offset - a[x].offset
Meta = np.dtype([('weights', np.int64),
('variables', np.int64),
('factors', np.int64),
('edges', np.int64)])
Weight = np.dtype([("isFixed", np.bool),
("parameterize",np.bool), #标志位:权重是否需要参数化,参数化需要的参数个数后期在此处加
("initialValue", np.float64),
("a", np.float64), #tau
("b", np.float64)]) #alpha
Variable = np.dtype([("isEvidence", np.int8),
("initialValue", np.int64),
("dataType", np.int16),
("cardinality", np.int64),
("vtf_offset", np.int64)])
AlphaBound = np.dtype([("lowerBound", np.float64), #用于Alpha参数控制
("upperBound", np.float64)])
TauBound = np.dtype([("lowerBound", np.float64), #用于Alpha参数控制
("upperBound", np.float64)])
SampleList = np.dtype([("vid", np.int64)]) #用于扩充0或1的证据以支持平衡化
Factor = np.dtype([("factorFunction", np.int16),
("weightId", np.int64),
("featureValue", np.float64),
("arity", np.int64),
("ftv_offset", np.int64)]) #此处的偏移量用来在fmap中找第n个因子的起始位置
FactorToVar = np.dtype([("vid", np.int64),
("x", np.float64),
("theta", np.float64), #新加的,以传入对应的theta值
("dense_equal_to", np.int64)])
VarToFactor = np.dtype([("value", np.int64),
("factor_index_offset", np.int64),
("factor_index_length", np.int64)])
UnaryFactorOpt = np.dtype([('vid', np.int64),
('weightId', np.int64)])