연습문제 풀이 에러 발생
25년 연습문제 5번 문제풀이시 발생된 에러입니다.
설명 부탁드립니다.
6)모델 학습
rom sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
model=RandomForestRegressor(random_state=42)
model.fit(X,Y)
7)모델 예측
y_pred=model.predict(test)
Errors 발생~~~~~
------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[29], line 1 ----> 1 y_pred=model.predict(test) File ~\anaconda3\Lib\site-packages\sklearn\ensemble\_forest.py:981, in ForestRegressor.predict(self, X) 979 check_is_fitted(self) 980 # Check data --> 981 X = self._validate_X_predict(X) 983 # Assign chunk of trees to jobs 984 n_jobs, _, _ = _partition_estimators(self.n_estimators, self.n_jobs) File ~\anaconda3\Lib\site-packages\sklearn\ensemble\_forest.py:602, in BaseForest._validate_X_predict(self, X) 599 """ 600 Validate X whenever one tries to predict, apply, predict_proba.""" 601 check_is_fitted(self) --> 602 X = self._validate_data(X, dtype=DTYPE, accept_sparse="csr", reset=False) 603 if issparse(X) and (X.indices.dtype != np.intc or X.indptr.dtype != np.intc): 604 raise ValueError("No support for np.int64 index based sparse matrices") File ~\anaconda3\Lib\site-packages\sklearn\base.py:548, in BaseEstimator._validate_data(self, X, y, reset, validate_separately, **check_params) 483 def _validate_data( 484 self, 485 X="no_validation", (...) 489 **check_params, 490 ): 491 """Validate input data and set or check the `n_features_in_` attribute. 492 493 Parameters (...) 546 validated. 547 """ --> 548 self._check_feature_names(X, reset=reset) 550 if y is None and self._get_tags()["requires_y"]: 551 raise ValueError( 552 f"This {self.__class__.__name__} estimator " 553 "requires y to be passed, but the target y is None." 554 ) File ~\anaconda3\Lib\site-packages\sklearn\base.py:481, in BaseEstimator._check_feature_names(self, X, reset) 476 if not missing_names and not unexpected_names: 477 message += ( 478 "Feature names must be in the same order as they were in fit.\n" 479 ) --> 481 raise ValueError(message) ValueError: The feature names should match those that were passed during fit. Feature names unseen at fit time: - Performance Index
댓글
25년 연습문제 5번이 아니라 6번입니다.
안녕하세요
도서에 있는 홈페이지 가셔서 자료실→빅분기→ 26년 도서의 파이썬 데이터셋을 다운로드 받으세요!
데이터 떄문에 발생하는 오류입니다.
25년도 연습문제인데.. 기초 데이터는 26년도 자료를 다운로드 받아야 합니까???
연습문제 풀이와 관련 기초 데이터의 기간이 불일치하면 사전에 해당 내용을 공지해 주시면 감사하겠습니다.
안녕하세요. epasskorea입니다.
내용을 확인해보니 2026년 과정이 정식오픈하기 전 2025 + 2026 얼리버드 과정을 구입하신 분들께 제공된 파일 중 2026년 신규 파일 첨부가 누락된 점이 파악되었습니다.
이 부분 진심으로 사과드립니다.
고객님 이메일(kjh2927@naver.com)로 파일을 첨부해드렸으니 이 부분 확인부탁드리겠습니다.
파일 첨부로 인해 수강에 불편을 드린점 다시한번 사과드립니다.
감사합니다.
댓글을 남기려면 로그인하세요.