일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- 오라클
- 빅분기
- 머신러닝
- 실기
- python3
- Python
- SQL
- matplotlib
- 카카오
- 프로그래머스
- 실습
- oracle
- 빅데이터 분석 기사
- seaborn
- 파이썬
- Numpy
- Kaggle
- sklearn
- pandas
- 알고리즘
- Oracel
- R
- level 2
- 튜닝
- level 1
- 코딩테스트
- 데이터 분석
- Today
- Total
목록Python (164)
라일락 꽃이 피는 날
LinearRegression from sklearn.linear_model import LinearRegression model = LinearRegression(n_jobs=-1) model.fit(x_train, y_train) pred = model.predict(x_test)
MSE(Mean Squared Error) 예측값과 실제값의 차이에 대한 제곱에 대하여 평균을 낸 값 MAE (Mean Absolute Error) 예측값과 실제값의 차이에 대한 절대값에 대하여 평균을 낸 값 RMSE (Root Mean Squared Error) 예측값과 실제값의 차이에 대한 제곱에 대하여 평균을 낸 뒤 루트를 씌운 값 평가 지표 함수로 만들기 import numpy as np pred = np.array([3, 4, 5]) actual = np.array([1, 2, 3]) def my_mse(pred, actual): return ((pred - actual)**2).mean() my_mse(pred, actual) # 4.0 def my_mae(pred, actual): retur..
오차 (Error) from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split cancer = load_breast_cancer() data = cancer['data'] target = cancer['target'] (0-악성종양, 1-양성종양) feature_names=cancer['feature_names'] df = pd.DataFrame(data=data, columns=feature_names) df['target'] = cancer['target'] pos = df.loc[df['target']==1] neg = df.loc[df['target']==0] 양성 환자 357..
1. Logistic Regression 로지스틱 회귀는 독립 변수의 선형 결합을 이용하여 사건의 발생 가능성을 예측하는데 사용되는 통계 기법이다. 서포트 벡터 머신(SVM)과 같은 알고리즘은 이진 분류만 가능하다. (2개의 클래스 판별만 가능) 3개 이상의 클래스에 대한 판별을 진행하는 경우, 다음과 같은 전략으로 판별한다. ① one-vs-rest(OvR) K개의 클래스가 존재할 때 1개의 클래스를 제외한 다른 클래스를 K개 만들어, 각각의 이진 분류에 대한 확률을 구하고 총합을 통해 최종 클래스를 판별한다. ② one-vs-one(OvO) 4개의 계절을 구분하는 클래스가 존재한다고 가정했을 때, 0vs1, 0vs2, 0vs3, ... , 2vs3 까지 NX(N-1)/2개의 분류기를 만들어 가장 많이..
데이터 셋 (dataset) DESCR: dataset 정보 data: feature data feature_names: feature data의 컬럼 이름 target: label data (수치형) target_names: label의 이름 (문자형) from sklearn.datasets import load_iris iris = load_iris() data = iris['data'] feature_names = iris['feature_names'] target = iris['target'] 데이터프레임 생성 df_iris = pd.DataFrame(data, columns=feature_names) df_iris['target'] = target train / validation 세트 나누기 ..
전처리 (pre-processing) 데이터를 분석에 적합하게 가공/변형/처리/클리닝 train / validation 세트 나누기 feature와 label을 정의한 후, 적절한 비율로 train / validation set을 나눈다. feature = ['Pclass', 'Sex', 'Age', 'Fare'] label = ['Survived'] test_size: validation set에 할당할 비율 (20% → 0.2) shuffle: 셔플 옵션 (기본:True) random_state: 랜덤 시드값 from sklearn.model_selection import train_test_split x_train, x_valid, y_train, y_valid = train_test_split(t..
scikit-learn https://scikit-learn.org/stable/ scikit-learn: machine learning in Python — scikit-learn 0.24.2 documentation Model selection Comparing, validating and choosing parameters and models. Applications: Improved accuracy via parameter tuning Algorithms: grid search, cross validation, metrics, and more... scikit-learn.org from sklearn.linear_model import LinearRegression 모델 선언: model = Li..
5. violinplot 바이올린처럼 생겨서 violinplot이다. column에 대한 데이터의 비교 분포도를 확인할 수 있다. 곡선 진 부분(뚱뚱한 부분)은 데이터의 분포를 나타내고, 양쪽 끝 뾰족한 부분은 데이터의 최솟값과 최댓값을 나타낸다. 비교 분포 확인 x, y축을 지정해줌으로썬 바이올린을 분할하여 비교 분포를 볼 수 있다. 가로로 뉘인 violinplot hue 옵션으로 분포 비교 단일 column에 대한 바이올린 모양의 비교를 할 수 있다. split 옵션으로 바이올린을 합쳐서 볼 수 있다. 6. lmplot lmplot은 column 간의 선형관계를 확인하기에 용이한 차트다. 또한, outlier도 같이 짐작해 볼 수 있다. hue 옵션으로 다중 선형관계 그리기 col 옵션을 추가하여 그..