我试图从Github存储库中运行一个培训模块。但是,当我运行代码时,它给了我MemoryError:无法分配724。MiB用于形状(9742,9742)和数据类型float64错误的数组。完整代码位于https://pastebin.com/4gD34s28上。 当我在Django项目中使用它时,发生了我的错误,但是在核心python中,它运行良好。 数据集:http://files.grouplens.org/datasets/movielens/ml-latest-small.zip
tf = TfidfVectorizer(analyzer='word',ngram_range=(1, 2),min_df=0, stop_words='english')
tfidf_matrix = tf.fit_transform(movies['genres'])
tfidf_matrix.shape
print('hello1')
cosine_sim = linear_kernel(tfidf_matrix, tfidf_matrix)