File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def get_loss(d):
65
65
66
66
# train the parameters
67
67
epochs = 25
68
- reg = 0.01 # regularization penalty
68
+ reg = 20. # regularization penalty
69
69
train_losses = []
70
70
test_losses = []
71
71
for epoch in range (epochs ):
@@ -90,7 +90,7 @@ def get_loss(d):
90
90
91
91
# set the updates
92
92
W [i ] = np .linalg .solve (matrix , vector )
93
- b [i ] = bi / (( 1 + reg ) * len (user2movie [i ]))
93
+ b [i ] = bi / (len (user2movie [i ]) + reg )
94
94
95
95
if i % (N // 10 ) == 0 :
96
96
print ("i:" , i , "N:" , N )
@@ -114,7 +114,7 @@ def get_loss(d):
114
114
115
115
# set the updates
116
116
U [j ] = np .linalg .solve (matrix , vector )
117
- c [j ] = cj / (( 1 + reg ) * len (movie2user [j ]))
117
+ c [j ] = cj / (len (movie2user [j ]) + reg )
118
118
119
119
if j % (M // 10 ) == 0 :
120
120
print ("j:" , j , "M:" , M )
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def get_loss(m2u):
91
91
92
92
# train the parameters
93
93
epochs = 25
94
- reg = 0.1 # regularization penalty
94
+ reg = 20. # regularization penalty
95
95
train_losses = []
96
96
test_losses = []
97
97
for epoch in range (epochs ):
@@ -109,7 +109,7 @@ def get_loss(m2u):
109
109
110
110
# set the updates
111
111
W [i ] = np .linalg .solve (matrix , vector )
112
- b [i ] = bi / (( 1 + reg ) * len (user2movie [i ]))
112
+ b [i ] = bi / (len (user2movie [i ]) + reg )
113
113
114
114
if i % (N // 10 ) == 0 :
115
115
print ("i:" , i , "N:" , N )
@@ -127,7 +127,7 @@ def get_loss(m2u):
127
127
128
128
# set the updates
129
129
U [j ] = np .linalg .solve (matrix , vector )
130
- c [j ] = cj / (( 1 + reg ) * len (movie2user [j ]))
130
+ c [j ] = cj / (len (movie2user [j ]) + reg )
131
131
132
132
if j % (M // 10 ) == 0 :
133
133
print ("j:" , j , "M:" , M )
You can’t perform that action at this time.
0 commit comments