0

how does ravel work in a model? even though I know the concept of numpy.ravel, is to reshape the array, but I can't find any documentation for me to learn below.

ML_model.fit(features_train,labels_train.values.ravel())

Thanks

I just realize something from the documentation, np.revel(a) is the same as a.revel(), I can break down the code

labels_train.values.ravel()

, then I understand now

BigData
  • 397
  • 2
  • 3
  • 13
  • 2
    https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html – jezrael Apr 22 '18 at 16:57
  • Attached dup is a slightly different question but has an answer which should be sufficient for your needs. – jpp Apr 22 '18 at 16:59
  • 1
    I just realize something from the documentation, np.revel(a) is the same as a.revel(), I can break down the code "labels_train.values.ravel()", then I understand now – BigData Apr 22 '18 at 17:10
  • 1
    `labels_train.values.ravel()` is performed before calling the `fit` method. It's reshaping one of the input arrays that will be passed to the method. So apart of knowing that `fit` will accept (or require) a 1d array, this is not `model` specific. – hpaulj Apr 22 '18 at 17:10

0 Answers0