double FFNet_Pattern_Categories_getCosts_total (FFNet me, Pattern p, Categories c, int costFunctionType) {
	try {
		_FFNet_Pattern_Categories_checkDimensions (me, p, c);
		autoActivation activation = FFNet_Categories_to_Activation (me, c);
		return FFNet_Pattern_Activation_getCosts_total (me, p, activation.peek(), costFunctionType);
	} catch (MelderError) {
		return NUMundefined;
	}
}
示例#2
0
	Pattern thee = FIRST (Pattern);
	praat_new (FFNet_Pattern_to_Categories (me, thee, GET_INTEGER (L"Determine output category as")), my name, L"_", thy name);
END

/*********** FFNet Pattern Activation **********************************/

FORM (FFNet_Pattern_Activation_getCosts_total, L"FFNet & Pattern & Activation: Get total costs", L"FFNet & Pattern & Activation: Get total costs...")
	RADIO (L"Cost function", 1)
	RADIOBUTTON (L"Minimum-squared-error")
	RADIOBUTTON (L"Minimum-cross-entropy")
	OK
DO
	FFNet me = FIRST (FFNet);
	Pattern thee = FIRST (Pattern);
	Activation him = FIRST (Activation);
	Melder_information (Melder_double (FFNet_Pattern_Activation_getCosts_total (me, thee, him, GET_INTEGER (L"Cost function"))));
END

FORM (FFNet_Pattern_Activation_getCosts_average, L"FFNet & Pattern & Activation: Get average costs", L"FFNet & Pattern & Activation: Get average costs...")
	RADIO (L"Cost function", 1)
	RADIOBUTTON (L"Minimum-squared-error")
	RADIOBUTTON (L"Minimum-cross-entropy")
	OK
DO
	FFNet me = FIRST (FFNet);
	Pattern thee = FIRST (Pattern);
	Activation him = FIRST (Activation);
	Melder_information (Melder_double (FFNet_Pattern_Activation_getCosts_average (me, thee, him, GET_INTEGER (L"Cost function"))));
END

FORM (FFNet_Pattern_Activation_learnSD, L"FFNet & Pattern & Activation: Learn slow", 0)
double FFNet_Pattern_Activation_getCosts_average (FFNet me, Pattern p, Activation a, int costFunctionType) {
	double costs = FFNet_Pattern_Activation_getCosts_total (me, p, a, costFunctionType);
	return costs == NUMundefined ? NUMundefined : costs / p -> ny;
}