Caso alguém possa ajudar. O problema é o seguinte.
Estou no Curso Regressão Linear II, na parte que trata sobre "Criando os datasets de treino e de teste", coloquei o comando informado no curso, que é:
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=2811)
Retornando o seguinte erro:
ValueError Traceback (most recent call last) in ----> 1 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=2811)
~\anaconda3\lib\site-packages\sklearn\model_selection_split.py in train_test_split(arrays, **options) 2116 raise TypeError("Invalid parameters passed: %s" % str(options)) 2117 -> 2118 arrays = indexable(arrays) 2119 2120 n_samples = numsamples(arrays[0])
~\anaconda3\lib\site-packages\sklearn\utils\validation.py in indexable(iterables) 246 """ 247 result = [makeindexable(X) for X in iterables] --> 248 check_consistent_length(result) 249 return result 250
~\anaconda3\lib\site-packages\sklearn\utils\validation.py in check_consistent_length(*arrays) 210 if len(uniques) > 1: 211 raise ValueError("Found input variables with inconsistent numbers of" --> 212 " samples: %r" % [int(l) for l in lengths]) 213 214
ValueError: Found input variables with inconsistent numbers of samples: [1, 5000]