PYTHON

포스트: 124|조회수: 0|TERM
Items

Posts

124 posts

가장 쉬운 베이지안 옵티마이제이션 [Python]

가장 쉬운 베이지안 옵티마이제이션http://incredible.egloos.com/7461939 매우 복잡한 문제에 적용할 수 있는 아주 일반적인 최적화 알고리듬은 아니지만, 적당한 크기의 문제에 대해서 좋은 최적화 방법이라고 볼 수 있다. 특히, 기계학습의 경우, hyperparameter 최적화에 활용되고 있다. 특히 이 문제의 크기와 베이지안 옵티마이제이션는 궁합이 잘 맞는 경우라고 볼 수 있다.목적함수 계산을 너무 많이 할 수 없을 경우에 적절한 방법으로 알려져 있다. --------------------------------------------------------------------------------------------------------------------- from baye

가장 쉬운 XGBoost 모델 [분류, 회귀]

가장 쉬운 XGBoost 모델 [분류, 회귀]Keras를 활용한 딥러닝 문제를 풀 경우: # First XGBoost model for Pima Indians dataset from numpy import loadtxt from xgboost import XGBClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_scorefrom matplotlib import pyplot # load data dataset = loadtxt('pima-indians-diabetes.csv', delimiter=",") # split data into X and y

가장 쉬운 국소 최소화 [python]

가장 쉬운 국소 최소화 [python] 목적함수의 일차 도함수를 알수 있는 경우, 해석적으로 알 수 있는 경우, 국소 최소화는 아주 빨리 마무리 될 수 있다.일차 도함수가 알려지지 않은 경우, 별도의 알고리듬을 활용한다. import numpy as npfrom scipy.optimize import minimizedef rosen(x): """The Rosenbrock function""" return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)def rosen_der(x): xm = x[1:-1] xm_m1 = x[:-2] xm_p1 = x[2:] der = np.zeros_like(x) der[1:-1

가장 쉬운 출력문 [f-string in python 3.6]

가장 쉬운 출력문 [f-string in python 3.6]파이썬 출력의 새로운 유형, f-string. f-string을 활용하면 파이썬에서 출력이 보다 더 편리할 수 있다.또한, 출력에 소모되는 시간도 줄일 수 있다. 파이썬 2.x 시대는 지나가고 있다. 파이썬 3.6 시대가 도래했다. f-stringThe f in f-strings may as well stand for “fast.” # notice that it adds spaces to reach the number of characters specified by widthIn [1]: f'{1 + 3 * 1.5:10.3f}'Out[1]: ' 5.500'# notice that it uses more characters than