Exemplo n.º 1
0
def _evaluate (indata, prefix):
	util.set_and_train_kernel(indata)

	kmatrix=sg('get_kernel_matrix', 'TRAIN')
	km_train=max(abs(indata['kernel_matrix_train']-kmatrix).flat)

	kmatrix=sg('get_kernel_matrix', 'TEST')
	km_test=max(abs(indata['kernel_matrix_test']-kmatrix).flat)

	return util.check_accuracy(
		indata[prefix+'accuracy'], km_train=km_train, km_test=km_test)
Exemplo n.º 2
0
                               classified=classified)


########################################################################
# public
########################################################################


def test(indata):
    try:
        util.set_features(indata, 'kernel_')
    except NotImplementedError, e:
        print e
        return True

    util.set_and_train_kernel(indata)

    try:
        _set_regression(indata)
    except RuntimeError, e:
        print "%s is disabled/unavailable!" % indata['name']
        return True

    try:
        _train(indata)
    except StandardError, e:
        print e
        return False

    return _evaluate(indata)
Exemplo n.º 3
0
	return util.check_accuracy(indata['regression_accuracy'],
		alphas=alphas, bias=bias, support_vectors=sv, classified=classified)


########################################################################
# public
########################################################################

def test (indata):
	try:
		util.set_features(indata, 'kernel_')
	except NotImplementedError, e:
		print e
		return True

	util.set_and_train_kernel(indata)

	try:
		_set_regression(indata)
	except RuntimeError, e:
		print "%s is disabled/unavailable!" % indata['name']
		return True

	try:
		_train(indata)
	except StandardError, e:
		print e
		return False

	return _evaluate(indata)