본문 바로가기

전체 글

(15)
tmux / tqdm 사용법(중단없이 멀티태스킹/진행률 프로그레스바_progress bar) 평소에 오래 걸릴만한 코드를 실행하지 않아서 사용하지 않았지만, 터미널에서 변화를 보이지 않아서 언제 끝날지도 모르겠고 실행이 되는 중인지 확인하기도 어려워서 for문에 tqdm을 넣어봤다. tqdm python에서 tqdm 라이브러리를 이용해 작업진행률을 확인할 수 있다. 필자는 tqdm을 쓰지 않고 코드 중간 중간 def run_successrates(self, version1, top_k): dataframe = self.get_df_wo_header() all_success_rates = list() for i in range(1, top_k + 1): try: success_rate = self.get_success_rates(i, dataframe) except KeyError: success..
[plt]scatter_plot(데이터 시각화: 파이썬 matplotlib을 활용한 예시) 오늘은 matplotlib을 사용해서 scatterplot을 그려보는 방법을 정리해보려함! 저번 주는 논문 figure 만드느라 바빴다. import matplotlib.pyplot as plt 일단 matplotlib import해오고 sample_list = [1.2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,10] scatter 그릴 sample을 list로 만든다. def scatter_plot(list): plt.scatter(range(len(sample_list)), sample_list, s=10, alpha=0.9) plt.xlabel("sample Index") plt.ylabel("size") plt.title("sample size") plt.sh..
google drive 구글드라이브를 코랩에 로딩(colab load)하기 from google.colab import drive drive.mount('/content/drive') colab을 사용할 때 외부 파일을 활용해야하는 때가 있다. 이해하기 쉬운 UI를 활용한 방법은 다음과 같다. 코랩 왼쪽 바에 윈도우 폴더 이미지와 같은 아이콘을 클릭한다. 클릭하면 sample_data가 있다. 빨간색으로 표시한 ↑ 위로 올리는 기호를 클릭하면 세션 저장소에 업로드할 수 있다. 또 다른 방법으로는 Google drive를 colab notebook으로 연결(mount) 시키는 방법 from google.colab import drive drive.mount('/content/drive') 위의 코드를 코랩에서 실행하면 다음과 같은 멘트가 나온다. "노트북에서 Google Driv..