가장 쉬운 국소 최소화 [python]
By Imagination is more important than knowledge (지식보다 상상) | 2019년 11월 26일 |
가장 쉬운 국소 최소화 [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
[Ubuntu] docker 이미지 build 시 DNS resolve 문제
By 지훈현서 | 2020년 11월 29일 |
Ubuntu 18.04 Desktop 버전에서 docker 를 설치하고,배치 작업으로 apt-get install 작업을 하려고 하는데, 위와 같이 "Temporary failure resolving 'deb.debian.org'" 와 같은 오류가 나옵니다.분명히 우분투 안에서는 아무런 이상이 없습니다. 구글링을 해 보니, $ docker run busybox nslookup google.comUnable to find image 'busybox:latest' locallylatest: Pulling from library/busybox5f5dd3e95e9f: Pull completeDigest: sha256:9f1c79411e054199210b4d489ae600a061595967adb643cd923f
가장 쉬운 출력문 [f-string in python 3.6]
By Imagination is more important than knowledge (지식보다 상상) | 2019년 11월 19일 |
가장 쉬운 출력문 [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