Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#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