Stronger regression-loss; more parameter-freedome

This commit is contained in:
Dominik Moritz Roth 2021-09-24 19:16:29 +02:00
parent 22ca039502
commit 212a30298a

View File

@ -705,7 +705,7 @@ def evaluateFitness(books):
errSq[-1] *= 1.5
G.nodes[m]['rating'] = rating
regressionLoss = sum([(1-w)**2 for w in weights.values()])
return sum(errSq)/len(errSq) + regressionLoss/1000
return sum(errSq)/len(errSq) + regressionLoss/100
def train(gamma = 0.1):
global weights
@ -726,7 +726,7 @@ def train(gamma = 0.1):
else:
weights[attr] += delta
if attr not in ['sigma', 'mu', 'se']:
weights[attr] = min(max(0.0, weights[attr]), 3.0)
weights[attr] = min(max(0.0, weights[attr]), 5.0)
mse = evaluateFitness(books)
if mse < best_mse: # got better
saveWeights(weights)