728x90 반응형 SMALL plotting2 [Data Science] Pandas Cheat Sheet (2) Group Data # "a" 컬럼값을 Groupby하여 "b"의 컬럼값 평균값 구하기 df.groupby(["a"])["b"].mean() # pivot_table로 평균값 구하기 pd.pivot_table(df, index="a") "a" 컬럼에 있는 값이 4가 두 개가 있기 때문에 그 값의 평균값이 적용된다. Plotting 데이터를 가지고 다양한 시각화할 수 있다. # 꺾은선 그래프 그리기 df.plot() # 막대그래프 그리기 df.plot.bar() # 밀도함수 그리기 df.plot.density() 2022. 9. 18. [XGBoost] Python Package Introduction (3) Prediction 훈련되거나 로드된 모델은 데이터 세트에 대한 예측을 수행할 수 있다. # 7 entities, each contains 10 features data = np.random.rand(7, 10) dtest = xgb.DMatrix(data) ypred = bst.predict(dtest) 훈련 중에 조기 중지가 활성화된 경우 다음을 사용하여 최상의 반복에서 예측을 얻을 수 있다 bst.best_iteration. ypred = bst.predict(dtest, iteration_range=(0, bst.best_iteration + 1)) Plotting 플로팅 모듈을 사용하여 중요도 및 출력 트리를 그릴 수 있다. 중요도를 표시하려면 xgboost.plot_importance()를 사.. 2022. 5. 9. 이전 1 다음 728x90 반응형 LIST