How to use the aif360.algorithms.inprocessing.celisMeta.utils.getAccuracy function in aif360

To help you get started, we’ve selected a few aif360 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / AIF360 / aif360 / algorithms / inprocessing / celisMeta / General.py View on Github external
#print("-----",a,b)
			samples = ut.getRandomSamples(dist_params_train)

			#try :
			params = self.gradientDescent(dist_params, a, b, samples, z_0, z_1)
			#print(params)
			y_res = []

			for x in x_train:
				t = self.getValueForX(dist_params, a,b, params, samples,  z_0, z_1, x, 0)
				if t > 0 :
					y_res.append(1)
				else:
					y_res.append(-1)

			acc = ut.getAccuracy(y_train, y_res)
			gamma = self.getGamma(y_train, y_res, x_control_train)
			#print(acc, gamma)

			if maxAcc < acc and gamma >= tau - 0.2:
				maxGamma = gamma
				maxAcc = acc
				p = a
				q = b
				paramsOpt = params

		print("Training Accuracy: ", maxAcc, ", Training gamma: ", maxGamma)
		def model(x):
			return self.getValueForX(dist_params, p, q, paramsOpt, samples,  z_0, z_1, x, 0)

		return model