[Dear abby] 230305
·
영어 공부 English Study/글 Article
Friend's Struggle With Diabetes Causes Concern DEAR ABBY: My best friend, who is 54, has had Type 1 diabetes since she was 9. She takes two insulin shots a day -- one in the morning and one in the evening. We live together, and at night her blood sugar drops pretty low. I can tell when it's happening because she becomes unresponsive. Twice she has had seizures that resulted in 911 calls. I have ..
[서지관리프로그램] ENDNOTE/Mendeley/Zotero
·
기타/논문작성 Writing
1. 서지관리프로그램이란? 대학원생이라면 접하는 구글 스칼라. 이 구글 스칼라에서 인용을 클릭하면 다음과 같은 화면을 볼 수 있다. BibTeX는 LaTeX에서 참고문헌을 추가할 때 쓰는 형식이다. 예를 들면 이런 것. @book{barro1997macroeconomics, title={Macroeconomics}, author={Barro, Robert J}, year={1997}, publisher={MIT Press} } EndNote는 endnote에 호환되는 파일이고 RefMan은 Mendeley에 호환되는 파일(ris파일인데 다른 서지 관리 프로그램 모두에게 적용 가능)이고 RefWorks는 RefWorks에 직접 export한다. 참고로 구글스칼라에서 export한 파일을 전적으로 신뢰하면 ..
[AI] Sampyl에 대한 간단한 설명
·
연구 Research/인공지능 Artificial Intelligent
Sampyl이라는 라이브러리를 사용하기 전에 간단한 예제가 있어서 posterior distribution과 sampler에 대한 tutorial을 좀 정리해보았다. $\begin{aligned} & Y \sim N\left(\mu, \sigma^2\right) \\ & \mu=\beta_0+\beta_1 x_1+\beta_2 x_2\end{aligned}$ 다음과 같이 $\beta$가 계수의 어떤 y와 x 간의 모델이 있다고 해보자. 이 문제에서는 $\beta=[2,1,4]$인 경우이다. 따라서 아래와 같이 $x_{0}=1, x_{1},x_{2}$에 대하여 $y$가 분포되어있다. # Number of data points N = 200 # True parameters sigma = 1 true_b = ..
[PyTorch] 개별 파라미터 learning rate 다르게 설정 및 learning rate 확인
·
연구 Research/인공지능 Artificial Intelligent
코드 안에 네트워크가 2개가 있고 이 2개의 네트워크를 각각 다른 learning rate로 학습하고 싶을 때 사용하는 코드다. 아래와 같이 개별로 learning rate를 설정하면 net2 안에 있는 파라미터는 0.001로 학습되고 net1 안에 있는 파라미터는 0.01로 학습된다. optimizer = optim.Adam([ {'params': func.net1.parameters()}, {'params': func.net2.parameters(), 'lr': 0.001} ], lr=0.01) optimizer.param_groups[0]['capturable'] = True print(optimizer.param_groups[0]['lr']) print(optimizer.param_groups[1..
[MATLAB] Figure 위치를 코드로 옮기기
·
프로그래밍 Programming/매트랩 MATLAB
figure를 여러 개 그릴 때 figure가 겹쳐있어서 일일이 다 옮겨줘야하는 불편함이 있었다. 이 경우에 사용할 수 있는 함수가 movegui라는 함수이다. figure 핸들을 받아서 f = figure(1); movegui(f, 'south'); 와 같이 해도 되고 figure 핸들을 받지 않더라도 movegui(방향)만 사용하면 현재 figure 또는 콜백 figure를 옮겨준다. 예: movegui(f,[150 -50]) 예: movegui('west') 위의 같은 형태로 위치를 지정할 수 있다. 1. 직접 위치 지정 (이는 원래 figure 생성할 때도 수행할 수 있다) [x y]의 경우네는 x위치, y위치를 지정하는 것이다. x위치는 화면 왼쪽으로 부터 얼마나 떨어졌는지를 나타내고 y위치는 ..
[SciPy] ValueError: One of the requested xi is out of bounds in dimension 0
·
기타
scipy에 있는 scipy.interpolate.RegularGridInterpolator를 쓸 때 발생했던 오류이다. 코드를 좀 살펴보면 내가 interpolation하기 위해 넣은 값이 내삽을 위해 지정된 값 범위에서 벗어날 때 return하는 오류이다. 예를 들어 나는 x=[0,1,2,3,4]일 때의 y값을 넣어놨는데 만약 x=5.5값을 넣으면 범위 밖에 벗어나므로 처리할 수 없다. ValueError: One of the requested xi is out of bounds in dimension 0 나의 경우에는 내가 x값을 잘못 넣었기 때문에 이런 일이 일어난 거지만 만약 외삽(extrapolate)을 원하는 경우라면 다음과 같이 bounds_error = False로 지정하고 fill_va..
[Dear abby] 230207
·
영어 공부 English Study/글 Article
Grandparents Make Little Effort To See Grandkids DEAR ABBY: I'm 33 with a wonderful husband and amazing kids, ages 4 and 6. I have a close bond with my parents. We live in a city about 80 miles from them. It seems like we are always the ones to do the visiting, and I have to practically beg them to visit me for one overnight visit a year. My house is smaller than theirs, but we offer up our bedr..
[에러기록] ImportError: cannot import name 'index_update' from 'jax.ops'
·
기타
from jax.ops import index_update, index = index_update(, index[], ) % example u = index_update(u, index[0, :], g(t)) 다음 코드를 실행할 때 발생하는 문제이다. JAX 0.3.2부터는 jax.opt.index_update, jax.opt.index가 사라졌기 때문에 이 기능을 쓰기 위해서는 jax와 jaxlib을 0.3.2 버전 전으로 돌려야 한다. 혹은 저 위의 기능은 특정 인덱스에 배열 값을 바꾸는 코드이기 때문에 x = x.at[idx].set(y) 와 같이 특정 인덱스에 y라는 값으로 바꾸는 코드로 바꿔줄 수 있다.
[JAX] Windows에서도 JAX 사용하기
·
연구 Research/인공지능 Artificial Intelligent
JAX는 아직 리눅스에서밖에 사용이 안된다. 그래서 윈도우에서 돌릴 수 있는 방법을 찾아보았는데 최신 버전은 불가능하고 예전 버전은 가능하다. JAX가 아직 초기이다보니 버전마다 많이 바뀌어서 불편한 점이 있지만 일단 시도한 경험을 공유한다. 아래 링크를 들어가면 대략적인 instruction을 알 수 있다. https://github.com/cloudhan/jax-windows-builder GitHub - cloudhan/jax-windows-builder: A community supported Windows build for jax. A community supported Windows build for jax. Contribute to cloudhan/jax-windows-builder deve..
[에러기록] assertionerror: if capturable=false, state_steps should not be cuda tensors.
·
연구 Research/인공지능 Artificial Intelligent
pytorch 안에서 adam을 쓸 때 자꾸 위와 같은 에러가 떠서 이를 위해 optimizer = optim.Adam(func.parameters(), lr=args.lr) optimizer.param_groups[0]['capturable'] = True 다음과 같이 'capturable'을 true로 바꿔줘야했다. 그런데 다른 사람들의 라이브러리를 쓰다보면 optimizer가 라이브러리 안에 포함되어있어서 위와 같은 코드를 넣어주기 힘든 경우가 발생했다. 따라서 아래와 같이 가상환경 안에 있는 코드에 접근하여서 에러가 나는 부분을 주석처리해주었다. 이렇게 하는 이유는 실제로 위의 error가 코드 성능에 악영향을 미치지 않기 때문이다. params 및 state_steps이 CUDA tensor일 ..