강의

멘토링

커뮤니티

Inflearn Community Q&A

yhd42865671's profile image
yhd42865671

asked

[After Work Side Projects] Big Data Analytics Engineer Practical Exam (Task Types 1, 2, 3)

2nd Mock Exam Type (Practical Type 2)

예측 부분 오류 질문드립니다.

Resolved

Written on

·

883

·

Edited

0

랜덤포레스트 하나만 실시 후에 예측 했는데요

오류가 뜨는데 이유를 모르겠습니다...스크린샷 2023-11-06 214916.png/usr/local/lib/python3.10/dist-packages/sklearn/base.py:439: UserWarning: X does not have valid feature names, but RandomForestClassifier was fitted with feature names warnings.warn(

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-106-aa9a7e4fa732> in <cell line: 2>()
      1 # 예측
----> 2 pred = model.predict_proba(X_test)
      3 pred


3 frames


/usr/local/lib/python3.10/dist-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator, input_name)
    900             # If input is 1D raise error
    901             if array.ndim == 1:
--> 902                 raise ValueError(
    903                     "Expected 2D array, got 1D array instead:\narray={}.\n"
    904                     "Reshape your data either using array.reshape(-1, 1) if "

ValueError: Expected 2D array, got 1D array instead:
array=[ 8285. 10192.  8675. ...  7390.  9977.  5696.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
python머신러닝빅데이터pandas빅데이터분석기사

Answer 1

0

roadmap님의 프로필 이미지
roadmap
Instructor

모델을 만들 때 X_train에서는 ID값을 제거했고

X_test에서는 제거하지 않은 것은 아닐까요??

yhd42865671's profile image
yhd42865671

asked

Ask a question