'Description of Scipy matrix - Sklearn
I'm working on NPL with sklearn, slipt my data set into training and test sets as follow:
X_train, X_test, y_train, y_test = train_test_split(X,Y,test_size=0.3, shuffle=True,random_state=0,stratify=Y)
How I can get a description of the X_train and y_train (i.e. how many registers has of each label), due that the resulting objects are class 'scipy.sparse.csr.csr_matrix' and does not have a description attribute.
Solution 1:[1]
csr_matrix is a sparse matrix provided by scipy. If you want to inspect its content, you could call .toarray() on it, which return a dense ndarray representation of this matrix.
For example, print(X_train.toarray())
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kwsp |
