PYTHON
Posts
134 posts가장 쉬운 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
가장 쉬운 차분 진화 (differential evolution) [python]
가장 쉬운 차분 진화 (differential evolution) [python] import random from scipy.optimize import minimize import numpy as np def functuser(x): case=3 if case == 1: total=0. for j in range(len(x)): total+=(x[j])**2 if case == 2: # Rastrigin total=10.*len(x) for j in range(len(x)): total+=x[j]**2-10.*np.cos(2.*np.pi*x[j])
![[CV] [Comi] 'ダンダダン'(단다단) 24권. 레드 바론](https://img.zoomtrend.com/2026/06/11/1781228393-EB829CED8380.jpg)

