[Dear abby] 230205
·
영어 공부 English Study/글 Article
Older Sister Can't Keep Politics Out of Friendly Visits DEAR ABBY: My older sister visits me every week to play cards and chat. While I love her dearly and enjoy her visits, sometimes I do not appreciate one topic she brings up. We are on different ends of the political spectrum. Although I never initiate a conversation about the candidate she voted for in the last election, she never misses an ..
[Dear abby] 230204
·
영어 공부 English Study/글 Article
One-Night Stand Leads to Awkward Social Situation DEAR ABBY: During a trip to Las Vegas, I kind of had a one-night stand. I'm in a relationship. I felt bad afterward. Problem is, I started having feelings for this guy, "Leo." We would message back and forth, more on my end than his. I guess you could say I was hung up on him. I have since mended my relationship with my partner. My issue is, Leo ..
[MATLAB] MATLAB에서 figure를 pdf로 export하기 (exportgraphics)
·
프로그래밍 Programming/매트랩 MATLAB
1. Figure를 pdf로 저장하는 방법 MATLAB에서 일반적인 저장 방법을 이용해서 pdf를 export하면 다음과 같은 문제가 발생한다. 파일을 열어보면 a4 용지에 떨렁 그림이 그려져 있는 것을 확인할 수 있다. 실제 이 파일을 LaTeX에 쓰고 싶거나 하면 저 A4 용지 크기 그림이 그대로 들어가기 때문에 곤란하다. 그렇다고 png를 쓰자니 화질 때문에 걱정이 될 것이다. 원래 MATLAB은 이렇게 pdf로 export하는 문제가 있었는데 2020년부터인가 새로운 함수를 만들어주었다. https://kr.mathworks.com/help/matlab/ref/exportgraphics.html 위 링크에 들어가서 알 수 있는 것은, 이제 pdf를 손쉽게 저장할 수 있다는 것이다. ax1 = fi..
[LaTeX] subcaption에서 numbering 형식 바꾸기
·
기타/논문작성 Writing
subcaption package를 쓰면 subfigure에 대해서 numbering이 (a),(b).. 이런 식으로 설정된다. 다음 예시와 같다. 그러나 나는 a) 와 같이 numbering을 하고 싶을 수도 있고, 1) 이렇게 하고 싶을 수도 있다. 기본적으로 subcaption은 () 이렇게 parenthesis가 default로 설정되어있다. 그래서 아래와 같이 labelformat = simple로 설정을 해놔야 이 괄호를 없앨 수 있다. \usepackage[labelformat=simple]{subcaption} \renewcommand{\thesubfigure}{\normalsize \alph{subfigure})} 또한 위의 \renewcommand{\thesubfigure} 안에 본인이..
[LaTeX] 캡션 정렬 방법
·
기타/논문작성 Writing
캡션 정렬 방법 필자는 subfigure를 위해 package subcaption을 사용한다. 아래와 같이 설정하면 subcaption과 caption 모두 왼쪽으로 정렬된다. \usepackage{caption} \captionsetup{justification=raggedright,singlelinecheck=false} figure 캡션은 그대로 두고 subfigure 캡션만 왼쪽 정렬하고 싶은 경우에는 subcaption의 옵션을 바꿔서 설정한다. \usepackage[skip=0.5ex, belowskip=1ex, singlelinecheck=off]{subcaption}
[논문작성] 논문에서 영문이름에 대하여
·
기타/논문작성 Writing
이름은 크게 3가지로 나눌 수 있다. 성 : last name, family name, surname 이름 : first name, given name (optional) 중간 이름 : middle name 외국 몇몇 나라는 중간 이름도 쓰기 때문에 맨 처음에 나오는 이름이 first name, 중간에 나오는 이름이 middle name, 나중에 나오는 이름이 last name으로 불린다. 보통 표기 방법도 이름 - 중간 이름 - 성 순서대로 진행된다. 그런데 이 전체 이름을 줄여서 말할 때는 성 - 이름 앞 글자 이런 식으로 적으니까 헷갈리는 것이다. 예를 들어 논문에서 다음과 같이 이름이 표기되어있다. 그러면 Lishuai는 이름이고 Li가 성이다. (중국인의 경우 Li라는 성이 많다.) 그래서 논문..
[Matplotlib] legend 그림 바깥에 배치/원하는 위치에 배치
·
프로그래밍 Programming/파이썬 Python
Matplotlib에서 그림을 그릴 때 legend를 바깥에 배치하고 싶을 수 있다. 이 경우에는 legend의 bbox_to_anchor를 이용하면 된다. matplotlib 공식 문서를 보면 다음과 같이 나와있다. 설명 자체는 간단하다. 4개 원소 튜플로 넣으면 legend의 x,y,너비,높이까지 지정할 수 있다. 2개 원소 튜플로 넣으면 x,y 위치를 지정할 수 있다. 다음과 같은 그림이 있다고 하자. import numpy as np import matplotlib.pyplot as plt x = np.array(range(10)) y1 = x * x y2 = x plt.plot(x,y1,label='quadratic function') plt.plot(x,y2, label='linear func..
[Matplotlib] Matplotlib 폰트 스타일 바꾸기
·
프로그래밍 Programming/파이썬 Python
Matplotlib에서 figure에 사용되는 font를 보면 Dejavu sans라는 폰트라는데 위와 같은 폰트를 말한다. 실제 그림을 그리면 x, y축이 다음과 같은 폰트로 나온다. (아래 코드에서 mpl.rcParams는 default 옵션인데 자세한 내용은 matplotlib의 디폴트 속성 글을 보면 나와있다.) import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams['legend.fontsize'] = 16 mpl.rcParams['figure.titlesize'] = 18 mpl.rcParams['axes.titlesize'] = 18 mpl.rcParams['lines.linewidth']..
[PyTorch] 특정 조건에 맞는 텐서 출력/인덱싱 등
·
프로그래밍 Programming/파이썬 Python
데이터 안에 이상한 값이 없는지는 확인하고 싶을 때가 있다. 데이터가 이상하면 당연히 결과도 이상하기 때문이다. 넘파이의 경우에는 아래와 같이 where함수를 쓰면 인덱스를 리턴한다. print(np.where(np.isnan(data)==True)) >>(array([], dtype=int64), array([], dtype=int64)) 위 경우는 내부에 nan이 없기 때문에 빈 array를 return한다. a = np.array([np.nan, 1, 2, 3]) print(np.where(np.isnan(a)==True)) >> (array([0], dtype=int64),) 만약 다음과 같이 nan이 들어있다면 그 값이 있는 index를 리턴한다. 이 때 튜플을 return한다는 점에 주의해야한..
[PyTorch] retain_graph = True라고 했음에도 backward 문제가 발생하는 경우
·
연구 Research/인공지능 Artificial Intelligent
RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward. 위와 같은 에러는 한 번 모델에서 for..