R_train.pkl 파일
...


대체 어떻게 출력해야하는거지? 생각했는데,
이 파일의 형식은 sparce csr matrix,
Compressed Sparce Row (CSR) 형식이었다.
결론적으로 다음과 같이 출력된다.
mat = csr_matrix(R_train)
print(mat)

한국어로 어떻게 불러야 할지 모르겠다.
압축된 조각 행 ?
(희소 행렬이라 한다.)
import numpy as np
from scipy.sparse import csr_matrix
row = np.array([0, 0, 1, 2, 2, 2])
col = np.array([0, 2, 2, 0, 1, 2])
data = np.array([1, 2, 3, 4, 5, 6])
mat = csr_matrix((data, (row, col)), shape=(3, 3))
mat2 = csr_matrix((data, (row, col)), shape=(3, 3)).toarray()
print(mat)
print(mat2)

print('shape:', mat.shape)
print(mat[0]) # 첫 행을 출력 (0이 아닌 값)
print(mat[0].nonzero()) # x좌표, y좌표
print(mat[0].nonzero()[0]) # x좌표 벡터화
print(mat[0].nonzero()[1]) # y좌표 벡터화

print(mat.nonzero()) # x좌표, y좌표
rows, cols = mat.nonzero()
print(rows)
print(cols)
z = zip(rows, cols)
print(list(z))

참고자료
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html