示例#1
0
文件: sgs.py 项目: EvoNet/hpgl
def __prepare_sgs(prop, mean=None, use_harddata=True, mask=None):
	if use_harddata:
		out_prop = _clone_prop(prop)
	else:
		out_prop = _empty_clone(prop)
	if not mean is None and not numpy.isscalar(mean):
		mean = _require_cont_data(mean)
	if not mask is None:
		mask = _requite_ind_data(mask)
	return out_prop, mean, mask
示例#2
0
文件: sgs.py 项目: watmough/hpgl
def __prepare_sgs(prop, mean=None, use_harddata=True, mask=None):
    if use_harddata:
        out_prop = _clone_prop(prop)
    else:
        out_prop = _empty_clone(prop)
    if not mean is None and not numpy.isscalar(mean):
        mean = _require_cont_data(mean)
    if not mask is None:
        mask = _requite_ind_data(mask)
    return out_prop, mean, mask
示例#3
0
def __prepare_sis(prop, data, marginal_probs, mask, use_harddata):
    is_lvm = not numpy.isscalar(marginal_probs[0])
    if use_harddata:
        out_prop = _clone_prop(prop)
    else:
        out_prop = _empty_clone(prop)

    if is_lvm:
        marginal_probs = [_require_cont_data(m) for m in marginal_probs]
    for i in xrange(len(data)):
        if is_lvm:
            data[i]['marginal_prob'] = 0
        else:
            data[i]['marginal_prob'] = marginal_probs[i]
    if not mask is None:
        mask = _requite_ind_data(mask)

    return out_prop, is_lvm, marginal_probs, mask
示例#4
0
文件: sis.py 项目: EvoNet/hpgl
def __prepare_sis(prop, data, marginal_probs, mask, use_harddata):
	is_lvm = not numpy.isscalar(marginal_probs[0])
	if use_harddata:
		out_prop = _clone_prop(prop)
	else:
		out_prop = _empty_clone(prop)

	if is_lvm:
		marginal_probs = [_require_cont_data(m) for m in marginal_probs]
	for i in xrange(len(data)):
		if is_lvm:
			data[i]['marginal_prob'] = 0
		else:
			data[i]['marginal_prob'] = marginal_probs[i]
	if not mask is None:
		mask = _requite_ind_data(mask)

	return out_prop, is_lvm, marginal_probs, mask