본문 바로가기

전체 글346

Numpy : from itertools import product from itertools import product from itertools import product X = np.array([[1.50,2],[1.60,2],[1.70,2], [1.80,2], [2.00,2], [2.20, 2], [2.50,2], [2.80,2],[3.00,2], [3.30,2], [3.60,2], [5.00,2], [1.50,1],[1.60,1],[1.70,1], [1.80,1], [2.00,1], [2.20, 1], [2.50,1], [2.80,1],[3.00,1], [3.30,1], [3.60,1], [5.00,1], [1.50,3],[1.60,3],[1.70,3], [1.80,3], [2.00,3], [2.20, 3], [2.50,3], [2.80,3],[3.00,3], .. 2020. 6. 4.
Numpy : np.linspace (구간에 점 만들기) numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0) Return evenly spaced numbers over a specified interval. Returns num evenly spaced samples, calculated over the interval [start, stop]. The endpoint of the interval can optionally be excluded. Changed in version 1.16.0: Non-scalar start and stop are now supported. 처음 start, stop을 지정해주고 num을 적어주면, 그 숫자만큼 구간에서 점을 .. 2020. 6. 4.
Matplotlib : 3차원 그래프 그리기 Data 생성하기 from itertools import product import numpy as np from matplotlib import pyplot as plt import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C import math np.random.seed(1) # ---------------------------------------------------------------------- # .. 2020. 6. 4.
Python : 반올림, 올림, 내림 반올림 : round(실수, n) >>> n = 7/15 >>> n 0.4666666666666667 >>> round(n,2) 0.47 >>> round(n,4) 0.4667 >>> round(n) 0 >>> type(round(n)) 정수도 -를 사용해서 반올림 가능하다. >>> round(12345,-1) 12340 >>> round(12345,-2) 12300 올림, 내림 : math.ceil, math.floor import math >>> math.ceil(12.2) 13 >>> math.floor(12.2) 12 출처 : https://dpdpwl.tistory.com/94 [Python]파이썬 자리수 조절(소수점,올림,반올림) 실수를 표현할때, 자리수를 원하는대로 조절하고, 정수의 올림 반.. 2020. 6. 4.
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.
Python : package 에서 상위 모듈 import 하기. 다음과 같은 dir 구조를 가지고 있다고 해보자. 1. os, sys module로 상위 dir import 하기 import os, sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) """ ['C:\\Users\\ADmin\\anaconda3\\envs\\text\\project\\text_mining', 'C:\\Users\\ADmin\\anaconda3\\envs\\text\\python36.zip', 'C:\\Users\\ADmin\\anaconda3\\envs\\text\\DLLs', 'C:\\Users\\ADmin\\anaconda3\\envs\\text\\lib', 'C:\\Users\\ADmin\.. 2020. 5. 19.
양자역학 : 양자역학이 왜 생겼을까? Quantum Mechanics 양자역학... 진짜 대학교 2학년 때, 물리화학을 처음 들었지만, 내게 너무 어려운 양자역학... 양자역학을 모두 이해한 사람은 아무도 없을 것이다. - 리처드 파인만 이번에 양자역학은 대학원 수업 중, 표면화학 수업에서 Scanning Tunneling Machine, STM 관련 강의를 하셨다. 그 때 사용되는 tunneling 현상의 원안을 설명하셨다. 원자 전자 얘기를 하자면, 돌턴의 원자설부터 난 기억이 난다. 원자란, 쪼개지지 않는 가장 작은 입자로써 알고 있었다. 하지만 이 원자라는 개념은 후에 원자핵과 전자로 세분화해서 볼 수 있다고 말할 수 있다. 전자는 입자일까? 따라서 우리가 아는 전자는 흔히 입자로 알려져있다. 우리는 전자기 복사, 즉, 빛의 입자를 .. 2020. 5. 16.
Linux : WSL에 ZSH 설치 + agnoster + multiline WSL WSL은 window subsystem linux 를 말하며, cmd 밖에 이용하지 못하는 windows 유저들에게 linunx 커널을 쓰게 해준다는 것은 정말 신의 한수이다. 마치 windows 를 잘만하면 linux 처럼 사용이 가능하다. (물론 난 우분투가 좋다....ㅎㅎ) ZSH 설치 sudo apt-get install zsh ZSH 기본 shell로 변경 chsh -s /usr/bin/zsh ZSH 설정 재부팅 후 terminal을 열면, 다음과 같은 창이 뜬다. 나는 (2)을 눌렀다. 직접 설정하려면 (1)을 설정하도록 한다. oh-my-zsh 설치하기 sudo apt install curl sh -c "$(curl -fsSL https://raw.github.com/robbyruss.. 2020. 5. 13.
linux : WSL 에서 apt 망가짐 갑자기 위에처럼 뭐가 떴다... cd /etc/apt/apt.conf.d/ grep -r snap # Delete the script. In may case it was: sudo rm 20snapd.conf 위에 cmd로 해결 2020. 5. 13.
Web : semantic 하게 웹을 짠다는 것. Semanitc? semantic이란 의미론적 이라는 뜻이다. 즉, 웹을 semantic하게 짠다는 것은 HTML이 의미를 담고 있다는 것이다. 따라서 HTML을 보고 이게 어떤 의미인지 알기 위해서는 각 element에 의미에 맞게 HTML을 작성해줘야한다. Example 와 태그를 보면 어떤 것이 paragraph를 의미하는 것인가? 자세히 보지 않더라도 p 태그가 paragraph를 나타내는 것을 우리는 알 수 있다. 하지만 OOCSS를 사용하려면, div 태그로 감싸주는 것이 좋다. 그렇다면 여기에 어떻게 의미를 부여할 것인가?? 이것에 대한 해답이 바로 semantci 하게 웹을 짜는 것이다. 1. main : --- 페이지의 main content를 나타낸다. 한 번만 쓴다. 2. header.. 2020. 5. 12.