diff --git a/caliGraph.py b/caliGraph.py index 890bc3c..248100d 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -841,7 +841,7 @@ def evaluateFitness(books, debugPrint=False): fit = sum(errSq)/len(errSq) + 0.005*regressionLoss + 0.2*boundsLoss/len(ratedBooks) - 1.0*sum(linSepLoss)/len(linSepLoss) return fit, gradient -def train(initGamma = 1, full=True): +def train(initGamma, full=True): global weights if full: for wt in weights: @@ -854,12 +854,12 @@ def train(initGamma = 1, full=True): best_mse = mse stagLen = 0 - while gamma > 3.0e-06 and delta > 3.0e-05 or best_mse > 3: + while gamma > 3.0e-05 and delta > 3.0e-05 or best_mse > 3: last_mse = mse print({'mse': mse, 'gamma': gamma, 'delta': delta}) delta = sum(gradient[g]**2 for g in gradient) for wt in weights: - weights[wt] += gamma*gradient[wt] + weights[wt] += gamma*gradient[wt]/math.sqrt(delta) mse, gradient = evaluateFitness(books) if mse < last_mse: gamma = gamma*1.25 @@ -932,7 +932,7 @@ def cliInterface(): p_show.add_argument('-d', type=float, default=2.7, help='depth of expansion') p_train = cmds.add_parser('train', description="TODO", aliases=[]) - p_train.add_argument('-g', type=float, default=1, help='learning rate gamma') + p_train.add_argument('-g', type=float, default=0.1, help='learning rate gamma') p_train.add_argument('--full', action="store_true") p_full = cmds.add_parser('full', description="TODO", aliases=[]) diff --git a/neuralWeights.json b/neuralWeights.json index 6d9fd85..b16e6df 100644 --- a/neuralWeights.json +++ b/neuralWeights.json @@ -1 +1 @@ -{"topList": 0.7565347246764587, "recommender": 0.6271368623961752, "author": 1.835086355564805, "series": 0.05208524913006312, "tag": 0.0035089366917880893, "mu": 0.6199999161572797, "sigma": 0.0711803151840928, "se": 0.5310718593481506, "bias": 0.5726915883403473} \ No newline at end of file +{"topList": 0.46904994817058576, "recommender": 0.5105580165380674, "author": 1.2017599208712688, "series": 0.08101540889409455, "tag": 0.01759005368430446, "mu": 0.6921620983533125, "sigma": 0.016831028550919676, "se": 0.3363180764359938, "bias": 0.15960517748561318} \ No newline at end of file