묻고 답해요
129만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결캐글 설문조사로 데이터 분석 입문하기
hue를 사용할 때
hue를 사용할 때 나타나는 Q2 색상 구분표의 위치는 변경할 수 없나요?
-
미해결캐글 설문조사로 데이터 분석 입문하기
q1_cols를 작성하는 부분에서 궁금한 점이 있습니다.
q1_cols = answer["Q1"].value_counts().sort_index().index.tolist()def show_countplot_by_qno(qno, fsize=(10, 6), order=None): if not order: order = answer[qno].value_counts().index.tolist() plt.figure(figsize=fsize) sns.countplot(data=answer, y=qno, order=order,palette="Blues_r" ).set_title(question[qno]) show_countplot_by_qno("Q1", order=q1_cols)not order 일 때는 tolist() 안해도 출력이 되는데왜 order를 변수로 넣을 때는 tolist() 안하면 에러가 발생하는지 궁금합니다.tolist() 붙여봐도 달라진게 없는것 같은데 어떤 방식인지 모르겠습니다.
-
미해결딥러닝 CNN 완벽 가이드 - Fundamental 편
안녕하세요 교수님
'Dense Layer로 Fashion MNIST 예측 모델 구현하기 - 이미지 데이터 확인 및 사전 데이터 처리' 강의코드중 궁금한 내용이 있어 질문드립니다.train_images[0, :, :] 코드를 사용하셨는데 train_images[0]이 아닌 이미지 인덱스에 전체 행과 열을 불러오는 부분을 추가하신 특별한 이유가 있을까요?
-
해결됨딥러닝 CNN 완벽 가이드 - Fundamental 편
가중치 초기화(Weight Initialization) 질문입니다.
안녕하세요 교수님, CNN 강의와 같은 좋은 수업 감사드립니다.다름이 아니라 가중치 초기화를 공부하다가 생긴 궁금증에 질문 글을 달아봅니다.교수님께서 강의 하실 때 평균이 0, 표준 편차 1인 표준 정규 분포에서 Weight 초기화시 sigmoid 출력이 대부분 0과 1로 수렴하신다고 하셨는데이렇게 되는 이유가 평균이 0, 표준 편차가 1인 표준 정규 분포에서 Weight를 초기화하면 처음에 Weight값이 너무 작거나 혹은 너무 큰 값들로 배정되기 때문에 저렇게 되는 걸까요?즉, Weight값이 -1 ~ 1까지의 값들 중 임의로 배정되기 때문에 그런건가요?반대로 Sigmoid 출력이 대부분 0.5로 수렴하는 경우에는 -0.01 ~ 0.01중 Weight 값이 결정되기 때문에 그런걸까요?
-
미해결처음하는 파이썬 머신러닝 부트캠프 (쉽게! 실제 문제로 개념/활용 익히기) [데이터과학 Part2]
3강 강의 자료 코드 관련 질문입니다
- 섹션 3 타이타닉 문제로 시작하는 EDA: 범주형 데이터 분석 패턴1 11분 13초에 나오는 코드를 수정하지 않고 실행하였는데 ValueError: could not convert string to float: 'Braund, Mr. Owen Harris'가 떴습니다. 해결 방법을 알 수 있을까요
-
미해결캐글 Advanced 머신러닝 실전 박치기
권철민교수님 진심으로 감사드립니다.
권철민 교수님 감사드립니다. 인프런,유데미,패캠등 수많은 강의를 들었는데 이렇게 수준높고 이해하기 쉬었던 질높은 강의는 처음이었던것 같습니다. 다시한번 감사 드립니다. 앞으로도 교수님의 발자취를 따라가며 관련 강의를 많이 접하고 싶은데 인프런 포함 계속 교수님께 배울수 있는 방법이 있을지 문의드립니다. 회신은 DM으로 주셔도 됩니다. (marius.oh@lge.com)
-
해결됨캐글 Advanced 머신러닝 실전 박치기
안녕하세요 선생님
안녕하세요 선생님 우선 좋은강의 감사드립니다.두가지 질문이 있는데요.... 우선 아나콘다 주피터 노트북에 대해서 질문입니다.prev_baseline_01 관련 파이썬을 실행중이고 '섹션3 previous_application 데이터 가공/모델 학습/평가'에서 주피터노트북으로 코딩을 실행하는데 자꾸 커널이 죽어버립니다. 데이터 전처리들을 다 실행하고. LGBMClassifier를 실행하는데.. ''the kernel appears to have died. it will restart automatically'' 이런 문구가 떠서 구글링도 하고 그랬지만, 어떤분은 max_buffer_size를 크게 올려라고도 했는데 잘 되지가 않네요..의문이 있습니다만, 주피터노트북이 컴퓨터 사양으로 돌아가는것이 아닌가요? 저의 컴퓨터가 굉장히 하이엔드 컴퓨터라 램도 64기가가 넘는데, 고작 몇매가로 뻗어버리는게 뭔가 마음?이 아프고 고작 이정도로 이러면 앞으로 주피터노트북에서 텐서랑 케라스를 돌리면 어떻게 되는걸까 되게 의문이 많습니다. 제가 어디를 놓치고 있는것인지,. 괜찮은 방법이 있다면 알려주시면 감사드리겠습니다.(아 처음에 VM서버랑 주피터노트북이랑 연동하지못했습니다. 맥 환경이라. 하지를 못해서 ㅠㅠㅠ) 그리고 두번째로, 으음 제가 대학원이랑 취업을 준비하고있습니다. 수학하고 통계를 전공해서 학사졸업을 했구요, 인공지능이나 데이터사이언스로 대학원을 가기를 희망해서 현재 선생님의, 데이터비젼강의들과, 머신러닝 강의를 수강하고있고, 일주일내로 SQL강의또한 수강을 할 생각입니다.그런데 컴퓨터전공에 대한 지식이 부족해(알고리즘,자료구조,컴퓨터구조,데이터베이스 등등...) 조금 고민이 많은데요.이게 이것마져도 다 할려고 덤비니까 굉장히.. 힘들더라구요(개발자도 아닌데..) 혹시 일단은 여기정도까지만 공부하면 괜찮다..! 싶은 선이 있을까 싶습니다.
-
미해결처음하는 파이썬 머신러닝 부트캠프 (쉽게! 실제 문제로 개념/활용 익히기) [데이터과학 Part2]
맥 사용자 mkdir .kaggle 했는데 파일이 안만들어집니다.
맥 사용자 mkdir .kaggle 했는데 파일이 안만들어집니다.그래서 ls해도 아무것도 뜨지 않고, 폴더가 없으니 kaggle.json 파일도 옮길수 없습니다.. 제가 직접 만들어 보려고 했는데 .이 들어가서 파일명을 할 수 없다고 뜹니다 ㅠㅠ 어떻게 해ㅑ야 할까요
-
미해결파이썬 기초 라이브러리부터 쌓아가는 머신러닝
선형 회귀 이론 및 실습 부터 전혀 이해가 안되네요.
수업 내용 자체가 갑자기 변화한 것 같습니다.갑자기 내용 자체가 이론적인 부분이 나타나면서 이해가 전혀 안되는데, 찾아보고 공부하고 넘어가는 것이 좋을지아니면 계속 이어 들어가나는 것이 좋을지 문의 드립니다. 내용이 이해가 안되네요.
-
해결됨딥러닝 CNN 완벽 가이드 - Fundamental 편
테스트 데이터셋 predict의 'NoneType' object has no attribute 'shape' 오류
안녕하세요.테스트 데이터셋을 predict하는 부분에서 오류가 나서 질문드립니다. test_path = test_df['path'].values test_ds = Plant_Dataset(image_filenames=test_path, labels=None, image_size=IMAGE_SIZE, batch_size=BATCH_SIZE, augmentor=None, shuffle=False, pre_func=xcp_preprocess_input) preds = xcp_model_01.predict(test_ds) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[40], line 7 3 test_path = test_df['path'].values 4 test_ds = Plant_Dataset(image_filenames=test_path, labels=None, image_size=IMAGE_SIZE, batch_size=BATCH_SIZE, 5 augmentor=None, shuffle=False, pre_func=xcp_preprocess_input) ----> 7 preds = xcp_model_01.predict(test_ds) File /opt/conda/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py:123, in filter_traceback.<locals>.error_handler(*args, **kwargs) 120 filtered_tb = _process_traceback_frames(e.__traceback__) 121 # To get the full stack trace, call: 122 # `keras.config.disable_traceback_filtering()` --> 123 raise e.with_traceback(filtered_tb) from None 124 finally: 125 del filtered_tb File /opt/conda/lib/python3.10/site-packages/tree/__init__.py:435, in map_structure(func, *structures, **kwargs) 432 for other in structures[1:]: 433 assert_same_structure(structures[0], other, check_types=check_types) 434 return unflatten_as(structures[0], --> 435 [func(*args) for args in zip(*map(flatten, structures))]) File /opt/conda/lib/python3.10/site-packages/tree/__init__.py:435, in <listcomp>(.0) 432 for other in structures[1:]: 433 assert_same_structure(structures[0], other, check_types=check_types) 434 return unflatten_as(structures[0], --> 435 [func(*args) for args in zip(*map(flatten, structures))]) AttributeError: 'NoneType' object has no attribute 'shape' test_image_batch, test_label_batch = next(iter(test_ds))print(test_image_batch.shape, test_label_batch)의 출력이 (32, 224, 224, 3) Nonehistory.history['val_auc']의 출력이 [0.9417113065719604, 0.9647012948989868, 0.9738287925720215, 0.9816075563430786, 0.9799161553382874, 0.9804703593254089, 0.9877450466156006, 0.9854006767272949, 0.9803326725959778, 0.9843235611915588]학습도 완료됐고 Plant_Dataset도 제대로 작동하고 있습니다.AttributeError:'NoneType' object has no attribute 'shape'으로 어느 부분이 문제가 되는지 질문드립니다.
-
미해결캐글 Advanced 머신러닝 실전 박치기
# credit_card_balance 데이터셋 피쳐엔지니어링
선생님 안녕하세요 피쳐엔지니어링을 하면서 아래 궁금증이 생겼습니다. 보통 dict aggregation으로 통계변수를 생성할때 (알려주신 루틴이 정말 효율적인 코드를 작성하는데 도움이 됩니다.)min,mean,max를 사용하시는데요 ID는 cnt만 사용하는 것도 이해가 되는데 어떤 경우에는 일수관련한 변수인데 min이 없더라구요 POS_IS_DPD'그리고 어떤 경우에는 sum이 추가되어 있구 (예) DAYS_ENTRY_PAYMENT) 이런 결정은 수차례 실험후 내리신 결정인가요?아니면 어떤 규칙같은것이 있을까요? 강의 내용은 없어서 노하우를 전수받고 싶습니다.(사실 이런부분이 제일 판단하기가 어려워서요, 기본적은 가이드라인을 갖고 피쳐엔지니어링을 하고 싶습니다. )
-
미해결캐글 Advanced 머신러닝 실전 박치기
초거대 데이터셋을 Submission하려면?
안녕하세요, 캐글 공부하다가 궁금증이 생겼습니다. 제가 참여하고 있는 Closed 대회 데이터가 워낙 커지니 모델의 크기도 그만큼 커지게 되는데, 이때 Kaggle Notebook은 성능이 그닥 좋지 못해서 모델 학습 시간이 너무 오래 걸려 Timeout되거나 OOM이 뜹니다. 이를 해결하는 방법이 어떤 게 있을까요?
-
미해결딥러닝 CNN 완벽 가이드 - Fundamental 편
학습이 이상하게 됩니다.
당장 문의드리는 것은 CIFAR10_Pretained이지만 다른 예제를 실행해도 같은 에러가 납니다. tr_data_len = tr_images.shape[0]val_data_len = val_images.shape[0]history = vgg_model.fit(flow_tr_gen, epochs=40,steps_per_epoch=int(np.ceil(tr_data_len/BATCH_SIZE)),validation_data=flow_val_gen,validation_steps=int(np.ceil(val_data_len/BATCH_SIZE)),callbacks=[rlr_cb, ely_cb])) 이 셀을 실행시키면, 이런 식으로 홀수만 학습이 되고 짝수는 학습이 안 됩니다.이 학습시킨 것을 그래프로 나타내면 0이 되었다가 정상적으로 되었다가 반복을 하네요.예전에 예제를 실행시켰을때는 이런 오류가 없었는데 버전이 업데이트되면서 안되는것 같습니다.Adam 함수에 매개변수 lr=을 입력할 때도 에러가 나서 learning_rate=로 변경해야하는 식으로 자잘한 문제도 있습니다.많은 예제에서 같은 오류가 나는 것을 보아 업데이트된 캐글 커널 버전에 맞춰서 코드를 전체적으로 수정하셔야할 필요가 있을것 같습니다.감사합니다. Epoch 1/40 /opt/conda/lib/python3.10/site-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:122: UserWarning: Your `PyDataset` class should call `super().__init__(**kwargs)` in its constructor. `**kwargs` can include `workers`, `use_multiprocessing`, `max_queue_size`. Do not pass these arguments to `fit()`, as they will be ignored. self._warn_if_super_not_called() 10/665 ━━━━━━━━━━━━━━━━━━━━ 12s 19ms/step - accuracy: 0.0987 - loss: 3.5617WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1709598886.339819 103 device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process. 665/665 ━━━━━━━━━━━━━━━━━━━━ 31s 30ms/step - accuracy: 0.1981 - loss: 2.1133 - val_accuracy: 0.4116 - val_loss: 1.5764 Epoch 2/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 28us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 3/40 7/665 ━━━━━━━━━━━━━━━━━━━━ 12s 18ms/step - accuracy: 0.4141 - loss: 1.5560/opt/conda/lib/python3.10/contextlib.py:153: UserWarning: Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches. You may need to use the `.repeat()` function when building your dataset. self.gen.throw(typ, value, traceback) 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.4451 - loss: 1.4449 - val_accuracy: 0.5769 - val_loss: 1.2619 Epoch 4/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 5/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.5782 - loss: 1.1673 - val_accuracy: 0.5975 - val_loss: 1.1887 Epoch 6/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 17us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 7/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.6474 - loss: 1.0090 - val_accuracy: 0.6819 - val_loss: 1.1508 Epoch 8/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 17us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 9/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.6889 - loss: 0.8978 - val_accuracy: 0.6689 - val_loss: 1.2804 Epoch 10/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 11/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.7189 - loss: 0.8345 - val_accuracy: 0.7216 - val_loss: 1.0568 Epoch 12/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 17us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 13/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.7289 - loss: 0.8169 - val_accuracy: 0.7328 - val_loss: 1.3400 Epoch 14/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 17us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 15/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.7646 - loss: 0.7047 - val_accuracy: 0.6892 - val_loss: 1.1569 Epoch 16/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 17/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.7645 - loss: 0.7083 - val_accuracy: 0.7511 - val_loss: 0.9342 Epoch 18/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 19/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.7857 - loss: 0.6478 - val_accuracy: 0.7740 - val_loss: 0.9626 Epoch 20/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 21/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.8012 - loss: 0.6048 - val_accuracy: 0.7763 - val_loss: 0.7990 Epoch 22/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 23/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.8056 - loss: 0.5998 - val_accuracy: 0.7719 - val_loss: 0.8663 Epoch 24/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 25/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.8196 - loss: 0.5483 - val_accuracy: 0.7731 - val_loss: 0.8920 Epoch 26/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 27/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 13s 19ms/step - accuracy: 0.8313 - loss: 0.5199 - val_accuracy: 0.7960 - val_loss: 0.8204 Epoch 28/40 665/665 ━━━━━━━━━━━━━━━━━━━━ 0s 16us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00 - val_accuracy: 0.0000e+00 - val_loss: 0.0000e+00 Epoch 29/40
-
미해결딥러닝 CNN 완벽 가이드 - Fundamental 편
boston import가 안됩니다
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 강의 내용을 질문할 경우 몇분 몇초의 내용에 대한 것인지 반드시 기재 부탁드립니다. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 버전 다운그레이드를 진행햐였음에도 안됩니다 이게 안되면 나머지도 안되서 진행이 안됩니다 ㅜㅜ
-
미해결캐글 Advanced 머신러닝 실전 박치기
Library 관련 질문
#Library환경 셋업 pip install "numpy<1.24" pip install lightgbm==3.3.2 pip install --upgrade bayesian-optimization # lgbm 학습 lgb_model.fit(train_x, train_y, eval_set=[(train_x, train_y), (valid_x, valid_y)], eval_metric= 'auc', verbose= 100, early_stopping_rounds= 100) 기존 코드를 구현했을 때, lgbm학습과정에서 early stopping 과 verbose 파라미터 에러가 계속 발생하는데 그 이유는 library버전 이슈었음을 알게 되었습니다. 강의 내용에 해당 내용이 반드시 초기에 반영되면 좋을 것 같아 의견 드립니다. 추가로 kaggle 환경에서 GPU로 iteration은 30번까지 못돌고 중간에 계속 끊기고 있습니다. 해결 방법을 알려 주실 수 있으실까요? 강의중 50분걸린다고 하신 말은 CPU기준인가요?
-
미해결캐글 Advanced 머신러닝 실전 박치기
최적화 함수 에러
안녕하세요 선생님 코랩에서 베이지안 설치 잘되었고 버전 확인도 잘 되었습니다.그러나 최적화 함수 구동중에 계속 numpy 에러라고 입력변수가 float가 문제가 있다고 나오고 있습니다. 챗gpt에 문의해도 코드 에러는 없다고 합니다 .무엇이 원인일까요? (아레 에러 설명 메세지는 np.float는 없어졌으니 float을 쓰라고 되어 있어서 pbounds 구간에 float도 써보고 float 64도 해보고 다해 봤습니다. 강의 내용중에 코랩에 문제가 있을수 있다는 말씀이 그말씀이실까요? 저는 코드 library를 모두 코랩에 저장하고 있어서 주피터 보다는 코랩에서 실습을 해보고 싶은데 반드시 주피터에서 해야 하는 건가요? 의견 부탁 드립니다. !pip install bayesian-optimization==1.1.0 # Bayesian optimization 은 넓은 범위의 입력값들을 이 함수에 입력했을 때 어떤 입력값이 이 함수를 최대화 하는지 추론. def black_box_function(x, y): return -x ** 2 - (y - 1) ** 2 + 1 # 입력 파라미터들의 범위(공간) import numpy as np pbounds = {'x': (2.0, 4.0), 'y': (-3.0, 3.0)} # 범위는 정수가 아니라 실수 # Create the Bayesian Optimization object optimizer = BayesianOptimization( f=black_box_function, pbounds=pbounds, random_state=2024 ) # Maximize the function optimizer.maximize( init_points=2, n_iter=3, ) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-31-e3170102c931> in <cell line: 10>() 8 9 # Create the Bayesian Optimization object ---> 10 optimizer = BayesianOptimization( 11 f=black_box_function, 12 pbounds=pbounds, 2 frames /usr/local/lib/python3.10/dist-packages/numpy/__init__.py in __getattr__(attr) 317 318 if attr in __former_attrs__: --> 319 raise AttributeError(__former_attrs__[attr]) 320 321 if attr == 'testing': AttributeError: module 'numpy' has no attribute 'float'. `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
-
미해결현업 실무자에게 배우는 Kaggle 머신러닝 입문 - ML 엔지니어 실무 꿀팁
강의자료 요청드립니다.
강의자료 중 교안이 없어 연락드립니다. 교안(PPT) 요청드립니다. 아래 메일로 전달해주시면 감사하겠습니다. actorarnie@gmail.com
-
미해결처음하는 파이썬 머신러닝 부트캠프 (쉽게! 실제 문제로 개념/활용 익히기) [데이터과학 Part2]
Bayesian Optimization에서 optimizer.maximize()함수를 더이상 지원 안한다고 합니다.
- 본 강의 영상 학습 관련 문의에 대해 답변을 드립니다. (어떤 챕터 몇분 몇초를 꼭 기재부탁드립니다)- 이외의 문의등은 평생강의이므로 양해를 부탁드립니다- 현업과 병행하는 관계로 주말/휴가 제외 최대한 3일내로 답변을 드리려 노력하고 있습니다- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. import numpy as np from xgboost import XGBClassifier from bayes_opt import BayesianOptimization from sklearn.model_selection import cross_val_score pbounds = { 'learning_rate': (0.01, 0.5), 'n_estimators': (100, 1000), 'max_depth': (3, 10), 'min_child_weight': (0, 10), 'subsample': (0.5, 1.0), 'colsample_bytree': (0.5, 1.0) # 'reg_lambda': (0, 1000), # 'reg_alpha': (0, 1.0) } def lgbm_hyper_param(learning_rate, n_estimators, max_depth, min_child_weight, subsample, colsample_bytree): max_depth = int(max_depth) n_estimators = int(n_estimators) clf = LGBMClassifier( max_depth=max_depth, min_child_weight=min_child_weight, learning_rate=learning_rate, n_estimators=n_estimators, subsample=subsample, colsample_bytree=colsample_bytree, random_state=1 # reg_lambda=reg_lambda, # reg_alpha=reg_alpha ) return np.mean(cross_val_score(clf, train_importance, train_answer, cv=5, scoring='accuracy')) # cv 도 숫자로 작성하여, 내부적으로 (Stratified)KFold 사용함 optimizer = BayesianOptimization( f=lgbm_hyper_param, pbounds=pbounds, verbose=1, random_state=1) optimizer.maximize(init_points=10, n_iter=100, acq='ei', xi=0.01) 위 코드를 실행하면 아래와 같은 에러가 발생합니다.--------------------------------------------------------------------------- Exception Traceback (most recent call last) Cell In[44], line 34 31 return np.mean(cross_val_score(clf, train_importance, train_answer, cv=5, scoring='accuracy')) # cv 도 숫자로 작성하여, 내부적으로 (Stratified)KFold 사용함 33 optimizer = BayesianOptimization( f=lgbm_hyper_param, pbounds=pbounds, verbose=1, random_state=1) ---> 34 optimizer.maximize(init_points=10, n_iter=100, acq='ei', xi=0.01) File ~\miniconda3\Lib\site-packages\bayes_opt\bayesian_optimization.py:288, in BayesianOptimization.maximize(self, init_points, n_iter, acquisition_function, acq, kappa, kappa_decay, kappa_decay_delay, xi, **gp_params) 286 old_params_used = any([param is not None for param in [acq, kappa, kappa_decay, kappa_decay_delay, xi]]) 287 if old_params_used or gp_params: --> 288 raise Exception('\nPassing acquisition function parameters or gaussian process parameters to maximize' 289 '\nis no longer supported. Instead,please use the "set_gp_params" method to set' 290 '\n the gp params, and pass an instance of bayes_opt.util.UtilityFunction' 291 '\n using the acquisition_function argument\n') 293 if acquisition_function is None: 294 util = UtilityFunction(kind='ucb', 295 kappa=2.576, 296 xi=0.0, 297 kappa_decay=1, 298 kappa_decay_delay=0) Exception: Passing acquisition function parameters or gaussian process parameters to maximize is no longer supported. Instead,please use the "set_gp_params" method to set the gp params, and pass an instance of bayes_opt.util.UtilityFunction using the acquisition_function argument "set_gp_params" method을 사용하라고 하는데gpt에 물어봐도 제대로 된 코드를 주지 않아서 어려움이 있습니다. 제가 설치한 라이브러리는 아래 목록과 같습니다..Package Version ---------------------------- ------------ absl-py 2.1.0 anyio 3.5.0 archspec 0.2.1 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 asttokens 2.0.5 astunparse 1.6.3 async-lru 2.0.4 attrs 23.1.0 Babel 2.11.0 bayesian-optimization 1.4.3 beautifulsoup4 4.12.2 bleach 4.1.0 boltons 23.0.0 Brotli 1.0.9 cachetools 5.3.2 certifi 2023.11.17 cffi 1.16.0 charset-normalizer 2.0.4 colorama 0.4.6 comm 0.1.2 conda 23.11.0 conda-content-trust 0.2.0 conda-libmamba-solver 23.12.0 conda-package-handling 2.2.0 conda_package_streaming 0.9.0 contourpy 1.2.0 cryptography 41.0.7 cv 1.0.0 cycler 0.12.1 debugpy 1.6.7 Note: you may need to restart the kernel to use updated packages. decorator 5.1.1 defusedxml 0.7.1 distro 1.8.0 executing 0.8.3 fastjsonschema 2.16.2 flatbuffers 23.5.26 fonttools 4.47.2 gast 0.5.4 google-auth 2.26.2 google-auth-oauthlib 1.2.0 google-pasta 0.2.0 grpcio 1.60.0 h5py 3.10.0 idna 3.4 ipykernel 6.25.0 ipython 8.20.0 ipywidgets 8.0.4 jedi 0.18.1 Jinja2 3.1.2 joblib 1.3.2 json5 0.9.6 jsonpatch 1.32 jsonpointer 2.1 jsonschema 4.19.2 jsonschema-specifications 2023.7.1 jupyter 1.0.0 jupyter_client 8.6.0 jupyter-console 6.6.3 jupyter_core 5.5.0 jupyter-events 0.8.0 jupyter-lsp 2.2.0 jupyter_server 2.10.0 jupyter_server_terminals 0.4.4 jupyterlab 4.0.8 jupyterlab-pygments 0.1.2 jupyterlab_server 2.25.1 jupyterlab-widgets 3.0.9 keras 2.15.0 kiwisolver 1.4.5 libclang 16.0.6 libmambapy 1.5.3 lightgbm 4.3.0 Markdown 3.5.2 MarkupSafe 2.1.3 matplotlib 3.8.2 matplotlib-inline 0.1.6 menuinst 2.0.1 mistune 2.0.4 ml-dtypes 0.2.0 nbclient 0.8.0 nbconvert 7.10.0 nbformat 5.9.2 nest-asyncio 1.5.6 notebook 7.0.6 notebook_shim 0.2.3 numpy 1.26.3 oauthlib 3.2.2 opencv-python 4.9.0.80 opt-einsum 3.3.0 overrides 7.4.0 packaging 23.1 pandas 2.2.0 pandocfilters 1.5.0 parso 0.8.3 pillow 10.2.0 pip 23.3.2 platformdirs 3.10.0 pluggy 1.0.0 ply 3.11 prometheus-client 0.14.1 prompt-toolkit 3.0.43 protobuf 4.23.4 psutil 5.9.0 pure-eval 0.2.2 pyasn1 0.5.1 pyasn1-modules 0.3.0 pycosat 0.6.6 pycparser 2.21 Pygments 2.15.1 pyOpenSSL 23.2.0 pyparsing 3.1.1 PyQt5 5.15.10 PyQt5-sip 12.13.0 PySocks 1.7.1 python-dateutil 2.8.2 python-json-logger 2.0.7 pytz 2023.3.post1 pywin32 305.1 pywinpty 2.0.10 PyYAML 6.0.1 pyzmq 25.1.0 qtconsole 5.5.0 QtPy 2.4.1 referencing 0.30.2 requests 2.31.0 requests-oauthlib 1.3.1 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rpds-py 0.10.6 rsa 4.9 ruamel.yaml 0.17.21 scikit-learn 1.4.0 scipy 1.12.0 Send2Trash 1.8.2 setuptools 68.2.2 sip 6.7.12 six 1.16.0 sniffio 1.3.0 soupsieve 2.5 stack-data 0.2.0 tensorboard 2.15.1 tensorboard-data-server 0.7.2 tensorflow 2.15.0 tensorflow-estimator 2.15.0 tensorflow-intel 2.15.0 tensorflow-io-gcs-filesystem 0.31.0 termcolor 2.4.0 terminado 0.17.1 threadpoolctl 3.2.0 tinycss2 1.2.1 tornado 6.3.3 tqdm 4.65.0 traitlets 5.7.1 truststore 0.8.0 typing_extensions 4.7.1 tzdata 2023.4 urllib3 1.26.18 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 0.58.0 Werkzeug 3.0.1 wheel 0.41.2 widgetsnbextension 4.0.5 win-inet-pton 1.1.0 wrapt 1.14.1 xgboost 2.0.3 zstandard 0.19.0 궁극적인 질문은앞으로 파이썬은 계속 업데이트가 될텐데 그때마다어디를 찾아봐야하는지 어떻게 검색해야하는지에 관해서도 알려주시면 감사하겠습니다..
-
미해결처음하는 파이썬 머신러닝 부트캠프 (쉽게! 실제 문제로 개념/활용 익히기) [데이터과학 Part2]
Bayesian Optimization LightGBM 적용
import numpy as npfrom xgboost import XGBClassifierfrom bayes_opt import BayesianOptimizationfrom sklearn.model_selection import cross_val_scorepbounds = { 'learning_rate': (0.01, 0.5), 'n_estimators': (100, 1000), 'max_depth': (3, 10), 'min_child_weight': (0, 10), 'subsample': (0.5, 1.0), 'colsample_bytree': (0.5, 1.0) # 'reg_lambda': (0, 1000), # 'reg_alpha': (0, 1.0)}def lgbm_hyper_param(learning_rate, n_estimators, max_depth, min_child_weight, subsample, colsample_bytree): max_depth = int(max_depth) n_estimators = int(n_estimators) clf = LGBMClassifier( max_depth=max_depth, min_child_weight=min_child_weight, learning_rate=learning_rate, n_estimators=n_estimators, subsample=subsample, colsample_bytree=colsample_bytree, random_state=1 # reg_lambda=reg_lambda, # reg_alpha=reg_alpha ) return np.mean(cross_val_score(clf, train_importance, train_answer, cv=5, scoring='accuracy')) # cv 도 숫자로 작성하여, 내부적으로 (Stratified)KFold 사용함optimizer = BayesianOptimization( f=lgbm_hyper_param, pbounds=pbounds, verbose=1, random_state=1)optimizer.maximize(init_points=10, n_iter=100, acq='ei', xi=0.01)에서| iter | target | colsam... | learni... | max_depth | min_ch... | n_esti... | subsample | ------------------------------------------------------------------------------------------------- [LightGBM] [Info] Number of positive: 273, number of negative: 439 [LightGBM] [Info] Auto-choosing row-wise multi-threading, the overhead of testing was 0.000185 seconds. You can set force_row_wise=true to remove the overhead. And if memory is not enough, you can set force_col_wise=true. [LightGBM] [Info] Total Bins 90 [LightGBM] [Info] Number of data points in the train set: 712, number of used features: 45 [LightGBM] [Info] [binary:BoostFromScore]: pavg=0.383427 -> initscore=-0.475028 [LightGBM] [Info] Start training from score -0.475028 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] No further splits with positive gain, best gain: -inf같은 오류가 발생합니다...
-
미해결캐글 Advanced 머신러닝 실전 박치기
LightGBM Iteration관련
안녕하세요 LightGBM Iteration관련 문의드립니다. 설명해 주신 코드로 작성하였으나 이터레이션마다 Score가 표시되지 않습니다 verbose를 100으로 설저했는데 다음과 같이만 조회됩니다.이유가 무엇일까요?LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 Early stopping, best iteration is: [902] training's binary_logloss: 0.210459 valid_1's binary_logloss: 0.242339from lightgbm import LGBMClassifierclf = LGBMClassifier( n_jobs=-1, # CPU성능 n_estimators=1000, #1000개 tree learning_rate=0.02, #학습률 낮을수록 정교함 num_leaves=32, # 가지치기 수 subsample=0.8, #활용할 sample비중 max_depth=12, #가지깊이 verbose=100, #출력메세지 최소화 early_stopping_rounds= 50, eval_metric= 'auc' )clf.fit(train_X, train_y, eval_set=[(train_X, train_y), (valid_X, valid_y)])