안녕하세요. dir 이나 __all 관련해서,,, print(sklearn.__all__) 은 알겠는데요. 그 다음,,, from sklearn.ensemble import RandomForestClassifier 여기서,, randaomforestclassifier 이게 생각이 나지 않을때 이걸 찾을 수 있는 방법은 없는지요?
안녕하세요, 작업형3을 공부하던 중 궁금한 점이 생겨 문의드립니다. 어떤 상황에서 T검정, 카이제곱 검정, 회귀분석, 분산분석(ANOVA)를 수행하는건지 명확히 분류가 잘 안 되는데 위와 같이 T검정, 카이제곱 검정, 회귀분석, 분산분석 중 어떤 것을 수행할지는 문제에서 주어지는 사항일까요? 감사합니다!
우선 빌더를 활용해 내부에서 객체를 생성하고 외부에서 해당 객체를 생성하려면 정적 팩토리 메서드를 사용하거나 혹은 toEntity 같은 메서드를 만들어 사용하면 좋을거 같다 라는 생각이 들었습니다. 궁금한 점은 외부에서 객체를 생성할때 어떤 경우에는 정적 팩토리 메서드를 사용해서 생성하고 어떤 경우에는 toEntity 같은 메서드를 만들어서 사용하면 좋을지 궁금합니다. @Getter @NoArgsConstructor public class ProductCreateServiceRequest { private ProductType type; private ProductSellingStatus sellingStatus; private String name; private int price; @Builder private ProductCreateServiceRequest(ProductType type, ProductSellingStatus sellingStatus, String name, int price) { this.type = type; this.sellingStatus = sellingStatus; this.name = name; this.price = price; } public Product toEntity(String nextProductNumber) { return Product.builder() .productNumber(nextProductNumber) .type(type) .sellingStatus(sellingStatus) .name(name) .price(price) .build(); } }
train = pd.read_csv('/kaggle/input/working8-2/churn_train.csv') test = pd.read_csv('/kaggle/input/working8-2/churn_test.csv') target = train.pop('TotalCharges') train = pd.get_dummies(train) test = pd.get_dummies(test) from sklearn.model_selection import train_test_split X_tr,X_val,y_tr,y_val = train_test_split(train, target, test_size=0.2, random_state=2022) from sklearn.metrics import mean_absolute_error from sklearn.ensemble import RandomForestRegressor rf = RandomForestRegressor(random_state=2022, max_depth=7, n_estimators=600) rf.fit(X_tr,y_tr) pred = rf.predict(X_val) answer = rf.predict(test) rf.predict(X_val)까지는 잘 예측이 되어, 866.4986350062683의 값을 얻었습니다. 그리하여 마지막으로 본 test파일을 예측하여 제출하려고 하는데, 계속해서 오류가 발생하네요 ㅠㅠㅠ 아래는 에러 코드입니다. ValueError Traceback (most recent call last) Cell In[97], line 14 12 rf.fit(X_tr,y_tr) 13 pred = rf.predict(X_val) ---> 14 answer = rf.predict(test) File /opt/conda/lib/python3.10/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 /opt/conda/lib/python3.10/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 /opt/conda/lib/python3.10/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 /opt/conda/lib/python3.10/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: - customerID_CUST0001 - customerID_CUST0002 - customerID_CUST0006 - customerID_CUST0007 - customerID_CUST0008 - ... Feature names seen at fit time, yet now missing: - customerID_CUST0000 - customerID_CUST0003 - customerID_CUST0004 - customerID_CUST0005 - customerID_CUST0009 - ...
>> views 컬럼에 결측치가 있는 데이터(행)을 삭제하고, f3 컬럼의 결측치는 0, silver는 1, gold는 2, vip는 3 으로 변환한 후 총 합을 정수형으로 출력하시오<< 이 문제를 풀이할 때, 강사님이 말씀해주신 것처럼 문제를 풀었는데 답 밑에 이런 문구들이 표기됩니다. 133 <ipython-input-34-9be3d2c84afd>:11: FutureWarning: Downcasting behavior in `replace` is deprecated and will be removed in a future version. To retain the old behavior, explicitly call `result.infer_objects(copy=False)`. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)` df['f3'] = df['f3'].replace('silver',1).replace('gold',2).replace('vip',3) 이렇게 표기되어도 정답 인정은 되는 것인지 궁금합니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 안녕하세요! 열심히 한강의씩 듣고있는 수강생입니다. 항상 너무 자세히 설명도 너무 잘 해주셔서 감사합니다. 일원분산분석 수강중 melt를 진행하고 이렇게 나온것까지는 이해가 됐습니다! 혹시 분산분석테이블에서 ols를 할 때 종속, 독립을 넣어야하는데 어떻게 구분해야할지가 문득 궁금해져서 질문을 남기게 되었습니다..! 보통은 맨 우측에있는 부분을 종속변수로 알면 될까요?
#text= text.replace("파이썬", "머신러닝").replace("분석기사", "분석을 위한") 에서 여러단어 변경 시 유의사항으로 앞에서 부터 실행돼서 파이썬부터 머신러닝으로 바꿔야 한다고 말씀하셨는데 앞에서 부터 실행되면 분석기사부터 바꿔야되는 거 아닌가요? 왜냐면 text = 빅데이터 분석기사 파이썬 공부 순이라서. 앞에서 부터 실행된다는게 분석기사부터 바뀌는게 아닌가 하는 생각이 들어서 여쭤봅니다. #text= text.replace("분석기사", "분석을 위한").replace("파이썬", "머신러닝") 으로 바꿔서 실행해보니 '빅데이터 분석을 위한 머신러닝 공부' 라는 값이 도출됩니다.
1987번 제 풀이가 선생님의 리스트 풀이와 비슷하다고 생각해서 제출을 해봤는데 시간 초과가 나는 것 같습니다. 이상하다고 생각해서 선생님께서 작성해주신 예시코드도 복붙해봤는데 똑같이 시간 초과가 나는 것 같아서요... 혹시 뭐가 문제일까요? 컴퓨터마다 시간이 달라서 그런걸까요?
안녕하세요 선생님. 백준 3085번 풀이2와 제 풀이가 비슷한 것 같은데 제 풀이는 틀린 것으로 나오는데 어떤 부분이 잘못됐는지 잘 모르겠습니다. 제가 어떤 부분을 놓치고 있는지 알려주시면 감사하겠습니다! import sys from itertools import combinations def input(): return sys.stdin.readline().rstrip() def get_max(i,j): global data, n ser1 = data[i] ser2 = [data[k][j] for k in range(n)] return max(count_max(ser1), count_max(ser2)) def count_max(ser): count = 0 bef = '.' for idx in range(len(ser)): if bef != ser[idx]: count = 1 else: count += 1 bef = ser[idx] return count n = int(input()) data = [] for _ in range(n): data.append(list(input())) dx = [0,1,-1,0] dy = [1,0,0,-1] cur_max = 0 for i in range(n): for j in range(n): if i == j: cur_max = max(cur_max, get_max(i, j)) for di, dj in zip(dx,dy): ni = i + di nj = j + dj if not ((0 <= ni < n) & (0 <= nj < n)): continue if (data[ni][nj] == data[i][j]): continue data[i][j], data[ni][nj] = data[ni][nj], data[i][j] cur_max = max(cur_max, get_max(i, j)) data[i][j], data[ni][nj] = data[ni][nj], data[i][j] print(cur_max)
안녕하세요, 강의 너무 잘 듣고 있습니다. 잘 따라가고 있던 와중 프론트 코드에 URL 상수를 지정하는 과정들을 거치고 UI가 있는 창에서 개발자 도구를 열어도 연결 완료 문구가 뜨지 않아 글 남깁니다. 저와 같은 문제로 질문 주신 커뮤니티의 다른 분께 프론트 파일과 주소를 남겨달라고 하셔서 메일로 프론트 파일과 주소를 보내드린 상태입니다. 한 번만 확인해 주신다면 감사드립니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 import pandas as pd train = pd.read _csv("data/customer_train.csv") test = pd.read _csv("data/customer_test.csv") # print(train.shape,test.shape) #2482 # print( train.info (), test.info ()) # print(train.isnull().sum()) # 결측값 존재함 # print(test.isnull().sum()) # 결측값 존재함 # 전처리 train = train.fillna(0) test =test.fillna(0) # print(train.isnull().sum()) # print(test.isnull().sum()) target = train.pop('성별') df= pd.concat([train,test]) df = pd.get_dummies(df) train = df.iloc[:len(train)] test = df.iloc[len(train):] print(train.shape,test.shape) # 모델 분리 및 검증 from sklearn.model_selection import train_test_split X_tr,X_val,y_tr,y_val = train_test_split(train,target,test_size=0.2,random_state=22) # print(X_tr.shape,X_val.shape,y_tr.shape,y_val.shape) # 모델 학습 from sklearn.ensemble import RandomForestClassifier rf = RandomForestClassifier(random_state=22) rf.fit (X_tr,y_tr) pred = rf.predict_proba(X_val) # 결과 pred = rf.predict_proba(test) submit = pd.DataFrame({'pred':pred[:,1]}) submit.to _csv('result.csv',index=False) print( pd.read _csv('result.csv').head()) print( pd.read _csv('result.csv').shape) #2482 이 식으로 풀어도 될까요??
Error: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding 'use client' to a module that was originally written for the server. 이라는 에러가 뜨고 유저리스트가 빈배열 리턴되는데 이런 경우 어떻게 처리해야하나요?