I’m trying to split my data into training, validation, and test sets using Fast_ml for a machine learning purpose. Both my input and output data are read from .npy files through np.load. The input "P" is an array with the shape of (100000, 4, 4, 6, 1) and the target "Q" is a vector of shape (100000,). I use the code below:
from fast_ml.model_development import train_valid_test_split X_train, y_train, X_valid, y_valid, X_test, y_test = train_valid_test_split(P, Q, train_size=0.8, valid_size=0.1, test_size=0.1)
However, I receive this error:
AttributeError: 'numpy.ndarray' object has no attribute 'drop'
This solved my problem:
from sklearn.model_selection import train_test_split X_train, X_rem, y_train, y_rem = train_test_split(P,Q, train_size=0.8) X_valid, X_test, y_valid, y_test = train_test_split(X_rem,y_rem, test_size=0.5)
Answered By – Liam Spring
Answer Checked By – Senaida (AngularFixing Volunteer)