Question: PLEASE WRITE THE GRADIENT FUNCTION AND THE GRADIENT DESCENT FUNCTION. Do not use loops for the gradient function; use vectorized gradient descent. I have included

PLEASE WRITE THE GRADIENT FUNCTION AND THE GRADIENT DESCENT FUNCTION. Do not use loops for the gradient function; use vectorized gradient descent. I have included the date (tiny_training.csv), the other functions, the pytest, and the equations from the notes! Everything you need is here. # you can use a for loop to iterate through gradient descent def gradient_descent(df, emb_user, emb_movie, iterations=100, learning_rate=0.01, df_val=None): "II" Computes gradient descent with momentum (0.9) for a number of iterations. Prints training cost and validation cost (if df_val is not None) every 50 iterations. Returns: emb_user: the trained user embedding emb_movie: the trained movie embedding IIII Y=d f 2 m a t r i x(d f, emb_user.shape[0], emb_movie.shape [0]) ### BEGIN SOLUTION ### END SOLUTION return emb_user, emb_movie[7]: emb_movie [7]: array([[0.66095748,0.84977739,0.34908569,0.61299313,1.07153635],[1.07555171,0.15070237,0.24869145,0.06176064,0.52897181],[0.03585145,0.54819987,0.77897286,0.33418474,0.81150588],[0.70903538,0.02877826,0.67062491,0.31110294,0.49812144]])[8]: emb_user [8] : array([[0.66095748,0.84977739,0.34908569,0.61299313,1.07153635],[1.07555171,0.15070237,0.24869145,0.06176064,0.52897181],[0.03585145,0.54819987,0.77897286,0.33418474,0.81150588],[0.70903538,0.02877826,0.67062491,0.31110294,0.49812144],[0.3402301,0.8317655,0.52854446,0.18824129,0.65357882],[0.93637772,0.36763624,0.26634946,0.46556551,1.12366038],[1.17119451,0.80686041,1.08340093,1.01490105,0.45359285]])[] :[1 userId, movieId, rating; 211,1,4; 311,23,5; 42,23,5; 52,4,3; 631,1,4; 731,23,4; 84,1,5; 94,3,2; 1052,1,1; 1152,3,4; 1261,3,5; 137,23,1; 147,3,3; 15][ E/ u=-2/N\Delta v; E/ v=-2/N\Delta ^ u ]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!