Code freezes and never returns when linear_kernel (sklearn.metrics.pairwise) is used on 20M Movielens dataset

I’m fairly new to ML/AI, i’m trying learn the content based recommendation – here is my source code – https://github.com/jaganlal/content-based-recommender I’m using MovieLens 20M dataset – tags.csv to recommend similar movies based on its tag. But whenever i run (from sklearn.metrics.pairwise) cosine_similarities = linear_kernel(tfidf_matrix, tfidf_matrix) The python cell keeps executing and doesn’t return at all.…

LSTM convergence

Despite the problem being very simple, I was wondering why a LSTM network was not able to converge to a decent solution. import numpy as np import keras X_train = np.random.rand(1000) y_train = X_train X_train = X_train.reshape((len(X_train), 1, 1)) model= keras.models.Sequential() model.add(keras.layers.wrappers.Bidirectional(keras.layers.LSTM(1, dropout=0., recurrent_dropout=0.))) model.add(keras.layers.Dense(1)) optimzer = keras.optimizers.SGD(lr=1e-1) model.build(input_shape=(None, 1, 1)) model.compile(loss=keras.losses.mean_squared_error, optimizer=optimzer, metrics=[‘mae’]) history…