Exemplo n.º 1
0
int pc_compute_fprobf_1(void) {
	int prmode;

	prmode = bpx_get_integer(bpx_get_call_arg(1,1));

	failure_root_index = -1;

	initialize_weights();

	/* [31 Mar 2008, by yuizumi]
	 * compute_outside_scaling_*() needs to be called because
	 * eg_ptr->outside computed by compute_expectation_scaling_*()
	 * is different from the outside probability.
	 */
	if (log_scale) {
		RET_ON_ERR(compute_feature_scaling_log_exp());
		if (prmode != 1) {
			RET_ON_ERR(compute_expectation_scaling_log_exp());
			RET_ON_ERR(compute_outside_scaling_log_exp());
		}
	} else {
		RET_ON_ERR(compute_feature_scaling_none());
		if (prmode != 1) {
			RET_ON_ERR(compute_expectation_scaling_none());
			RET_ON_ERR(compute_outside_scaling_none());
		}
	}

	return BP_TRUE;
}
Exemplo n.º 2
0
int pc_compute_probf_1(void)
{
    EG_NODE_PTR eg_ptr;
    int prmode;

    prmode = bpx_get_integer(bpx_get_call_arg(1,1));

    if (prmode == 3) {
        compute_max();
        return BP_TRUE;
    }

    eg_ptr = expl_graph[roots[0]->id];
    failure_root_index = -1;

    /* [31 Mar 2008, by yuizumi]
     * compute_outside_scaling_*() is needed to be called because
     * eg_ptr->outside computed by compute_expectation_scaling_*()
     * is different from the outside probability.
     */
	if (log_scale) {
        RET_ON_ERR(compute_inside_scaling_log_exp());
        if (prmode != 1) {
            RET_ON_ERR(compute_expectation_scaling_log_exp());
            RET_ON_ERR(compute_outside_scaling_log_exp());
        }
	}
	else {
        RET_ON_ERR(compute_inside_scaling_none());
        if (prmode != 1) {
            RET_ON_ERR(compute_expectation_scaling_none());
            RET_ON_ERR(compute_outside_scaling_none());
        }
	}

    return BP_TRUE;
}