[問題] 大型矩陣相乘會卡很久
大家好
我最近練習做 term-document-matrix
用到的 library是 : pandas sklearn
我的矩陣說起來並不會很大
大概 (55534, 3117)
數字再 0~503 之間(min,max)
不過我在做 相乘的時候 jupyter 都會卡很久就當掉了!!!
這行會卡很久
不知道問題會是出在哪裡呢?
np.matmul(A,B)
底下是我的code
這個問題卡好久了QQ
# ---------------- Code -----------------
# import
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
# 做 term-document-matrix
vec = CountVectorizer()
X = vec.fit_transform(contents_big_array)
df = pd.DataFrame(X.toarray(), columns=vec.get_feature_names())
# 做矩陣
A = df.values.T
B = df.values
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.45.101.55
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1531932953.A.86A.html
→
07/19 00:58,
7年前
, 1F
07/19 00:58, 1F
推
07/19 01:15,
7年前
, 2F
07/19 01:15, 2F
55534*55534*64bit 好像差不多 22G了耶OAO
可以問一下這種大型矩陣大概要怎麼算嗎?
還是可以分開運算在結合起來?
※ 編輯: HenryLiKing (140.138.25.124), 07/19/2018 09:55:57
→
07/19 10:04,
7年前
, 3F
07/19 10:04, 3F
→
07/19 10:06,
7年前
, 4F
07/19 10:06, 4F
Python 近期熱門文章
PTT數位生活區 即時熱門文章