I'm trying to plot features matrix and labels array together with scatter plot. (basic machine learning tutorial)
The feature matrix was built in this way:
- the rows defines file names and the rows defines the words from dictionary.
- the values in the matrix contains the count of each word in the file.
- the size of the matrix is [N*M]
The labels was built in this way:
- vector (matrix (1:M)) were each value contains 1 or 0
I want to visual the feature matrix and it's labels so scatter plot seems the right way.
I used 'matshow
' to plot the matrix but I have troubles to connect to the labels.
For simple example I have tried to test with simple code:
import numpy as np
mat = np.zeros((5, 10))
arr = np.zeros(5)
mat[1,1] = 7
mat[3,3] = 9
mat[1,2] = 2
mat[1,4] = 20
mat[2,3] = 1
arr[1] = 1
arr[3] = 1
import matplotlib.pyplot as plt
#plt.scatter(x, y)
plt.matshow(mat)
plt.show()
So how can I plot the matrix and show the labels in scatter matrix (or other appropriate plot)