Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. # create matrix with only rows in X corresponding to arrY if x0 or x1 is in that row
  2. def pruneData(x0,x1, arrX, arrY):
  3. l = len(arrY[arrY == x0]) + len(arrY[arrY == x1])
  4. pArrX = np.zeros((arrX.shape[0], l))
  5. pArrY = np.zeros(l)
  6. j = 0
  7. for i in range(arrY.shape[0]):
  8. if arrY[i] == x0 or arrY[i] == x1:
  9. pArrX[:,j] = arrX[:,i:i+1][:,0]
  10. pArrY[j] = arrY[i]
  11. j+=1
  12. pArrX = np.array(pArrX)
  13.  
  14. return pArrX, np.array(pArrY)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement