ML : Prior Posterior
Prior, Posterior 구분하기 import numpy as np from matplotlib import pyplot as plt from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import (RBF, Matern, RationalQuadratic, ExpSineSquared, DotProduct, ConstantKernel) kernels = [1.0 * RBF(length_scale=1.0, length_scale_bounds=(1e-1, 10.0)), 1.0 * RationalQuadratic(length_scale=1.0, alpha=0.1), 1.0 * Ex..
2020. 5. 29.
ML : sklearn : PolynomialFeatures
다항 변환 PolynomialFeatures은 "입력값 x를 다항식으로 변환한다." x→[1,x,x2,x3,⋯] 만약 열의 갯수가 두 개이고 2차 다항식으로 변환하는 경우에는 다음처럼 변환한다. [x1,x2]→[1, x1, x2, x1**2, x2**2, x1x2] 다음과 같은 입력 인수를 가진다. degree : 차수 interaction_only: True면 제곱은 빼고, 서로x끼리 상호작용하는만큼 (x1x2, x2x3 --- ) include_bias : 상수항 생성 여부 from sklearn.preprocessing import PolynomialFeatures from sklearn.preprocessing import PolynomialFeatures X = np.arange(6).resha..
2020. 5. 22.
DL : input, output, y_train shape/Keras에서 주의할 점
딥러닝은 애초에 행렬의 연산들이 모여있기 때문에, 내가 input을 하는 것의 shape가 뭔지? output의 shape가 뭔지? 이 두가지의 shape가 맞지 않는다면 계속 error가 난다. cnn = keras.Sequential([ keras.layers.Dense(320, activation='relu'), keras.layers.Dropout(.2), keras.layers.Dense(160, activation='relu'), keras.layers.Dense(80, activation='relu'), keras.layers.Dropout(.2), keras.layers.Dense(64, activation='relu'), keras.layers.Dense(32,activation='rel..
2020. 5. 19.