Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- D:\Users\psalm\AppData\Local\Temp/ipykernel_41176/1930297868.py in <module>
- 14 print("Performance of kNN regressor with n = 10")
- 15 breast_cancer_y_pred = knn_10_regr.predict(x_test)
- ---> 16 print("Mean squared error: %.2f" % mean_squared_error(y_test, breast_cancer_y))
- 17 print("Coefficient of determination: %.2f" % r2_score(y_test, breast_cancer_y))
- 18 print()
- C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
- 61 extra_args = len(args) - len(all_args)
- 62 if extra_args <= 0:
- ---> 63 return f(*args, **kwargs)
- 64
- 65 # extra_args > 0
- C:\ProgramData\Anaconda3\lib\site-packages\sklearn\metrics\_regression.py in mean_squared_error(y_true, y_pred, sample_weight, multioutput, squared)
- 333 0.825...
- 334 """
- --> 335 y_type, y_true, y_pred, multioutput = _check_reg_targets(
- 336 y_true, y_pred, multioutput)
- 337 check_consistent_length(y_true, y_pred, sample_weight)
- C:\ProgramData\Anaconda3\lib\site-packages\sklearn\metrics\_regression.py in _check_reg_targets(y_true, y_pred, multioutput, dtype)
- 86 the dtype argument passed to check_array.
- 87 """
- ---> 88 check_consistent_length(y_true, y_pred)
- 89 y_true = check_array(y_true, ensure_2d=False, dtype=dtype)
- 90 y_pred = check_array(y_pred, ensure_2d=False, dtype=dtype)
- C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_consistent_length(*arrays)
- 317 uniques = np.unique(lengths)
- 318 if len(uniques) > 1:
- --> 319 raise ValueError("Found input variables with inconsistent numbers of"
- 320 " samples: %r" % [int(l) for l in lengths])
- 321
- ValueError: Found input variables with inconsistent numbers of samples: [114, 569]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement