├── .gitignore ├── computer_science ├── algorithm │ ├── euclid.md │ ├── hash.md │ ├── list.md │ ├── search.md │ ├── backtracking.md │ ├── binarytree.md │ ├── dynamic_programming.md │ ├── sort.md │ └── README.md ├── machine_learning │ ├── optimize.md │ ├── evaluate.md │ ├── weight_decay.md │ ├── autoencoder.md │ ├── auto_ml.md │ ├── pca.md │ ├── rnn.md │ ├── cuda.md │ ├── ml_conf.md │ ├── ai_hype.md │ ├── lstm-variation.md │ ├── time_series.md │ ├── study_resources.md │ ├── quantile.md │ ├── speedup.md │ ├── batch_normalization.md │ ├── evolutionary_programming.md │ ├── facebook-prophet.md │ ├── linear_regression.md │ ├── nlp_keyword_extraction.md │ ├── scaler.md │ ├── dropout.md │ ├── pytorch_internals.md │ ├── ml_flow.md │ ├── pytorch_tensorboard.md │ ├── oop_in_ml.md │ ├── conjugate.md │ ├── recall.md │ ├── ICML.md │ ├── pytorch_datasets.md │ ├── reinforcement_learning.md │ ├── dl_with_pytorch.md │ ├── heuristic.md │ ├── pytorch_loss_func.md │ ├── nlp_parsing.md │ ├── parameter_search.md │ ├── pytorch.md │ ├── deep_learning.md │ ├── hyperparamer.md │ ├── kernel.md │ ├── svr.md │ ├── gpu.md │ └── pytorch_dataloader.md ├── cryptography │ ├── ch6_DES.md │ ├── ch1_intro.md │ ├── ch4_mathematics_cryptography.md │ ├── ch9_math_of_crypto.md │ ├── ch5_modern_symmetric_key_ciphers.md │ └── ch3_symmetric_key_ciphers.md ├── python │ ├── readme.md │ ├── reading-materials.md │ ├── pep448.md │ ├── visualization.md │ ├── random.md │ ├── xmode.md │ ├── exceptions.md │ ├── sys.md │ ├── series.md │ ├── cache.md │ ├── class.md │ ├── timestamp.md │ ├── list.md │ ├── dataframe.md │ ├── super.md │ ├── multiprocessing.md │ ├── recursionlimit.md │ ├── dictionary.md │ ├── mutability.md │ ├── pdb.md │ ├── metaclass.md │ ├── numpy.md │ └── venv.md ├── dmg.md ├── README.md ├── automata │ ├── pda.md │ ├── reduction.md │ ├── NP.md │ └── automata.md ├── computer_architecture │ ├── ch4_vector_processors.md │ ├── ch3_limits_to_ILP_and_multithreading.md │ ├── README.md │ ├── ch2_processor_technology.md │ └── ch1_computer_architecture_review.md ├── shell │ ├── version.md │ ├── powershell.md │ ├── bashrc.md │ └── shell_assign.md ├── math │ ├── spectral_decomposition.md │ ├── eigenv.md │ ├── distribution.md │ ├── relation.md │ ├── math_markdown.md │ ├── statistics.md │ ├── covariance.md │ └── mathematical_statistics.md ├── port-forward.md ├── dism.md ├── bit_manipulation.md ├── OOP.md ├── resource_monitor.md ├── tex.md ├── server │ ├── linux_time.md │ ├── curl.md │ ├── hosts.md │ ├── rm.md │ ├── get-process.md │ ├── yum.md │ ├── install_python3_on_centos7.md │ └── iperf.md ├── nvidia-smi.md ├── docker-basic.md ├── git │ ├── remote_add.md │ └── git_user.md ├── doi.md ├── eps.md ├── aws_mysql.md ├── uri.md ├── apache_errorlog.md ├── papers.md ├── docker_useful.md └── conda.md ├── questions.md ├── today ├── 18-03-15.md ├── 19-04-08.md ├── the-gardeners-season-7.md ├── 18-04-04.md ├── 19-05-22.md ├── 19-03-19.md ├── 18-03-16.md ├── 18-03-28.md └── 18-01-11.md ├── interest ├── jpop │ ├── README.md │ └── hoshino_gen.md ├── developer_culture │ ├── developer_relations.md │ └── coc.md ├── my_reading_style.md ├── mental_health.md ├── ta_english.md ├── keywords.md ├── euthanasia.md └── newsletters.md ├── finance ├── momentum.md ├── long-short.md ├── terms-stock.md ├── etf.md ├── fama-french.md ├── measurement.md ├── maximum_drawdown.md ├── finance-resources.md ├── smart_beta.md └── terms.md ├── book ├── quantitative_investment.md ├── this_or_that.md ├── hataraki_kata.md ├── smoke_gets_in_your_eyes.md ├── readme.md ├── educated.md ├── care_therapy.md ├── the_circadian_code.md └── addiction_procrastination_and_laziness.md ├── README.md └── bowoo.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /computer_science/algorithm/euclid.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/algorithm/hash.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/algorithm/list.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/algorithm/search.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /questions.md: -------------------------------------------------------------------------------- 1 | - Pythonic code란? 2 | -------------------------------------------------------------------------------- /computer_science/algorithm/backtracking.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/algorithm/binarytree.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/algorithm/dynamic_programming.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /computer_science/machine_learning/optimize.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch6_DES.md: -------------------------------------------------------------------------------- 1 | # Data Encryption Standard (DES) 2 | -------------------------------------------------------------------------------- /computer_science/python/readme.md: -------------------------------------------------------------------------------- 1 | https://github.com/microsoft/c9-python-getting-started 2 | -------------------------------------------------------------------------------- /computer_science/dmg.md: -------------------------------------------------------------------------------- 1 | ### 오늘의 깨달음 2 | 3 | ### dmg 4 | ```dmg``` 파일은 **disk image**의 줄임말이었다. 5 | -------------------------------------------------------------------------------- /today/18-03-15.md: -------------------------------------------------------------------------------- 1 | 오늘의 넋두리 2 | : 2.2단원 읽고 있는데 support vector machine은 7.3단원에나 가야 나온다...! 3월안에 다 읽을 수 있겠지...! 3 | -------------------------------------------------------------------------------- /computer_science/python/reading-materials.md: -------------------------------------------------------------------------------- 1 | **python antipatterns** 2 | https://docs.quantifiedcode.com/python-anti-patterns/index.html 3 | -------------------------------------------------------------------------------- /computer_science/README.md: -------------------------------------------------------------------------------- 1 | 토막글을 모아놓은 repository입니다. 2 | 잘못된 내용이 있을 경우 [Issues](https://github.com/codingbowoo/codingbowoo-resource/issues/new)로 제보해주세요. 3 | -------------------------------------------------------------------------------- /computer_science/automata/pda.md: -------------------------------------------------------------------------------- 1 | # PDA 2 | 3 | pushdown Automata 4 | 5 | 6 | https://web.stanford.edu/class/archive/cs/cs103/cs103.1132/lectures/17/Small17.pdf 7 | -------------------------------------------------------------------------------- /computer_science/python/pep448.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #### Reference 5 | [PEP 448: Additional Unpacking Generalizations](https://www.python.org/dev/peps/pep-0448/) 6 | 7 | -------------------------------------------------------------------------------- /computer_science/computer_architecture/ch4_vector_processors.md: -------------------------------------------------------------------------------- 1 | # Chapter 4: Vector Processors 2 | 3 | ## Contents 4 | - []() 5 | 6 | * * * 7 | ### Title 8 | - list 9 | 10 | -------------------------------------------------------------------------------- /interest/jpop/README.md: -------------------------------------------------------------------------------- 1 | 애정하는 J-POP 노래들을 아티스트별로 아카이빙합니다. 2 | 3 | 가나다순으로 정렬 4 | 5 | - [호시노 겐](https://github.com/codingbowoo/codingbowoo-resource/blob/master/stack/jpop/hoshino_gen.md) 6 | -------------------------------------------------------------------------------- /today/19-04-08.md: -------------------------------------------------------------------------------- 1 | 19-03-12 의 nlp 수업에서 교수님이 그러셨다. 2 | > 사실 너희는 000 *(내 경우는 금융기계학습)* 석사가 아니고 컴퓨터공학 석사다. 3 | 4 | > coursework을 열심히 해라 5 | 6 | > 폭넓게, 이게 어디로 가는 것인지는 알고 공부해야지. 7 | 8 | 기억해둬야지. 9 | -------------------------------------------------------------------------------- /interest/jpop/hoshino_gen.md: -------------------------------------------------------------------------------- 1 | ## Playlist 2 | - [星野源 - 恋【MV & Trailer】/ Gen Hoshino - Koi](https://youtu.be/jhOVibLEDhA) 3 | - [星野源 - アイデア【Music Video】/ Gen Hoshino - IDEA](https://youtu.be/RlUb2F-zLxw) 4 | -------------------------------------------------------------------------------- /computer_science/computer_architecture/ch3_limits_to_ILP_and_multithreading.md: -------------------------------------------------------------------------------- 1 | # Chapter 3: Limits to ILP and Multithreading 2 | 3 | ## Contents 4 | - []() 5 | 6 | * * * 7 | ### Title 8 | - list 9 | 10 | -------------------------------------------------------------------------------- /computer_science/algorithm/sort.md: -------------------------------------------------------------------------------- 1 | 세상엔 소트가 너무 많다. 2 | 3 | - [Bucket Sort](https://en.wikipedia.org/wiki/Bucket_sort) 4 | - [Pigeonhole Sort](https://en.wikipedia.org/wiki/Pigeonhole_sort) 5 | - [Radix Sort](https://en.wikipedia.org/wiki/Radix_sort) 6 | -------------------------------------------------------------------------------- /computer_science/shell/version.md: -------------------------------------------------------------------------------- 1 | # version 확인 2 | 3 | ```shell 4 | $lsb_release -a 5 | ``` 6 | 그러나 7 | 8 | > /bin/sh: 1: lsb_release: not found 9 | 10 | 를 마주하게 되었다. 그렇다면 다른 방법으로... 11 | 12 | ```shell 13 | $cat /etc/issue 14 | # Out: 15 | # Ubuntu 16.04.3 LTS \n \l 16 | ``` 17 | -------------------------------------------------------------------------------- /computer_science/python/visualization.md: -------------------------------------------------------------------------------- 1 | - [Visualization Combo with Python](https://towardsdatascience.com/jupyter-superpower-interactive-visualization-combo-with-python-ffc0adb37b7b) by Nok 2 | - [Vega-lite](https://github.com/vega/vega-lite)를 기반으로 하는 [Altair](https://altair-viz.github.io/)를 소개한다. 3 | -------------------------------------------------------------------------------- /today/the-gardeners-season-7.md: -------------------------------------------------------------------------------- 1 | # The Gardeners Season 7 2 | 3 | 2021-11-15 4 | - 정원사들 시즌 7에 합류하게 되었다! (시즌 7 최초의 문장) 5 | - 시즌 4, 5에 이어 세 번째 참여. 정원사들로부터 받는 푸릇한 에너지를 기대한다. 6 | - 이번 시즌 말미에는 기술 발표를 할 거예요! 7 | - 데이터 엔지니어링, 자연어처리, 블록체인이라는 세 개의 무시무시한 키워드를 가지고 가려고 합니다! 8 | - 이거 작성하는게 불편해서 zsh 테마 설정을 시작했다... ㅎㅎ 9 | -------------------------------------------------------------------------------- /computer_science/math/spectral_decomposition.md: -------------------------------------------------------------------------------- 1 | ## Spectral Decomposition 2 | 도움을 받은 링크 정리 3 |
4 | [[선형대수] 특이값 분해 (SVD, Singular Value Decomposition](http://rfriend.tistory.com/185)
5 | [[충북대학교 전자정보대학]대각화와 고유값 분해](http://elearning.kocw.net/contents4/document/lec/2013/Chungbuk/LeeGeonmyeong1/12.pdf) 6 | -------------------------------------------------------------------------------- /computer_science/port-forward.md: -------------------------------------------------------------------------------- 1 | # Port-forwarding 2 | 3 | 연구실에 나오지 않고 연구실 서버에 접근하겠다는 강한 의지가 만든 파일! 4 | 5 | 혹시 어떻게 하고 계신가요- 라는 질문에 아래 명령어를 받았다. 6 | 7 | ``` 8 | ssh -N -L 8888:163.239.27.112:7171 fml@163.239.27.111 9 | ``` 10 | 다시 쓰면 11 | 12 | ``` 13 | ssh -N -L [localhost에서 열 포트]:[(접근하고 싶은 서버):(포트)] [(id)@(경유 서버)] 14 | ``` 15 | -------------------------------------------------------------------------------- /finance/momentum.md: -------------------------------------------------------------------------------- 1 | # Momentum 2 | 3 | ## Time Series Momentum 4 | - Individual 5 | - Univariate 6 | 7 | ## Cross Sectional Momentum 8 | - Group of equities 9 | - Multivariate 10 | - Relative performance 11 | - Market neutral (long-short 문서 참고) 12 | 13 | 14 | - [AHL Explains - Cross Sectional Momentum](https://youtu.be/tfNI6YwDG_o) 15 | -------------------------------------------------------------------------------- /computer_science/math/eigenv.md: -------------------------------------------------------------------------------- 1 | eigenvalue와 eigenvector 개념을 꾸준히 마주하고 있다. 2 | 3 | ###### 가장 도움이 된 링크 4 | - [Eigenvectors, Eigenvalues, PCA, Covariance and Entropy](https://skymind.ai/wiki/eigenvector) 5 | - [Eigenvectors and eigenvalues | Essence of linear algebra, chapter 13](https://youtu.be/PFDu9oVAE-g) 6 | : 해당 링크를 통해 기하학적이고 직관적인 이해를 하는데 특히 큰 도움을 받았다. 7 | -------------------------------------------------------------------------------- /computer_science/dism.md: -------------------------------------------------------------------------------- 1 | # DISM command? 2 | - Deployment Image Servicing and Management 3 | - a command-line tool that can be used to service and prepare Windows images 4 | : including those used for Windows PE, Windows Recovery Environment (Windows RE) and Windows Setup. 5 | - DISM can be used to service a Windows image (.wim) or a virtual hard disk (.vhd or .vhdx). 6 | -------------------------------------------------------------------------------- /computer_science/bit_manipulation.md: -------------------------------------------------------------------------------- 1 | ### bit Manipulation 2 | 3 | 1101 4 | 0101 5 | 1000 6 | 7 | 8 | - arithmetic 적 shift: 부호 비트를 남겨두고 넘긴다. 9 | - logical shift: 10 | - ">>>" 11 | - C에서는 unsigned -> logical 12 | - signed -> arithmetic 13 | 14 | - shift는 [연산 우선순위](http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm)가 쏘 아래여서 ()를 꼭 씌워주자 15 | 16 | -------------------------------------------------------------------------------- /computer_science/machine_learning/evaluate.md: -------------------------------------------------------------------------------- 1 | 내 모델이 잘 기능하고 있는지 확인해 봐야겠죠? 그럴 때 loss의 개념이 등장합니다. 2 | 내가 예측한 것이 의도한 정답과 차이가 얼마나 큰가, 하는 metric을 제공합니다. 3 | 4 | - L1 loss : regularizer 5 | - MSE : loss function for regression problems 6 | - Cross-entrophy loss: Binary/ Multi-class clssifiacation problems 7 | - NLL loss : classification, handling imbalanced datasets using specific weights 8 | -------------------------------------------------------------------------------- /computer_science/machine_learning/weight_decay.md: -------------------------------------------------------------------------------- 1 | weight decay는 regularization을 위한 방법 중 하나로, L2 norm과 같은 penalty를 loss function에 추가한다. 2 | 3 | (다시 적는데 regularization은 overfitting을 방지하기 위한 방법이다.) 4 | 5 | (대강 Deep Learning 책 내용을 정리할 예정이라는 내용) 6 | 7 | 8 | ### Example of weight decay in PyTorch 9 | 10 | ##### resources 11 | - [Regularization (Weight Decay)](https://deepapple.tistory.com/6) 12 | -------------------------------------------------------------------------------- /computer_science/machine_learning/autoencoder.md: -------------------------------------------------------------------------------- 1 | # Autoencoder 2 | 3 | ###### Reference 4 | - [Le, Quoc V. "A tutorial on deep learning part 2: Autoencoders, convolutional neural networks and recurrent neural networks." Google Brain (2015): 1-20.](Le, Quoc V. "A tutorial on deep learning part 2: Autoencoders, convolutional neural networks and recurrent neural networks." Google Brain (2015): 1-20. 5 | ) 6 | -------------------------------------------------------------------------------- /computer_science/python/random.md: -------------------------------------------------------------------------------- 1 | # random 2 | 3 | reproducible 한 모델을 만들기 위해 신경써야할 random seed들이 많다. 4 | 5 | 6 | 1. sklearn.model_selection.train_test_split 7 | - random_state option 8 | 2. keras random seed 9 | - global random seed 10 | - operation-level seed 11 | 3. numpy random seed, random random seed 12 | - numpy.random.seed(), random.seed() 13 | 14 | 15 | random의 구동 방식(?)을 정리하고 싶었는데! 16 | -------------------------------------------------------------------------------- /computer_science/python/xmode.md: -------------------------------------------------------------------------------- 1 | # xmode 2 | jupyter notebook에는 magic command라는 것이 있다. ```%xmode```도 그 중 하나. 3 |
4 | 실행을 시키면 5 | 6 | > Exception reporting mode: Verbose 7 | 8 | > Exception reporting mode: Minimal 9 | 10 | > Exception reporting mode: Plain 11 | 12 | > Exception reporting mode: Context 13 | 14 | 15 | 이 네 가지가 번갈아 나온다. 16 | 17 | ###### 추가로 찾아볼 것 18 | - ```%pdb``` 19 | - ```%debug``` 20 | -------------------------------------------------------------------------------- /interest/developer_culture/developer_relations.md: -------------------------------------------------------------------------------- 1 | # Developer Realations? 2 | 3 | 개인적으로 관심이 있는 분야이기 때문에 관련 블로그 글과 그 내용을 정리해보려 한다. 4 | 5 | ###### Reference 6 | - [Why Do We Pay These People Anyway?](https://medium.com/google-developers/why-do-we-pay-these-people-anyway-d7ed706d6d55) 7 | - [The Core Competencies of Developer Relations](https://medium.com/google-developers/the-core-competencies-of-developer-relations-f3e1c04c0f5b) 8 | -------------------------------------------------------------------------------- /interest/my_reading_style.md: -------------------------------------------------------------------------------- 1 | 이 문서는 정리한다 나의 읽는 방법, 2 | 3 | ## Reinforcement learning book 4 | [Reinforcement Learning: An Introduction](http://incompleteideas.net/book/the-book.html) by Richard S. Sutton and Andrew G. Barto 5 | 1. get used to mathematical expressions 6 | 2. read through the chapter 7 | 3. look back lecture materials ([UCL Course on RL](http://www0.cs.ucl.ac.uk/staff/d.silver/web/Teaching.html) by David Silver) 8 | -------------------------------------------------------------------------------- /computer_science/OOP.md: -------------------------------------------------------------------------------- 1 | # OOP 2 | 3 | Object-Oriented Programming 4 | 5 | 6 | Python으로 머신러닝 모델들을 만들려고 보면 죄다 ```class Mymodel():``` 뭐시기들이다! 7 | 8 | 그치만... 나는 class랑 어색한 사인걸...? class는 프로그래밍언어 수업시간에 글로만 배웠는걸...?
9 | (특: C부터 배움, Python을 C처럼 써왔음) 10 | 11 | 12 | 그런데 class와 OOP 개념을 이해하기 너무 좋은 노트북이 있어서 일단 저장이다. 13 | 14 | https://github.com/tirthajyoti/Machine-Learning-with-Python/blob/master/OOP_in_ML/Class_MyLinearRegression.ipynb 15 | -------------------------------------------------------------------------------- /computer_science/python/exceptions.md: -------------------------------------------------------------------------------- 1 | # Exceptions 2 | 3 | - 윈도우에서는 에러가 다르게 난다. 예를 들어, linux 환경에서 4 | ```python3 5 | try: 6 | pass 7 | except FileExistsError: 8 | pass 9 | ``` 10 | 이렇게 예외처리할 수 있었던 에러가 11 | 12 | ```FileExistsError: [WinError 183] 파일이 이미 있으므로 만들 수 없습니다``` 13 | 라고 나오면서 예외처리가 되지 않는다... 14 | 15 | [python3 documentation exception OSError](https://docs.python.org/3/library/exceptions.html#OSError)를 참고해서 예외처리를 해보자. 16 | -------------------------------------------------------------------------------- /finance/long-short.md: -------------------------------------------------------------------------------- 1 | 흔히 아는 매수long, 매도short이다. 2 | 3 | # Long 4 | 5 | # Short 6 | 7 | # long-short equity 8 | 저평가된 주식을 매수long, 고평가된 주식을 매도short하는 포트폴리오 운용 전략 9 | 10 | #### 기타 키워드 11 | - Market Neutral Strategy 12 | - 시장 리스크를 축소 13 | - 수익률 변동성이 안정적인 특징을 보인다. 14 | - 하락장에서 상대적으로 안정된 성과 15 | - 익스포져 Exposure 16 | 17 | ###### 참고자료 18 | - [헤지펀드 시리즈 III 롱숏 에쿼티](https://www.eugenefn.com/common/files/amail/20111129_B4030_seoboick_138.pdf) 19 | -------------------------------------------------------------------------------- /today/18-04-04.md: -------------------------------------------------------------------------------- 1 | ## 영어 줄임말 두개 2 | 3 | 두개의 영어 줄임말 알게되었다. 4 | 5 | ### TL;DR 6 | **T**oo **L**ong; **D**idn't **R**ead
7 | 사람들이 페이스북 포스팅에 종종 써서 알았다. 8 | 9 | ### LGTM 10 | **L**ooks **G**ood **T**o **M**e
11 | naver ai hackathon 문서 읽다가 코드에 콤마(,) 하나 빠졌길래 PR날렸다!
12 | (사실 이거 적고싶어서 문서로 정리하는 중인거 같기도 하고...)
13 | 그랬더니 머지해주시면서 LGTM! 이라고 코멘트 날리셨는데, 사실 무슨 말인지 몰라서 찾아봤다.
14 | 대체 한국서 나고 자란 사람들은 이런거 어떻게 일상생활화 하는 것일까. 별다줄(별걸 다 줄인다)이다. 15 | -------------------------------------------------------------------------------- /computer_science/machine_learning/auto_ml.md: -------------------------------------------------------------------------------- 1 | # AutoML 2 | 3 | autoML도 여러 노선이 있는데... 4 | 5 | 6 | ### Feature Engineering의 자동화 7 | - [Featuretools](https://github.com/FeatureLabs/featuretools) 8 | 9 | ### 전체 Pipeline의 자동화 10 | - [TPOT](https://github.com/EpistasisLab/tpot) : genetic programming 기반 ml pipeline 자동화 툴 11 | - https://www.automl.org/ 12 | - https://www.automl.org/automl/auto-sklearn/ 13 | - https://www.automl.org/automl/bohb/ 14 | -------------------------------------------------------------------------------- /computer_science/resource_monitor.md: -------------------------------------------------------------------------------- 1 | 2 | windows 이용하다보면 가끔 아무데도 열려있지 않지만 파일이 어딘가에 열려 있다며 삭제를 못 하는 상황이 생긴다. 3 | 그럴때 리소스 모니터를 열어서, 지우고 싶은 파일이 어디에 열려 있는지 확인할 수 있다. 4 | 5 | 1. 윈도우즈 실행 (단축키 ```시작+R```) 창에 ```resmon.exe``` (누가봐도 resource monitor) 6 | 2. CPU 탭 -> 연결된 핸들 검색창에 파일명 찾기 7 | 8 | 9 | 뿐만 아니라 내 CPU 각 코어가 일하고 있는지 확인하기도 좋다! 이건 마치 ```htop``` 10 | 11 | ###### 출처 12 | https://www.winhelponline.com/blog/resource-monitor-find-process-locked-file-windows-7/ 13 | -------------------------------------------------------------------------------- /interest/mental_health.md: -------------------------------------------------------------------------------- 1 | 인지 & 정서 2 | Cognition & Emotion 3 | 4 | # 인지 왜곡 5 | ### 과잉일반화 6 | 현재의 상황을 고려하지 않고 모든 상황에 하나의 사건을 적용, 해석한다. 7 | 8 | ### 당위진술 9 | 자신이나 다른 사람들의 행동에 대해 확실하고 고정된 사고를 가진다. 이런 본인의 기대를 충족하지 못하면 얼마나 나쁜지를 과대평가한다. 10 | 11 | ### 독심술 12 | 현실적인 가능성을 고려하지 않고 다른 사람의 생각을 추측하고, 사실이라 믿는다. 13 | 14 | ### 터널시야 15 | 어떤 상황이 주어졌을 때 부정적인 모습만 본다 16 | 17 | ### 파국화 18 | 미래에 대하여, 현실적인 고려 없이 극단적으로 좋지 않은 상황을 예상한다. 19 | 20 | ### 흑백논리 21 | 어떤 상황을 오직 두 개의 범주로 나누어 본다. 22 | -------------------------------------------------------------------------------- /book/quantitative_investment.md: -------------------------------------------------------------------------------- 1 | # Quant 실전 퀀트투자 2 | 3 | > 수익률을 확인하고 투자하라! 4 | 5 | 2020.01.25 ~ 6 | 7 | 네이버 책 [실전 퀀트투자](https://book.naver.com/bookdb/book_detail.nhn?bid=14436357)
8 | 9 | 홍용찬 10 | 이레미디어 11 | 12 | 금융기계학습 연구실 소속으로 포트폴리오 성능 개선에 대한 연구를 하고 있지만, 13 | 내가 연구하는 분야가 계량투자라고 말만 알고 있었지 **퀀트**라고 불리며 숫자만을 가지고 수익을 내는 분야라는 건 모르고 있었다. 14 | 15 | 이렇게나 기본적인 걸 모르고 있었나.. 하는 자책과 지금부터 알아가면 되지, 하는 희망의 마음으로 이 책을 읽기 시작한다. 16 | 17 | 18 | 19 | 20 | 21 | ###### 후기 22 | - 23 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pca.md: -------------------------------------------------------------------------------- 1 | ## PCA 2 | PCA는 Principal Components Analysis의 준말로, Dimensionality Reduction의 시작점이라고 할 수 있다. 3 | 차원을 감소시키는 방법에는 Feature selection과 feature extraction이 있다. PCA는 feature extraction에 해당한다. 4 | d차원의 벡터가 있을 때 k(k 7 | 8 | ###### 도움이 된 링크 정리 9 | 10 | [Jeonghun Yoon님의 slideshare - 07.PCA](https://www.slideshare.net/JeonghunYoon/07-pca)
11 | [공돌이의 수학정리노트](https://wikidocs.net/7646) 12 | -------------------------------------------------------------------------------- /computer_science/tex.md: -------------------------------------------------------------------------------- 1 | > 파일 이름이 ```tex.md```인게 상당히 마음에 든다. 2 | 3 | 4 | # 표 5 | - 여러 열을 합하고 싶을 때 6 | ```tex 7 | \multicolumn{2}{c|}{(1)} 8 | ``` 9 | > \multicolumn{몇 개의 열을 합할 것인가}{정렬은 어떻게?}{열 안에 넣을 내용(위의 예시에서는 (1))} 10 | 11 | 12 | - 여러 행을 합하고 싶을 때 13 | ```tex 14 | \usepackage{multirow} 15 | 16 | \multirow{2}{*}{(1)} & (이어지는 내용) & ... 17 | & (이어지는 내용) 18 | ``` 19 | > \multirow{몇 개의 행을 합할 것인가}{*}{합친 행 안에 넣을 내용(위의 예시에서는 (1))} 20 | 21 | 마지막 줄을 보면 첫 칸을 비웠음(행을 합치지 않았다면 있었을 칸)을 확인할 수 있다. 22 | -------------------------------------------------------------------------------- /today/19-05-22.md: -------------------------------------------------------------------------------- 1 | 2019-05-22 2 | 3 | 구글에서 지난 주에 올린 아티클이 페이스북 여기저기에 공유되었길래 읽어보았다.
4 | [Introducing Translatotron: An End-to-End Speech-to-Speech Translation Model](https://ai.googleblog.com/2019/05/introducing-translatotron-end-to-end.html?fbclid=IwAR0vNXWDm9dgvLBsJoEia0m9T8mvyao5yHk2FTAjY2nxXOafQ57KytUkOac) 5 | 이라는 아티클인데, 아니 이게 뭐람, seq2seq를 이용한 speech-to-speech translation이요? 인공지능이 동시통역을 하는 세상을 초등학교때 꿈꿨던 기억이 어렴풋이 있는데. 6 | (내가 인공지능 공부하고 있을 줄은 물론 몰랐지만... 기계가 하면 신기하겠다면서 동시통역사가 꿈이던 시절도 있었지만... 7 | -------------------------------------------------------------------------------- /computer_science/machine_learning/rnn.md: -------------------------------------------------------------------------------- 1 | ## RNN 2 | 3 | - networks with loops in them (they looks similar to original neural network when unrolled) 4 | - sequence, list 형태의 데이터를 처리하는 구조(아키텍처) 5 | - 직전의 정보와 현재의 정보를 연결할 수 있다. 6 | - 음성인식, 언어 모델링, 번역, 이미지 캡셔닝 등에 쓰임 7 | 8 | 9 | #### 문제점 10 | 11 | ##### Long-term dependencies 12 | 이론상으로는 서로 영향을 주는 요소들이 멀리 떨어져 있어도 반영이 가능하지만, 실제로는 이 간격이 멀어질수록 정보를 연결하기 어려워진다. 13 | 14 | 15 | ###### 링크 16 | [Chris(송호연)님의 LSTM(RNN)소개](https://brunch.co.kr/@chris-song/9) 17 | -------------------------------------------------------------------------------- /computer_science/server/linux_time.md: -------------------------------------------------------------------------------- 1 | ## linux 서버 시간 바꾸기 2 | 3 | ##### 방법 1 4 | 5 | ```tzselect``` 라는 명령어가 있다. 터미널 창에 6 | 7 | ``` 8 | $ tzselect 9 | ``` 10 | 라고 하면 지역을 고른다. 한국 기준 4) Asia --> 23) Korea(South)를 골라주면 된다. Local time 확인창이 나오는데 above information OK? ```Yes``` 해주자. 다 숫자 눌러야 한다! 11 | - 요 커맨드는 사실 ```/usr/bin/tzselect``` 라고 한다. 12 | 13 | 14 | ##### 방법 2 15 | 16 | ``` 17 | TZ='Asia/Seoul'; export TZ 18 | ``` 19 | 를 ```.profile``` 파일에 추가하면 영구적으로 설정을 변경할 수 있다고 한다. 20 | - 변경한 후에는 로그아웃하고 로그인 다시 해주어야 한다! 21 | -------------------------------------------------------------------------------- /finance/terms-stock.md: -------------------------------------------------------------------------------- 1 | - 시가Open: 장 중의 최초 시작 가격 2 | - 고가High: 장 중의 가장 높은 가격 3 | - 저가Low: 장 중의 가장 낮은 가격 4 | - 종가Close: 장 마감 가격 5 | 6 | 7 | - 실평가손익합: 현재가로 매도를 가정한 손익의 합 8 | - 실현실수익금: 실제 매도를 통해 실현한 수익금 9 | - 자산증감금액: 전일기준의 총평가금액과 현재총자산액과의 차이금액(당일 실현손익/평과손익과는 무관) 10 | 11 | 12 | - 예수금 13 | - 현금 14 | - 현금증거금 15 | 16 | 17 | 추가로 들여다볼 것 18 | - https://blog.naver.com/PostView.nhn?blogId=eunhasoohotel&logNo=221512449549&categoryNo=11&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=1&from=postView 19 | -------------------------------------------------------------------------------- /computer_science/nvidia-smi.md: -------------------------------------------------------------------------------- 1 | GPU 사용과 관련해서 혼란이 많다- 관련 링크 정리. 2 | 3 | - [Inconsistency between GPU memory usage in torch.cuda.memory_summary and nvidia-smi](https://github.com/pytorch/pytorch/issues/37250) 4 | - nvidia-smi 결과로 보이는 것과 달리 실제로는 CUDA가 잡아먹는 메모리 있음 5 | - PyTorch 자체가 caching mechanism 있음. [Pytorch documentation-Memory management](https://pytorch.org/docs/stable/notes/cuda.html#memory-management) 참고. 6 | - [nvidia-smi query 도움!](https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries) 7 | -------------------------------------------------------------------------------- /interest/ta_english.md: -------------------------------------------------------------------------------- 1 | The University of Nottingham 2 | - [Academic Misconduct Policy](https://www.nottingham.ac.uk/academicservices/qualitymanual/assessmentandawards/academic-misconduct.aspx) 3 | - [Exam Instructions for Students](https://www.nottingham.edu.cn/en/academicservices/documents/unncexaminstructionsforstudents.pdf) 4 | 5 | ILLINOIS CITL (THE CENTER FOR INNOVATION IN TEACHING & LEARNING) 6 | - [DEALING WITH CHEATING](https://citl.illinois.edu/citl-101/teaching-learning/resources/classroom-environment/dealing-with-cheating) 7 | -------------------------------------------------------------------------------- /computer_science/computer_architecture/README.md: -------------------------------------------------------------------------------- 1 | # CSE6231 ADVANCED COMPUTER ARCHITECTURE 2 | Sogang Univ. graduate school, Spring 2020 3 | 4 | 5 | # Course Overview 6 | - Intro. to computer architecture 7 | - Procesor technology 8 | - Thread-level parallelism 9 | - Simultaneous multi-threading(SMT) 10 | - Vector Procesor 11 | - Advanced Cache 12 | - Software techniques for memory hierarchy 13 | - Parallel computer 14 | - General putpose graphics processor 15 | - Power issues 16 | - DRAM and FLASH memory 17 | - Accelerator, TPU 18 | 19 | -------------------------------------------------------------------------------- /computer_science/machine_learning/cuda.md: -------------------------------------------------------------------------------- 1 | # CUDA 2 | 3 | ## CUDA with PyTorch 4 | 5 | #### CUDA 사용 가능한지 확인하기 6 | ```python3 7 | import torch 8 | torch.cuda.is_available() 9 | ``` 10 | 11 | #### CUDA 사용 가능한 현재 디바이스 확인하기 12 | ```python3 13 | import torch 14 | 15 | # 디바이스 id 16 | d_id = torch.cuda.current_device() 17 | 18 | # 디바이스 확인 19 | torch.cuda.get_device_name(d_id) 20 | ``` 21 | 22 | #### 현재 GPU 메모리 상태 관련 명령어 23 | ```python3 24 | import torch 25 | 26 | torch.cuda.memory_allocated() 27 | torch.cuda.memory_cached() 28 | torch.cuda.empty_cache() 29 | ``` 30 | -------------------------------------------------------------------------------- /computer_science/computer_architecture/ch2_processor_technology.md: -------------------------------------------------------------------------------- 1 | # Chapter 2: Processor Technology 2 | 3 | ## Contents 4 | - [Metrics: 좋은 컴퓨터 아키텍처란?](#metrics) 5 | - [Performance](#metrics-performance) 6 | - [Power consumption](#metrics-power-consumption) 7 | - [What to Improve?](#what-to-improve) 8 | - [Common case](#common-case) 9 | - [Amdahl's law](#amdahl-s-law) 10 | 11 | * * * 12 | 13 | ## Metrics 14 | ### Performance 15 | - list 16 | 17 | ### Power consumption 18 | - list 19 | 20 | * * * 21 | -------------------------------------------------------------------------------- /today/19-03-19.md: -------------------------------------------------------------------------------- 1 | 오늘의 일기 2 | 1. 중년기사 김봉식을 다운받았다. (드디어!) 플레이 요소 중 환생 시스템은 너무 매력적이다. 나도 할래 환생... 3 | 2. 강화학습 과목을 수강중인데 확률과 관련한 지식의 부재가 나를 괴롭힌다. 지금 할 수 있는 것은 그저 익숙해지려고 애쓰는 것. 4 | `Iterative Expectation`,`Conditional Expectation` 의 개념으로 고통받았다. 아래 링크에 나오는 내용을 익히자. 5 | - John Tsitsiklis, and Patrick Jaillet. RES.6-012 Introduction to Probability. Spring 2018. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu., 6 | - [Introduction to Probability, Part I: The Fundamentals](https://ocw.mit.edu/resources/res-6-012-introduction-to-probability-spring-2018/part-i-the-fundamentals/) 7 | 3. 지금은 쟤네가 뭔지 알고 있다! 어제보다 똑똑한 나! 멋진 나! 8 | 4. *긍정적인 사고와 현실적 준비성* 이라는 문구를 마음에 새겨야지. 9 | -------------------------------------------------------------------------------- /computer_science/python/sys.md: -------------------------------------------------------------------------------- 1 | ## sys 2 | 3 | [BOJ 그대로 출력하기 2](http://icpc.me/11719)를 몇 날 며칠 고민했는데, 4 | ```sys.stdin.read()```, ```sys.stdin.readline()```, ```sys.stdin.readlines()``` 를 사용하는 것이 손에 익으면서 구글링을 하다가 5 | 어물쩡 해결해버렸다. 6 | 7 | 처음 짠 코드는 이렇다. (메모리 29160KB, 시간 64MS, 코드 길이 120B) 8 | ``` 9 | import sys 10 | 11 | try: 12 | a = sys.stdin.readlines() 13 | except EOFError: 14 | pass 15 | 16 | for line in a: 17 | print(line, end="") 18 | ``` 19 | 20 | 21 | 그래서 슥슥 try except 구문을 지워보았다. (메모리 29160KB, 시간 **68MS**, 코드 길이 82B) 22 | ``` 23 | import sys 24 | 25 | a = sys.stdin.readlines() 26 | 27 | for line in a: 28 | print(line, end="") 29 | ``` 30 | try except 구문을 지웠는데 시간이 더 오래 걸렸다. 31 | -------------------------------------------------------------------------------- /computer_science/automata/reduction.md: -------------------------------------------------------------------------------- 1 | 자동장치이론 공부를 해본 사람이라면 책에서 ```(문제A) <= (문제B)```라는 표현을 본 적 있을 것이다.
2 | 저 표현을 읽는 방법은 놀랍게도, **A can be reduced to B** 이다. 3 | * * * 4 | reduction은 computational complexity를 결정할 때 중요한 역할을 한다.
5 | ```(문제A) <= (문제B)``` 는 *'A가 최대 B만큼 어렵다*(A의 상한선이 B이다)' 혹은 *'B가 최소 A만큼 쉽다.*(B의 하한선이 A다)' 로 읽어낼 수 있다. 6 | 7 | 8 | 다시 말해,
9 | B가 P(Polynomial)라면 A도 P이고, A가 NP라면 B도 NP여야 한다는 말이다.
10 | 그런데 **A can be reduced to B**라니, 더 쉬운 것을 어려운 쪽으로 줄인다(reduce)구? 11 |

12 | ...는, 사실 반대의 의미이다. ```(문제A) <= (문제B)``` 에서 **A는 B의 특수한 경우**라고 볼 수 있다.
13 | 문제 B가 더 일반적인 문제이므로 풀기는 어렵다. (수학에서도 일반해를 찾는 것이 더 어렵듯 말이다.) 14 |
15 | 다른 말로는 문제 B가 expressive enough 라고 한다. 무엇에 대해? 문제 A의 목표와 제한 조건에 대해! 16 | -------------------------------------------------------------------------------- /computer_science/machine_learning/ml_conf.md: -------------------------------------------------------------------------------- 1 | curated list of machine learning conferences
2 | ```Intl.``` for International, ```Conf.``` for Conference 3 | 4 | | 이름 | 풀네임 |
홈페이지
|
비고
| 5 | |:----:|:---:|:---:|:----:| 6 | | CVPR | The Conf. on Computer Vision and Pattern Recognition | http://cvpr2020.thecvf.com/ | June 2020 / Seattle, WA, US | 7 | | ICML | Intl. Conf. on Machine Learning | https://icml.cc/ | July 2020 / Vienna AUSTRIA | 8 | | NeurIPS | Conf. on Neural Information Processing Systems | https://nips.cc/ | Dec 2020 Vancouver CANADA | 9 | | SEAMLS | Southeast Asia Machine Learning School | https://www.seamls.ai/ | July 2020 / Da Nang, Vietnam| 10 | ||||| 11 | ||||| 12 | ||||| 13 | -------------------------------------------------------------------------------- /computer_science/docker-basic.md: -------------------------------------------------------------------------------- 1 | 용어 정리 2 | - docker 3 | - image 4 | - container 5 | - host 6 | 7 | 8 | 이미지 관련 명령어: 목록 확인, 다운로드, 삭제 9 | ``` 10 | $ docker images 11 | $ docker pull 이미지_이름:버전(태그) 12 | $ docker rmi 이미지_이름 13 | ``` 14 | 15 | 16 | 컨테이너 실행 / 나가기 17 | ``` 18 | $ docker run [옵션] 이미지[:태그] [커맨드] [인자] 19 | $ exit 20 | ``` 21 | 22 | 컨테이너 목록 확인, 다시 실행, 중지, 삭제 23 | ``` 24 | $ docker ps -a 25 | $ docker attach 컨테이너_이름_ID 26 | $ docker stop 컨테이너_이름_ID 27 | $ docker rm 컨테이너_이름_ID1 컨테이너_이름_ID2(여러 개 가능) 28 | ``` 29 | 30 | 컨테이너 로그 보기/ 실시간 컨테이너 로그 보기 31 | ``` 32 | $ docker logs --tail 로그_몇_개_볼지 컨테이너_이름_ID 33 | $ docker logs -f 컨테이너_이름_ID 34 | ``` 35 | 36 | 실행 중 컨테이너에 명령 실행 37 | ``` 38 | $ docker exec [옵션] 컨테이너_이름_ID 커맨드 [인자] 39 | ``` 40 | -------------------------------------------------------------------------------- /finance/etf.md: -------------------------------------------------------------------------------- 1 | # ETF? 2 | > 2019.11.29, NH투자증권의 ETF 포럼에 다녀왔다. 모르는 것 투성이! 3 | 4 | **Exchange Traded Fund**의 약자로, 쉽게 말하면 **“거래소에 상장된 인덱스 펀드”** 5 | 6 | - *간접투자* 형식으로, 인덱스 펀드의 장점인 *분산투자*의 특성을 그대로 가져가며, 일반 상장 주식과 비슷하게 HTS로 *실시간 거래*가 가능하다는 장점이 있다. 7 | - 다양한 ETF가 존재한다: 이머징(신흥시장) 채권 ETF, 커버드 콜 ETF, 전환사채 ETF 등 8 | - ETF와 ETN(Notes;채권)을 합쳐서 ETP(Products)라고 부른다. 9 | - ETN은 ETF와는 다르게 만기가 있고, 빌행자 신용을 기반으로 하는 채권 형태이다. 10 | - 한국의 경우 주식형 ETN이 존재하며, 테마형 상품이 많다. 11 | - ETF시장은 개인이 거래하는 *유통시장*과 보통 50억 이산의 자산이 운용되는 *발행시장*으로 구성, 여기에 증권사에 해당하는 *유동성공급자*가 참여한다. 12 | - 미국의 경우 etf.com, 유럽의 경우 justETF.com 13 | 14 | #### 더 찾아볼 것 15 | - 유동성 공급자 LP (아마 Liquidity Provider) 16 | - 자산 “운용” 이라는 말이 낯설다. 17 | - 환 헤지란? 18 | - 증권사에 내는 돈, 보수? 19 | - 스프레드 (HTS에 걸린 매수/매도 가격 차) 20 | - 레버리지, 인버스 투자 21 | -------------------------------------------------------------------------------- /computer_science/git/remote_add.md: -------------------------------------------------------------------------------- 1 | ## git remote add 2 | 3 | 맨날 찾기 귀찮아서 정리하면 외울까 싶어서 정리해본다. 4 | 5 | ```git init```하고 나면 clone을 해오지 않는 이상 remote repository를 지정해주어야 한다. 6 | 7 | 그래서 그 command가 뭐냐면 8 | 9 | ``` 10 | git remote add (remote name) (remote URL) 11 | ``` 12 | 13 | 이거다. 흑흑 몇 번 더 찾아보겠지만,, 14 | - remote name은 보통 branch를 따온게 아니면 origin을 사용했다. 15 | - remote URL은 그거다. github에서 clone 버튼 누르면 나오는 ```http://github.com/(username)/뫄뫄.git``` 16 | 17 | 그리고 나면 config를 하는데, 이것의 코드는 다음과 같다.. 18 | ``` 19 | $ git config --global user.name "(username)" 20 | $ git config --global user.email example@example.com 21 | 22 | ``` 23 | 24 | 손이 먼저 움직이는 그날까지! 25 | 26 | ###### 참고 링크 27 | - [Getting Started - First-Time Git Setup](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) 28 | -------------------------------------------------------------------------------- /today/18-03-16.md: -------------------------------------------------------------------------------- 1 | ###### 오늘의 시덥잖은 이야기 2 | 3 | 0. 방금 인스타에 글을 쓰는데 '맘에 여유가 없다'고 쓰고 싶었는데 '맘에 어이가 없다'고 쓰고 홀로 의문의 시간을 가졌다... 왜 저런 오타를 냈는가
4 | 1. 집중력의 지속시간이 28분임을 확인했다... 더 길게 하지 못한다면 차라리 전략적으로 활용하리라 28분... 5 | 6 | * * * 7 | ## git clean 8 | [15일자 일기장](https://github.com/codingbowoo/codingbowoo.github.io/blob/master/today/18-03-15.md)의 마지막, "알아봐야 하는 것"에, ```.gitignore로 특정 폴더 무시하는 방법 ㅠㅅㅠ```라고 써 놓은 바 있다. 9 | 10 | 나의 경우 ```(git repo name)/boj/submit-tool/``` 을 지우고 싶었는데 11 | 12 | ```git clean -n -d``` 하니까 ```Would skip repository boj/submit-tool/``` 라고 떴고 13 | 14 | ```git clean -d boj/submit-tool/``` 하니까 15 | ```fatal: clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean```라고 떠서 당황하는 중이다. 16 | 17 | 근데 너무 화나는 일 생겨서 오늘은 여기까지만 쓰고 내일 해결할거다..... 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 장보우 2 | [하트카운트](https://www.heartcount.io/) 서비스를 운영하는 아이디케이스퀘어드에서 개발자로 근무하고 있습니다.
3 | 서강대학교 컴퓨터공학과 대학원에서 [FML](http://fml.sogang.ac.kr)의 일원으로 머신러닝 공부를 했습니다.
4 | 사람과 교육, 그리고 오픈소스 문화에 관심이 많습니다.
5 | 6 | 잘못된 내용이 있을 경우 [Issues](https://github.com/codingbowoo/codingbowoo-resource/issues/new)로 제보해주세요.
7 | [Issues](https://github.com/codingbowoo/codingbowoo-resource/issues/new)에 방명록을 남기셔도 좋습니다! 반짝반짝한 ```✨guestbook✨``` label을 달아드립니다. 8 | 9 | ## Contacts 10 | lisabowoo at gmail dot com
11 | bowoojang at sogang dot ac dot kr
12 | bowoo.jang at idk2 dot co dot kr
13 | 14 | 15 | ## GitHub Stats 16 | ![Github Stats](https://github-readme-stats.vercel.app/api?username=codingbowoo&hide_title=true&show_icons=true&include_all_commits=true&disable_animations=true) 17 | -------------------------------------------------------------------------------- /computer_science/machine_learning/ai_hype.md: -------------------------------------------------------------------------------- 1 | 인공지능이 뭐든지 할 수 있고, 일자리를 뺏고, 인류를 지배하리라(...)는 이야기를 하는 사람들이 있다.
2 | 왜 그렇게 생각하는 걸까? 그리고 어떻게 이것이 과장인지 아닌지 판별할 수 있을까? 3 | 4 | [Elements of AI의 1장](https://course.elementsofai.com/1/1)에서는 **무엇이 AI이고, 무엇이 AI가 아닌가? AI에 대한 대중의 인식은 왜 이렇게 모호한가?** 라는 질문에 세 가지 이유를 댄다. 5 | 6 | 1. no officially agreed definition 7 | 2. the legacy of science fiction 8 | 3. what seems easy is actually hard... 9 | 10 | 1)공식적으로 합의된 정의가 없고, 2)SF소설에 나오는 이미지가 남아있고 3)쉬워보이는 것이 사실은 어렵다는 것이다.
11 | 풀어 말하자면,
12 | 요즘 세상에 모든 문제는 그런 문제가 있어? 인공지능 써서 풀면 되겠다~ 로 귀결되어 인공지능을를 만능열쇠 쯤으로 생각하고 있고, 13 | 인공지능이라고 하면 사람들은 SF소설에 나오는 사람의 모양새를 한 로봇을 떠올리고(그래서 겁을 먹거나 과대평가를 하게 되고), 14 | 인공지능으로 *어떤* 문제를 쉽게 풀 수 있고 없는지 잘 모른다는 이야기다. 15 | 16 | 그렇다면 대체 인공지능은 무엇이고, 어떻게 해야 과장된 부분을 걸러낼 수 있을까? 17 | -------------------------------------------------------------------------------- /computer_science/machine_learning/lstm-variation.md: -------------------------------------------------------------------------------- 1 | #### Stacked LSTM 2 | 3 | - LSTM을 쌓은 구조. 한 층의 결과값을 위 층의 input으로 사용하자. 4 | - 위로 위로 쌓아 올려서 가장 위의 LSTM 층의 결과값을 최종 결과로 사용한다. 5 | 6 | 이거 사용한 논문은 뭐가 있냐면 뫄뫄가 있다. 7 | 쌓았다는 말이 무슨 말이냐면 8 | 여기서는 인풋을 뭘 쓰고 아웃풋은 뭘 원한다 9 | 그래서 기본 구조 안쓰고 쌓아올렸다 10 | 11 | #### LSTM-AE 12 | - [Srivastava, Nitish, Elman Mansimov, and Ruslan Salakhudinov. "Unsupervised learning of video representations using lstms." In International conference on machine learning, pp. 843-852. 2015.](http://proceedings.mlr.press/v37/srivastava15.pdf) 13 | 사실 이건 단순히 LSTM에 Autoencoder를 연결한 것이 아니다! 인코더 LSTM와 디코더 LSTM을 사용 14 | 15 | 이 논문에서는 인풋을 뭘 쓰고 아웃풋은 뭘 원한다 16 | 그래서 기본 구조 쓰지 않고 인코더 디코더 구조를 쓰는데, 17 | 이때 데이터 특성이 뭐뭐여서 LSTM을 사용한다. 18 | 구성은 다음과 같다 19 | - 인코더 LSTM 20 | - 디코더 LSTM 21 | - 뭔가 세번째 구조가 있을 것만 같군. 22 | -------------------------------------------------------------------------------- /computer_science/python/series.md: -------------------------------------------------------------------------------- 1 | # Series 2 | 3 | pandas object 중 dataframe 다음으로 애정하는 Series 4 | 5 | 6 | 유용해보이는 함수 몇 가지를 기록해둘 예정! 7 | 8 | 아래와 같이 pandas를 import 했고 모종의 데이터가 든 Series object가 있다고 가정한다. 9 | ```python3 10 | import pandas as pd 11 | sr = pd.Series() 12 | ``` 13 | 14 | 1. **value_counts**: series 안에 서로 다른 값들의 개수를 세어 준다. 15 | ```python3 16 | sr.value_counts() # check if classification problem 17 | sr.value_counts(normalize=True) # 위 결과(count 수)를 normalize해서 보여준다 18 | sr.value_counts(ascending=True) # count 수를 기준으로 오름차순/내림차순으로 볼 수 있다. 19 | sr.value_counts(dropna=False) # NaN이 몇 개 인지 볼 수 있다. 20 | sr.value_counts(bins=10) # bin 개수를 설정하면 이 경우는 10개 카테고리로 값 range를 나눠서 count 결과를 보여준다. 21 | ``` 22 | 23 | 24 | 1. **추가 예정** 25 | ```python3 26 | ``` 27 | -------------------------------------------------------------------------------- /computer_science/machine_learning/time_series.md: -------------------------------------------------------------------------------- 1 | Medium article 2 | - [A basic guide to time series analysis](https://towardsdatascience.com/a-basic-guide-into-time-series-analysis-2ad1979c7438) 3 | 4 | 5 | time series는 기본적으로 autocorrelation(자기상관) 성질이 있다. 6 | 7 | 요즘 관심을 두고 있는 것은 correlation을 활용하는 time series 이다. 8 | - 읽어볼 것 [Learning Correlation Space for Time Series](https://arxiv.org/abs/1802.03628) 9 | - Time-series에서의 Validation 10 | - [What's Wrong With My Time Series](https://multithreaded.stitchfix.com/blog/2017/02/28/whats-wrong-with-my-time-series/) 11 | - 시계열은 data에서 shuffle을 할 수 없다 이 말이야! 12 | - 어떤 에러(model error/ assumption error)가 있는지 알고, 각각에 맞게 대응할 줄 알아야 한다. 13 | 14 | 15 | pandas의 DateTimeIndex의 기본값인 Timestamp, 그리고 16 | ```import datetime``` 을 해서 사용할 수 있는 datetime이 생각보다 활용도가 높을 수 있다. 17 | -------------------------------------------------------------------------------- /computer_science/machine_learning/study_resources.md: -------------------------------------------------------------------------------- 1 | 머신러닝을 공부해보자: 도움이 되는 사이트 2 | 3 | 1. [MLCC (Machine Learning Crash Course)](https://developers.google.com/machine-learning/crash-course/) by Google 4 | - for those who organize the study group: check [this document](https://docs.google.com/document/d/1I5mpe4CPLo9NDlmfg6npjnWixd6tzSAhZ1NaEAWhfto/edit?usp=sharing) out 5 | 6 | 2. Feature engineering 7 | - (towardsdatascience) [Feature Engineering techniques in Python](https://towardsdatascience.com/feature-engineering-techniques-in-python-97977ecaf6c8) by Anis Ayari 8 | 9 | 3. [Data Science at the Command Line](https://www.datascienceatthecommandline.com/) by Jeroen Janssens 10 | 11 | 4. [Elements of AI](https://www.elementsofai.com/): a series of free online courses created by Reaktor and the University of Helsinki. 12 | -------------------------------------------------------------------------------- /computer_science/server/curl.md: -------------------------------------------------------------------------------- 1 | ## curl 2 | 3 | ##### 어쩌다 검색하게 되었나 4 | 연구실 macbook에 pip를 설치하고 싶은데, 패키지 매니저의 도움을 받기 위해 homebrew를 설치했다. 5 | 그런데 애석하게도 뭐가 잘 풀리지 않아서 [pip installing 문서](https://pip.readthedocs.io/en/stable/installing/)의 도움을 받고자 했다... 6 |
요 튜토리얼의 첫 단계는 바로 ```To install pip, securely download get-pip.py``` , 7 | 귀찮음을 이기지 못하고 모든 것을 명령어로 해결할거야!! 라며 구글링을 시작했고, 언젠가 복사 붙여넣기 해넣었던 명령어 curl을 떠올렸다. 8 | 9 | ##### 그래서 찾아본 문서 10 | [Downloading files with curl](http://www.compciv.org/recipes/cli/downloading-with-curl/) 11 | 12 | ##### 어떻게 했나 13 | 검색해 보고서도 우선 무턱대고 14 | ``` 15 | curl (link) 16 | ``` 17 | 를 했다. 하라는 다운로드는 안되고 화면에 ```cat (filename)```한 마냥 get-pip.py의 내용이 주르륵 떴다. 아, 이거 아니구나. 그래서 이렇게 했다. 18 | ``` 19 | curl (link) --output (filename) 20 | ``` 21 | --output 옵션을 주고 저장하고 싶은 filename을 적어 넣었다! 만세! 다운로드 완료! 오늘 아침의 작은 발견 :) 22 | -------------------------------------------------------------------------------- /computer_science/doi.md: -------------------------------------------------------------------------------- 1 | # DOI 2 | 3 | 논문 본다고 IEEE같은데 들어가면 ```doi.org/뫄뫄``` 하는게 붙어있고, 해당 링크를 클릭하면 현재 링크(IEEE 뫄뫄)로 리다이렉트 해준다. 4 | 항상 이게 뭐지? 하고 그냥 링크인가보다 했는데 갑자기 궁금해져서 찾아본 결과.. 5 | 6 | 7 | Digital Object Identifier System에서 앞의 세 단어를 줄여서 DOI이다! 8 | 9 | > 디지털 컨버전스와 멀티미디어 가용성에 대한 추세에 따라 **디지털 객체 식별자(DOI)** 는 **디지털 네트워크 상에서 콘텐트의 식별을 관리**하기 위한 일반적인 프레임워크로 여겨졌다. 주요 특징으로 항구성, 네트워크 접근성, 다른 식별자와의 상호운용성, 공유된 내고장성(fault-tolerant) 인프라 및 다중 형태의 식별자들에 대한 해석가능성을 포함한다. DOI는 ISO 26324 표준이다. 10 | 11 | 라고 한다. 모든 유형의(정말?어떤?) 객체에 대한 "디지털 식별자(digital identifier)"이다. 12 | 13 | 앞서 언급한, ```doi링크를 클릭하면 객체 링크로 *리다이렉트*해준다```는 정확하게는 DOI의 **해석resolution**이라고 한다. 14 | (리다이렉트는 해석의 구성 요소 중 하나다.) 15 | 16 | 17 | https://www.doi.org/ 18 | 19 | DOI 시스템 홈페이지도 있고, 20 | 한국어 [DOI documentation](https://www.doi.org/doi_handbook/translations/korean/doi_handbook/TOC.html) 도 있다! (신기) 21 | -------------------------------------------------------------------------------- /computer_science/machine_learning/quantile.md: -------------------------------------------------------------------------------- 1 | # Quantile 2 | - 아니 글쎄 [태양광 발전량 예측 AI 경진대회](https://dacon.io/competitions/official/235680/codeshare/2033?page=1&dtype=recent&ptype=pub)의 3 | 평가 기준이 Pinball Loss라지 뭐예요? 4 | - Medium Post [A Tutorial on Quantile Regression, Quantile Random Forests, and Quantile GBM](https://medium.com/analytics-vidhya/a-tutorial-on-quantile-regression-quantile-random-forests-and-quantile-gbm-d3c651af7516)를 5 | 정리해 보겠습니다. 6 | 7 | ##### Contents 8 | - [What are the advantages of QR?](#advantages-qr) 9 | 10 | * * * 11 | #### What are the advantages of QR? 12 | - QR: Quantile Regression 13 | - OLS는 mean에 대한 예측만 하는 데 반해 QR은 target 변수 전체의 조건부 분포 14 | - Quantile Regression은 target distribution을 예측하지 않는다(?) 15 | 16 | ```python3 17 | ``` 18 | 19 | 20 | * * * 21 | #### Keyboard Shortcuts 22 | -------------------------------------------------------------------------------- /computer_science/automata/NP.md: -------------------------------------------------------------------------------- 1 | # NP 2 | 3 | ``` 4 | A decision problem^ is in NP if, whenever the answer for a particular instance is 5 | "yes", there is a simple proof of this fact. 6 | ``` 7 | \^ decision problem : yes-no로 대답할 수 있는 문제 8 | 9 | NP문제는 polynomial time 해법을 모르지만 yes instance가 주어질 때 그것이 맞는지는 간단하게(P time에) 확인할 수 있는 문제이다. 10 | 11 | 그래서 일반적으로 *Polynomial time 해법이 없다*고 알려져 있지만, 그걸 증명한 사람은 아무도 없다! (엄밀하게는 P time 해법이 있는지 없는지 모른다는 뜻이다.) 12 | 13 | ## NP의 공식적인 정의 14 | 15 | NP is the class of problems A of the following form: 16 | ``` 17 | x is a yes-instance of A if and only if there exists a w such 18 | that (x, w) is a yes-instance of B, 19 | 20 | where B is a decision problem in P regarding pairs (x, w), 21 | |w^| = poly(|x|), and |.| is the number of bits to represent. 22 | ``` 23 | \^ w : *witness* or the *certificate* of the fact that x is a yes-instance of A. 24 | -------------------------------------------------------------------------------- /computer_science/math/distribution.md: -------------------------------------------------------------------------------- 1 | # distribution 2 | 3 | - [Normal Distribution](#normal) 4 | 5 | 6 | * * * 7 | ### Normal Distribution 8 | - a.k.a. Gaussian Distribution 9 | - pdf는 아래와 같다. μ 를 mean으로, σ 를 표준편차로 하는 분포다. 10 | 11 | ![수식](https://latex.codecogs.com/gif.latex?%5Cinline%20%5CLARGE%20f%28x%29%3D%7B%5Cfrac%20%7B1%7D%7B%5Csigma%20%7B%5Csqrt%20%7B2%5Cpi%20%7D%7D%7D%7De%5E%7B-%7B%5Cfrac%20%7B1%7D%7B2%7D%7D%5Cleft%28%7B%5Cfrac%20%7Bx-%5Cmu%20%7D%7B%5Csigma%20%7D%7D%5Cright%29%5E%7B2%7D%7D) 12 | 13 | - symmetric 14 | - unimodal 15 | - asymptotic 16 | - the mean, median, and mode are all equal. 17 | - μ=0, σ=1일 때 표준정규분포(standard normal distribution)라고 부른다. 18 | - normal distribution을 따르지만, 평균과 표준편차가 서로 다른 집단을 비교하기 위해 정규분포를 표준화(μ=0, σ=1)한다. 19 | - 표준화는 어떻게 하데이터 집단에서 μ를 빼고 σ로 나눠준다. 20 | - 가장 기본이 되는 분포인데 볼 때마다 흠칫 한다... 21 | -------------------------------------------------------------------------------- /computer_science/eps.md: -------------------------------------------------------------------------------- 1 | > 파일 이름이 ```eps.md```인게 마음에 든다. 2 | 3 | ### eps란? 4 | - 프린터 출력을 제어하는 스크립트인 PostScript에서 파생 5 | - 벡터 이미지에 해당 6 | 7 | 8 | ### plt.savefig() 를 사용해 eps 저장하기 9 | 10 | ```python3 11 | #plt.subplots_adjust(left=0.3, right=0.9, bottom=0.3, top=0.9) 12 | #plt.tight_layout() 13 | plt.savefig('./epsname.eps', format='eps', bbox_inches = 'tight', pad_inches=0, dpi=2000) 14 | ``` 15 | 16 | - ```plt.tight_layout()```의 경우 ```ax = fig.add_axes()```로 생성한 ax와는 호환이 되지 않는다. 17 | - ```bbox_inches='tight'```option을 주면 한 페이지에 모두 들어가도록 내용물을 자동 조정한다. 18 | (정확히는 모든 내용물을 포함하는 박스를 찾아 맞춘다.) 19 | - ```pad_inches=0```는 말 그대로 주변 패딩의 정도이다. 20 | 21 | 22 | ### 사실 이런 문제일 수도 있다. 23 | - Windows 운영체제에서는 eps 파일을 볼 수 없다...그래서 [eps viewer](https://epsviewer.org)를 사용하고 있는데, 24 | 제대로 생성한 eps 파일이더라도 뷰어에서 잘려보일 수 있다... 따라서 Windows에서 작업 중 파일이 이상하다 싶으면 25 | 1. mac OS에서 열어본다 26 | 2. (나의 경우에는 latex) eps를 적용할 응용프로그램에 넣어서 확인해보자. 27 | -------------------------------------------------------------------------------- /computer_science/math/relation.md: -------------------------------------------------------------------------------- 1 | ## Relation 2 | 3 | 책을 읽다 보니 reflexive, symmetric, transitive에 대한 정의를 배경 지식이라고 적어놓았더라. 4 | 그러나 안타깝게도 배경 지식이 전혀 없었다... 애도를 표하며 youtube 강의 영상을 찾아보았다. 5 | 이산수학 혹은 집합론에서도 해당 내용을 기본적으로 다루는 것 같다. 6 | 7 | #### 일반적인 relation 8 | ###### youtube link: [[Discrete Math 1] Relations](https://youtu.be/FI6j5QZNVx0) 9 | 10 | xRy라고 함은 x랑 y가 모종의 관계가 있음을 의미한다. 그것은 부등호 기호일 수도 있고, xRy라고 쓰고 x-y!=0 일 수도 있다. 정하기 나름이라는 말씀. 11 | 일반적으로 3가지 relation을 이야기 한다. 그 3가지는 다음과 같다. 12 | - Reflexive : xRx이 성립하는가? 13 | - Symmetric : xRy이면 yRx가 성립하는가? 14 | - Transitive : xRy이고 yRz이면 xRz가 성립하는가? 15 | 16 | 17 | #### 집합에서의 relation 18 | ###### youtube link: [Reflexive, Symmetric, and Transitive Relations on a Set](https://youtu.be/q0xN_N7l_Kw) 19 | A Relation on A is a relation from A to itself. 20 | 아. 그러니까, A안의 모든 원소에 대해 relation이 성립하는가를 보아야 한다는 말 같다! 집합 A가 관계 R에 대하여 닫혀 있는가? 21 | 집합 A를 directed graph라고 생각하면 조금 이해가 쉬울까? 하는 제안을 해본다! 22 | 23 | -------------------------------------------------------------------------------- /bowoo.md: -------------------------------------------------------------------------------- 1 | > 누가 시키지 않았지만 자연스레 관심을 가지고 관찰하게 되는 것이 사랑일까요. 2 | 그렇게 생각하기에 시작하는 저에 대한 소소한 관찰일지입니다. 3 | 열세살 즈음 싸이월드에 적던 100문 100답처럼 느껴질 수도 있겠어요. 4 | 만약 이 글을 누군가 보게 된다면 *어, 나도 그런데!* 하는 부분에서 보편적인 보우를 느끼고 *오~ 그렇단 말야?* 하는 부분에서 특별한 보우를 느껴주세요! 5 | 6 | 2019.03 7 | - 지금 이 페이지에 정답을 적지 않아도 된다고 생각하면서도 타자를 치는 손가락은 망설이고 있다. 8 | - 아르바이트 하는 중에는 커피보다 아이스티를 더 선호한다. 라멘 국물이 짭짤하기 때문일까? 라고 생각한다. 머리 속이 복잡하여 정리가 되지 않을 때 바닐라라떼를 찾는다. 9 | 10 | 2019.04 11 | - 잠을 연속적으로 잘 자지 못하거나 스트레스를 받으면 위통을 느낀다. 보충제를 잘 챙겨먹어야겠다고 다짐하는 요즈음이다. 12 | 13 | 2020.02 14 | - 같은 걸 먹고도 탈이 더 잘난다. 빼도박도 못하게 연약한 위장과 그렇지 못한 체력(이렇게 생각해서 탈이 더 잘 나는 것 같기도...) 15 | 16 | ###### 별로 새롭지 않은 올 타임 보우 17 | - 마피아를 진짜 못한다. 의사인데 첫 턴에 의심받고도 스스로 살려야 한다는 정도도 모르는 매직 18 | - 매우 잘 먹는 편이다. 19 | - 가사가 많은 노래를 좋아하고, 중학생때부터 제이팝을 즐겨 들었다. 20 | - 편지, 쪽지를 좋아한다. 받는 것도 쓰는 것도 좋아하는 편 21 | - 아주 미래의 업으로, 배워주는 것을 하고 싶다. 22 | - 사람을 잘 기억한다. 얕고 넓게... 23 | - 너무 기본 레벨부터 공부하고 싶어해서 탈이다 24 | - 싫은 사람과도 웃으며 이야기할 수 있다. 25 | - 책 읽는 것을 좋아한다. 책 표지 보는 건 더 좋아하지만.. 26 | -------------------------------------------------------------------------------- /computer_science/python/cache.md: -------------------------------------------------------------------------------- 1 | # cache 2 | 3 | python 하는 사람이라면 standard library에 lru_cache를 알아야한다는 내용을 듣고 이름이 익숙한데... 싶어서 찾아본 내용 4 | 5 | 6 | - Cache hit: CPU가 원하는 데이터가 캐시에 있다! 7 | - Cache miss: CPU가 원하는 데이터가 캐시에 없다ㅜ 8 | - Hit ratio: (# of cache hit) / (# of total access) 9 | 10 | 11 | 12 | 재밌는건 python에서는 데코레이터로 lru cache를 쓸 수 있다는 것이다! 13 | ```python3 14 | from functools import lru_cache 15 | 16 | @lru_cache(maxsize=None) 17 | def fibonacci_cache(n): 18 | if n < 2: 19 | return n 20 | return fibonacci_cache(n-2) + fibonacci_cache(n-1) 21 | 22 | ``` 23 | 24 | - cache memory? 25 | - database cache? 26 | 27 | 28 | 29 | 30 | 31 | ###### resources 32 | - [컴퓨터 구조 - LRU 알고리즘](https://silentcargo.tistory.com/118) 33 | - [Every Python Programmer Should Know Lru_cache From the Standard Library](https://medium.com/better-programming/every-python-programmer-should-know-lru-cache-from-the-standard-library-8e6c20c6bc49)by Fabian Bosler 34 | -------------------------------------------------------------------------------- /book/this_or_that.md: -------------------------------------------------------------------------------- 1 | # 이러지도 저러지도 못하는 당신에게 2 | 3 | > 사람이 가장 힘들 때는 이게 아니라는 걸 알면서도 그걸 할 수밖에 없을 때입니다. 4 | 5 | 2020.01.22 6 | 7 | 네이버 책 [이러지도 저러지도 못하는 당신에게](https://book.naver.com/bookdb/book_detail.nhn?bid=15519188)
8 | 9 | 강주원 산문집 10 | 비로소 11 | 12 | . 13 | 14 | . 15 | 16 | #### 책 속의 말들 17 | 18 | ### 선택 앞에서 주저하는 당신에게 19 | > 우린 항상 권태와 불안 사이를 왔다 갔다 하며, 둘 사이의 어느 지점에 서 있을 수밖에 없는 존재라는 것. 그래서 중요한 건, 그 사이에서 균형을 잃지 않고 나아가는 것이라는 말을 하고 싶었다. p.17 20 | 21 | > 하지만 중요한 건, 옳고 그름을 따지는 게 아니라 자신의 선택을 옳다고 생각하는 믿음이다. p.41 22 | 23 | > 불안의 원인이 자유라니. p.66 24 | 25 | > 내가 '낯설다'라는 감정을 '두려움'으로 착각한 게 아니었을까? p.83 26 | 27 | ### 다른 속도로 걷고 있는 당신에게 28 | > 무언가를 그만두는 것에 대한 사람들의 시선은 곱지 않다. (...) 별것도 아닌 일인데 무언가를 시작하고 무언가에 도전했다고 말하는 상대를 한것 치켜세워준다. 29 | 무언가를 그만퉈야, 무언가를 시작한 공간이 생기는 건데. p.132 30 | 31 | ### 관계 때문에 흔들리는 당신에게 32 | . 33 | 34 | 35 | ###### 후기 36 | - 마음을 울리지는 않지만, 굉장히 편안하게 읽었다. 어느정도 고민이 휘몰아치고 간 뒤 가볍게 읽기 좋은 책이라고 생각한다. 37 | - 작가가 아주 많이 고민한 내용이기에 너무나 간결한 글들이 하나의 주제의식을 가지고 간다. 38 | 39 | -------------------------------------------------------------------------------- /computer_science/aws_mysql.md: -------------------------------------------------------------------------------- 1 | ## 무슨 일이 있었냐면 2 | 3 | 프로젝트를 하는데 머신러닝 리더 오빠가 AWS 서버의 Mysql을 연결하려는데 에러메시지가 뜬다고 연락이 왔다. 4 | 5 | 에러 메시지는 다음과 같다. 6 | ``` 7 | "Can't connect to MySQL server on '(ip)' ([WinError 10061] 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다)" 8 | ``` 9 | 10 | 원인은 방화벽이 막혀 있었기 때문! 11 | 12 |
13 | 14 | 15 | 16 | #### 1. AWS inbound rule 추가 17 | > 처음 django 할 때 수도 없이 헤맸던 HTTP 포트 열어주는거랑 같은거 맞다. 18 | 19 | - Type에서 MYSQL/Aurora를 골라준다 20 | - Port range의 Default 값인 3306이 뜬다. 21 | - Source를 꼭 설정해주어야 한다. 오늘은 Anywhere로 해버렸다. 22 | 23 | #### 2. mysql configuration 파일(/etc/mysql/my.cnf)을 수정했어 24 | ``` 25 | bind-address=0.0.0.0 26 | ``` 27 | 을 추가. 내 경우에는 /etc/mysql/my.cnf 가 read-only인 바로가기였다. 포인터가 가리키는 파일을 열어 수정했다. 28 | 29 | #### 3. 그 다음에 mysql 재시작! 30 | ``` 31 | sudo systemctl restart mysql.service 32 | ``` 33 | 34 | 35 | 참고 링크 36 | - https://help.ubuntu.com/lts/serverguide/mysql.html 37 | - 티스토리 블로그 자바월드 [AWS에 설치된 MySQL DB를 외부 접속이 가능 하도록 설정](http://javaworld.co.kr/69) 38 | -------------------------------------------------------------------------------- /interest/keywords.md: -------------------------------------------------------------------------------- 1 | ## 각종 키워드 모음 2 | 3 | 17-12-27 4 | * Node MCU 5 | * ARM core 6 | * cross-compile 7 | * TTL 8 | * CMOS 9 | * Arduino (Sketch) 10 | * GPIO(General Purpose Input Output) 11 | * pull-up / pull-down 12 | * I2C (맥락: oled에 i2c 라이브러리 불러다 쓸 거야.) 13 | * clock timing 14 | * TX, RX 15 | 16 | 17 | 17-12-28 18 | * aws 19 | * Processing 20 | * ATmega328 21 | * ESP8266 22 | * SPI 23 | * polling 24 | * interrupt 25 | * TCP 26 | * nodejs 27 | * express 28 | * mysql 29 | * JSON (Javascript Object Notation) , XML 30 | 31 | 17-12-29 32 | * Javascript 33 | * Webkit 34 | * DOM 35 | * 오늘의 linux 명령어 36 | - node 37 | - ps -eaf |grep node 38 | * 발표 잘 하기 39 | 40 | 41 | 2018-01-02 42 | * "산출물" 43 | * 프로젝트? 44 | * fast follow 45 | * first moving 46 | * Scope(Quality), Time(Schedule), Resources 47 | * Flexibility matrix 48 | 49 | 50 | 2018-01-05 51 | * CI 52 | * TDD 53 | 54 | 55 | 56 | 2018-01-08 57 | * requirements 58 | * UML 59 | * Gantt chart 60 | * 범위, 일정, 비용 61 | * 전략 62 | -------------------------------------------------------------------------------- /computer_science/machine_learning/speedup.md: -------------------------------------------------------------------------------- 1 | # How to speed up my project 2 | 3 | ## pandas DataFrame 4 | 1. 단순 반복문 + loc, iloc으로 접근하면 매우 느리다. 5 | 2. ```iterrows()``` 메소드를 사용하면 조금 낫다. 6 | - 누군가는 ```itertuples()```메소드를 사용하는 것이 더 빠르다고 한다. ```iterrows()```의 경우 pandas Series를 return하기 때문에 상대적으로 속도가 느리단다. 7 | 3. pandas단에서의 vectorize를 하면 더 빠르다 8 | 4. numpy단에서의 vectorize를 하는 것이 가장 빠르다 9 | 10 | ## 각종 packages 11 | - Pandarallel https://github.com/nalepae/pandarallel 12 | - [Pandarallel — A simple and efficient tool to parallelize your pandas computation on all your CPUs](https://towardsdatascience.com/pandaral-lel-a-simple-and-efficient-tool-to-parallelize-your-pandas-operations-on-all-your-cpus-bb5ff2a409ae) by Manu NALEPA 13 | - Numba http://numba.pydata.org/ 14 | - numpy array로만 사용가능 (pandas DataFrame 안됨) 15 | - Multiprocessing https://docs.python.org/3.7/library/multiprocessing.html 16 | - https://github.com/PuneetGrov3r/MediumPosts/tree/master/SpeedUpYourAlgorithms 17 | 18 | -------------------------------------------------------------------------------- /computer_science/machine_learning/batch_normalization.md: -------------------------------------------------------------------------------- 1 | # batch normalization 2 | 3 | batch: training할 때 전체 데이터를 나누는 단위(?) 4 | normalization: normal distribution으로 만든다. mean과 standard deviation으로 정의하는, 정규분포 형태로 만들어준다. 5 | 6 | batch의 mean과 std를 가지고 정규분포를 만들어준다. 7 | 8 | ### 왜? 9 | hidden layer의 결과값은 input과 상이한 분포를 가질 수 있기 때문에. 10 | - [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://arxiv.org/abs/1502.03167) 11 | - [PyTorch nn.BathNorm1d](https://pytorch.org/docs/master/generated/torch.nn.BatchNorm1d.html#torch.nn.BatchNorm1d) 12 | 13 | ### RNN에 써도 돼? 14 | - [RECURRENT BATCH NORMALIZATION](https://arxiv.org/pdf/1603.09025.pdf) 15 | - 쉽게(?) 구현하는 건 어렵다. batch는 과거를 고려할 수 있는 단위가 아니다(?) 16 | - RNN류는 대신 [layer normalization](https://arxiv.org/abs/1607.06450)을 하기도 한다고. 17 | 18 | #### 구현체 19 | - https://github.com/hellozgy/bnlstm-pytorch/blob/master/bnlstm.py 20 | - https://github.com/jihunchoi/recurrent-batch-normalization-pytorch/blob/master/bnlstm.py 21 | -------------------------------------------------------------------------------- /computer_science/python/class.md: -------------------------------------------------------------------------------- 1 | # Python class에 대한 사실 몇가지 2 | 3 | ##### Contents 4 | - [런타임에 클래스 수정하기](#runtime-class-patch) 5 | 6 | * * * 7 | #### 런타임에 클래스 수정하기 8 | - [Run-time method patching in Python](https://tryolabs.com/blog/2013/07/05/run-time-method-patching-python/) 9 | - 위 글에서는 override 하는 것만 보여줬는데 충격적이게도 이런 것도 된다! 10 | ```python3 11 | class Student: 12 | def study(self, name): 13 | print(f"A student {name} is studying how to code") 14 | 15 | 16 | def rest(self, minute): 17 | print(f"... and is going to take {minute} minutes break!") 18 | 19 | Student.rest = rest 20 | ``` 21 | 하면 아래처럼 사용할 수 있다. 22 | ```python3 23 | s = Student() 24 | s.study("codingbowoo") 25 | s.rest(15) 26 | 27 | """ 28 | A student codingbowoo is studying how to code 29 | ... and is going to take 15 minutes break! 30 | """ 31 | ``` 32 | - 메소드 뿐만 아니라 오브젝트도 이렇게 할 수 있다. 33 | - 코드를 짜다 보면 클래스가 거대해질 때도 있고, 그럼 문제가 생기거나 기능을 추가하는 식의 일이 생길 때 코드를 읽기? 관리하기? 어려워질 수도 있는데 이 방법을 쓰면 보다 쉬울거 같다. 34 | -------------------------------------------------------------------------------- /book/hataraki_kata.md: -------------------------------------------------------------------------------- 1 | # 왜 일하는가 2 | 3 | > 왜 일하는가, 어떻게 일하는가 4 | 5 | 2020.01.25 ~ 6 | 7 | 네이버 책 [왜 일하는가](https://book.naver.com/bookdb/book_detail.nhn?bid=6247368)
8 | 9 | 이나모리 가즈오, 신정길 옮김 10 | 도서출판 서돌 11 | 12 | 정확한 제목은 **働き方―「なぜ働くのか」「いかに働くのか」**, 일하는 방법- 왜 일하는가, 어떻게 일하는가 이다. 13 | 14 | > 할 수 없다고 생각할 때가 그 일을 시작할 때 15 | 16 | 라는 구절이 너무 인상 깊어서, 이번 설에 읽으며 고민할 책으로 골랐다. 17 | 18 | 자칫 latte is horse~ you know~? 라고 여길 수도 있는 책이라고 생각한다. 19 | 그러나, 연구를 하는 사람으로써, 연구를 해왔던 사람인 이나모리 가즈오의 이야기는 와닿는 부분도 많았고 속이 뜨끔한 구절도 있었다. 20 | 21 | - 무슨 일이든 이룰 수 있다고 다짐하라. 22 | - 모두와 함께 일하고 기쁨을 나누어라. 23 | - 항상 긍정적으로 생각하고 행동하라 24 | - 다른 사람들에게 선의를 베풀어라. 25 | - 자신보다는 남을 먼저 배려하라. 26 | - 정직하고, 겸손하며, 노력을 아끼지 마라. 27 | - 남의 것을 탐하지 말고, 욕심을 멀리하라. 28 | - 모든 일이 뜻대로 된다고 믿어라. 29 | 30 | 31 | ###### 후기 32 | - 働き方 뿐만 아니라 生き方、考え方 (한국어 제목으로는 살아가는 힘, 생각하는 힘)도 있네... 33 | - 무슨 일이든 이룰 수 있고 모든 일이 뜻대로 된다고 믿는, 어쩌면 순수하고 무모하기까지 한 마음이 **틀리지** 않음을 이야기하고 있어 위로가 되었다. 34 | - 쉽게 감명받는 스스로를 부끄러워하지 않아도 되는구나, 하는 생각이 드는 책이었다. 35 | - 채찍질하지만 위로가 되는 책이라는 생각을 했다. 36 | -------------------------------------------------------------------------------- /computer_science/uri.md: -------------------------------------------------------------------------------- 1 | ## URI 2 | 3 | ##### 처음 들은 단어 4 | 5 | "서비스 플랫폼 형태가 uri / 서버 / 안드로이드 / iOS로 나뉘거든? 여기서 uri라는건 뭘까..." 6 |
7 | 지도 API를 찾던 친구가 단톡방에 던진 한마디가 화근이었다. 8 | 글씨체가 잘못해서(...) uri를 url로 보고, ```API로 url제공``` 이라고 신나게 검색해봤지만 마땅한 결과를 얻지 못하고 있었던 차에, 9 | 10 | ```URL이 아니고 URI네! ``` 11 | 12 | 한마디에 깨달음을 얻었다. 어제보다 아는게 많아진 하루 좋은 하루. 13 | 14 | ##### 그래서 URI가 뭔데? 15 | 16 | URI를 이야기하면서 내가 헷갈렸던 URL과의 비교를 하지 않을 수가 없다! 일단 둘이 무슨 뜻인데? 17 | - **U**niform 18 | - **R**esource 19 | - **I**dentifier 이고, **L**ocator 이다. 20 | 21 | URI는 어딘가에 있는 리소스 이름이고, URL은 그 리소스가 어디 있느냐에 대한 것이다.
22 | 그래서 URL는 URI지만, URI은 URL일 수 없다. URL --> URI
23 | 24 | URI는 그저 '이름'이다.
URL은 우리가 어떤 프로토콜을 써서 file에 access할 수 있는지도 알려준다! 25 | URL은 주소다. 프로토콜-호스트네임-경로-쿼리 26 | 27 | 28 | ###### 참고 블로그 29 | [웹 기본개념 - URL / URI / REST API](http://jinbroing.tistory.com/68) 30 | : 웹 기본 개념들이 짧게짧게 설명되어 있어서 좋았다! 31 | 32 | Youtube 영상 [What the difference is between a URI and a URL](https://youtu.be/NN_Zq9REW60) 33 | : Drupal 어쩌구저쩌구는 흘려도 괜찮을 것 같고, 앞부분의 설명이 뭔가 명쾌하게 들려...! 34 | -------------------------------------------------------------------------------- /finance/fama-french.md: -------------------------------------------------------------------------------- 1 | # Fama-French 2 | 3 | 4 | ### 파마-프렌치 3팩터 모델 5 | 6 | - 시장Market, 규모Size, 가치Value 3가지 팩터를 기반으로 하는 모델 7 | - CAPM(Capital Asset Pricing Model)의 한계점(Market Risk Only)을 극복하고자 한다. 8 | - CAPM 모델에 Size, Value 항목을 추가했다. 9 | - 규모가 작고, 가치가 높은 기업일수록 초과수익을 내는데 유리하다는 것을 증명한다. 10 | 11 | * * * 12 | 1. 시장 13 | - **MKT**:Market beta; 시장 수익률 14 | - 기존 CAPM 모델 15 | 16 | 2. 규모 17 | - **SMB**: Small minus Big; 소형주의 상대수익률 18 | - 무엇을? stock portfolio return 19 | - 대형주 대비 소형주의 초과 수익률 20 | 21 | 22 | 3. 가치 23 | - **HML**: High minus Low; 가치주의 상대수익률 24 | - 무엇을? BM ratio (Book-to-Market; 시장가치 대비 장부가치) 25 | - BM비율이 낮은 주식 대비 BM비율 높은 주식의 초과 수익률 26 | 27 | 28 | * * * 29 | 30 | ###### 참고자료 31 | - [Fama and French Three Factor Model](https://www.investopedia.com/terms/f/famaandfrenchthreefactormodel.asp) 32 | - 5팩터 모델도 있는 것으로 안다 33 | - [감정을 이기는 퀀트투자 스마트 베타: 퀀트 펀드매니저가 쓴 계량투자 입문서 현명한 베타를 통한 알파 추구](https://book.naver.com/bookdb/book_detail.nhn?bid=12722739), 김병규 , 이현열WATER BEAR PRESS(워터베어프레스)2017.11.06 34 | 35 | -------------------------------------------------------------------------------- /computer_science/machine_learning/evolutionary_programming.md: -------------------------------------------------------------------------------- 1 | # EP 2 | - Evolutionary Programming [위키피디아](https://en.wikipedia.org/wiki/Evolutionary_programming)
3 | - Genetic Algorithm [지난 TIL: Genetic Algorithm](https://github.com/codingbowoo/codingbowoo-resource/blob/master/stack/ML/genetic_algorithm.md) 4 | 5 | 유전자 알고리즘을 사용하는 일련의 프로그래밍 기법(?)이다. 다음과 같은 순서로 이루어진다.
6 | 출처 : [Genetic Algorithms + Data Structures = Evolution Programs](https://www.springer.com/gp/book/9783540606765)의 한국어판 7 | 1. 문제의 해를 위한 유전적 표현을 선택한다(본질적이고 문제의 의미를 잘 반영해야 하는데, 이건 온전히 프로그래머의 몫이다.). 8 | - *어떤 표현이 적합한지에 대한 가이드라인이나, 이것도 하나의 변수로 넣고 GA를 돌리면 안되나?* 9 | 2. 초기 개체individual을 생성한다. 이 때 랜덤하게 생성함을 기본으로 하지만 제약 조건이 있을 시 반영한다. 10 | 이 개체들에 기반한 해집단population이 진화 프로그램Evolutionary Programming의 시작이다. 11 | 3. 적합도fitness에 의해 해집단을 평가evaluate하는 평가함수를 선택한다. 12 | 4. 유전 연산자(crossover, swap, mutate 등)를 설계한다. 이 역시 프로그래머의 몫이며, 문제의 본질과 구속조건들을 고려해야 한다. 13 | 5. 프로그램에 필요한 다양한 매개변수들은 14 | 1. 프로그래머가 제공(아니! 또 내 몫이잖아!) 15 | 2. 감독 유전자 과정에 의한 통제를 거칠 수 있다. 16 | - 감독 유전자 과정: 17 | -------------------------------------------------------------------------------- /computer_science/machine_learning/facebook-prophet.md: -------------------------------------------------------------------------------- 1 | **Official documentation: [PROPHET; Forecasting at scale](https://facebook.github.io/prophet/)** 2 | 3 | - [Analysis of Stock Market Cycles with fbprophet package in Python](https://towardsdatascience.com/analysis-of-stock-market-cycles-with-fbprophet-package-in-python-7c36db32ecd0) 4 | by Yin-Ta Pan 5 | - Kaggle [Predicting Transactions - FB Prophet Tutorial](https://www.kaggle.com/armamut/predicting-transactions-fb-prophet-tutorial) 6 | - [Generate Quick and Accurate Time Series Forecasts using Facebook’s Prophet (with Python & R codes)](https://www.analyticsvidhya.com/blog/2018/05/generate-accurate-forecasts-facebook-prophet-python-r/) 7 | by ANKIT CHOUDHARY 8 | - [A Quick Start of Time Series Forecasting with a Practical Example using FB Prophet](https://towardsdatascience.com/a-quick-start-of-time-series-forecasting-with-a-practical-example-using-fb-prophet-31c4447a2274) 9 | by Yang Lyla 10 | 11 | 12 | 13 | bookmark 14 | - https://facebook.github.io/prophet/docs/trend_changepoints.html 15 | -------------------------------------------------------------------------------- /computer_science/math/math_markdown.md: -------------------------------------------------------------------------------- 1 | # Markdown 수식 2 | Github markdown 수식 입력하는 방법 3 | 4 | - 간단한 수식 (알파벳)은 https://www.htmlhelp.com/reference/html40/entities/symbols.html 에서 찾는다. 5 | - 복잡한 수식은 https://latex.codecogs.com/eqneditor/editor.php 에 입력하고, 렌더링을 마치면 (시간이 조금 걸린다) 6 | 1. 이미지를 마우스 우클릭, ```이미지 주소 복사``` OR 7 | 2. 다운로드 링크의 우클릭, ```링크 주소 복사```한 주소 내용 중 download를 latex로 바꿔준다. 8 | 9 | 그리고 마크다운 문서에 아래처럼 넣는다. 10 | 11 | ![캡션(설명)](복사한 링크 붙여넣기) 12 | 13 | # 예시 14 | ![sum a_i](https://latex.codecogs.com/gif.latex?%5Cinline%20%5CLARGE%20%5Csum%20a_i) 15 | 16 | 하면 아래처럼 보인다. (안보일 수도 있다... ) 17 | 18 | ![sum a_i](https://latex.codecogs.com/gif.latex?%5Cinline%20%5CLARGE%20%5Csum%20a_i) 19 | 20 | - 복잡한 수식의 경우 http://www.sciweavers.org/free-online-latex-equation-editor를 사용해도 된다. 사용 방법은 codecogs와 비슷하다. 21 | 아래처럼 수식을 확인할 수 있다. 22 | 23 | ![sum a_i](http://www.sciweavers.org/upload/Tex2Img_1587471184/render.png) 24 | 25 | 26 | - sciweavers나 codecogs나 비슷한데, sciweavers가 더 빠르지만 에러가 잦은 듯 하다. 27 | -------------------------------------------------------------------------------- /computer_science/server/hosts.md: -------------------------------------------------------------------------------- 1 | # hosts 2 | ``` 3 | sudo vi /etc/hosts 4 | ``` 5 | 6 | 오늘의 대화 7 | > 보우씨, 카프카 뭘로 붙어요? ip? 이번에 설정 바뀌면서 ip로 붙는거 안 될 수도 있대요. host 설정 해줘야 할 수도 있어요! 8 | 9 | 그리고 보우씨는 겁을 먹었습니다. 10 | 11 | ## /etc/hosts 12 | 알고 보니 ... `sudo vi /etc/hosts` 해서 host로 등록해주면 되는 거였다.
13 | 별 거 없고 `IP주소 Hostname Alias(생략가능)`만 적어주면 된다. 설정 후에는 재시작해야한다. 처음 개발환경 세팅할 때 이미 건드렸던 파일이다! 14 | 15 | https://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap9sec95.html 에 의하면 16 | 17 | 사연인즉슨(?) DNS를 참조하기 전에(name server가 없으면...) IP주소-host이름 매핑을 알아야 하는 경우가 있고 이 매핑을 저장하는 파일이 `/etc/hosts`다.
18 | 19 | 우리 서버가 Centos니까 레드햇 계열이라... /etc/hosts 파일을 우선 참고해 네임서버를 ip주소로 바꾸는구나. 20 | 21 | 22 | 위 링크에 뭔가 중요하다고 써있는 부분을 번역하자면 23 | - telnet이라 ftp 커넥션에 대한 타임아웃(시간초과)는 client IP를 DNS로 resolve하려고 할 때 발생하는데, 24 | - DNS 구성이 제대로 되어있지 않거나/ client machine이 DNS에 등록이 되어있지 않거나가 그 이유이다. 25 | - DNS lookup이 timeout될 때 까지 기다려야 해서 로그인 프롬프트가 뜨기까지 몇 분을 공으로 날려먹을 수 있다... 26 | 그러니 telnet이나 ftp 서비스를 실행하고 DNS를 쓰지 않을 때는 꼭 /etc/hosts 를 작성하도록 하자. 27 | 28 | 29 | ## 이모저모 30 | - 그럼 설정이 바뀌면서 네임서버가 날아가나보다... 31 | -------------------------------------------------------------------------------- /computer_science/python/timestamp.md: -------------------------------------------------------------------------------- 1 | # Timestamp 2 | 3 | DataFrame으로 시계열 자료를 다루다 보면 친해지는 Timestamp 4 | 5 | 6 | csv파일에서 pandas의 ```read_csv()``` 함수를 읽어올 때 ```parse_dates```옵션을 주면 index를 7 | ```pandas.core.indexes.datetimes.DatetimeIndex```로 할 수 있다. 8 | 9 | 10 | 이 때 DatetimeIndex 내부의 element 하나하나는 예를 들자면 아래처럼 생겼다. 11 | 12 | ``` 13 | Timestamp('1963-07-31 00:00:00') 14 | ``` 15 | 16 | 자료형을 확인해보면 ```pandas._libs.tslibs.timestamps.Timestamp```라고 나온다. 17 | 18 | 19 | 이 Timestamp를 다룰 때 유용하게 사용하는 함수 두 가지를 투척한다. 20 | 21 | 1. Timestamp를 원하는 문자열 모양으로 바꾸기 **strftime** 22 | ```python3 23 | import pandas as pd 24 | 25 | # df 라는 DatetimeIndex를 가지는 DataFrame이 있다고 가정하자 26 | # df.index[0] 을 print한 결과가 2020-03-04 00:00:00일 때 27 | 28 | df.index[0].strftime("%Y--%m--%d") 29 | 30 | """ 31 | Out: 32 | 2020--03--04 33 | """ 34 | 35 | ``` 36 | 37 | 2. 날짜(숫자) 문자열을 Timestamp로 바꾸기 **to_datetime** 38 | ```python3 39 | import pandas as pd 40 | 41 | pd.to_datetime('20200304') 42 | 43 | """ 44 | Out: 45 | 2020-03-04 00:00:00 46 | """ 47 | ``` 48 | -------------------------------------------------------------------------------- /computer_science/git/git_user.md: -------------------------------------------------------------------------------- 1 | 2 | ## git user 설정 3 | git user설정을 안한 채로 자꾸 commit하니까 요런 문구가 떴다. 4 | 5 | [master 5988344] add .gitignore 6 | Committer: BOWOO JANG 7 | Your name and email address were configured automatically based 8 | on your username and hostname. Please check that they are accurate. 9 | You can suppress this message by setting them explicitly. Run the 10 | following command and follow the instructions in your editor to edit 11 | your configuration file: 12 | 13 | git config --global --edit 14 | 15 | 16 | After doing this, you may fix the identity used for this commit with: 17 | 18 | git commit --amend --reset-author 19 |     20 | 다음 커밋을 할 때는 요 멘트들이 나왔다. 21 | 22 | You can suppress this message by setting them explicitly: 23 | 24 | git config --global user.name "Your Name" 25 | git config --global user.email you@example.com 26 | 27 | After doing this, you may fix the identity used for this commit with: 28 | 29 | git commit --amend --reset-author 30 | 31 | 하라는대로 했다...! 32 | 33 | * * * 34 | 알아봐야 하는 것 : .gitignore로 특정 폴더 무시하는 방법 ㅠㅅㅠ 35 | -------------------------------------------------------------------------------- /computer_science/shell/powershell.md: -------------------------------------------------------------------------------- 1 | # Windows Powershell 2 | 3 | ##### Contents 4 | - [Powershell에서 zip파일 관리하기](#unzip-powershell) 5 | 6 | * * * 7 | #### Powershell에서 zip파일 관리하기 8 | - 출처 [How to Zip (and Unzip) Files Using PowerShell](https://www.howtogeek.com/670314/how-to-zip-and-unzip-files-using-powershell/) 9 | 10 | - 사건 경위 11 | 12 | Windows+conda 환경에서 jupyter notebook을 실행시켜 놓은 코딩보우는 서버에 올린 zip파일을 unzip 하고 싶다!
13 | 어찌저찌 ```conda install -c conda-forge unzip``` 했으나 사용 방법을 알 길이 없었는데...
14 | 찬찬히 현재 상황을 살펴 봅시다. 15 | 1. jupyter 기본 화면에서 우측 상단의 ```new```를 누르고 ```Other:``` 아래의 **Terminal**을 눌러 터미널 하나를 열었습니다. 16 | 2. 앗! 리눅스 커맨드라인이 아니군요! 그럼 뭔가요? 17 | ``` 18 | Windows PowerShell 19 | Copyright (C) Microsoft Corporation. All rights reserved. 20 | ``` 21 | 그렇습니다. 파워쉘이었던 것입니다.
22 | 그럼 검색해야죠! 뭐라고? **How to unzip Powershell**이라고! 23 | 24 | - 핵심만 추려볼까요? 25 | 26 | **Powershell에서 zip하기** 27 | ``` 28 | Compress-Archive -LiteralPath zip할파일들경로 -DestinationPath zip결과파일경로 29 | ``` 30 | 31 | **Powershell에서 unzip하기** 32 | ``` 33 | Expand-Archive -LiteralPath zip파일경로 -DestinationPath unzip할경로 34 | ``` 35 | -------------------------------------------------------------------------------- /book/smoke_gets_in_your_eyes.md: -------------------------------------------------------------------------------- 1 | # 잘해봐야 시체가 되겠지만 2 | 3 | > 유쾌하고 신랄한 여자 장의사의 좋은 죽음 안내서, 잘해봐야 시체가 되겠지만 4 | 5 | 2020.02.21 ~ 2020.02.23 6 | 7 | 네이버 책 [잘해봐야 시체가 되겠지만](https://book.naver.com/bookdb/book_detail.nhn?bid=16214992)
8 | 9 | 케이틀린 도티CAITLIN DOUGHTY, 임희근 옮김 10 | 11 | 12 | 원래 제목은 **SMOKE GETS IN YOUR EYES** & Other Lessons from the Crematory 이다. 13 | 14 | 15 | 영어 제목을 들으면 [The Platters - Smoke Gets In Your Eyes](https://youtu.be/H2di83WAOhU)부터 떠오른다.
16 | 이 노래에서의 Smoke Gets In Your Eyes는 사랑에 눈이 멀었다는 뜻인데... 17 | 18 | When your heart is on fire, you must realize smoke gets in your eyes. 19 | When a lovely flame dies, smoke gets in your eyes. 20 | 21 | 사랑을 해서 가슴에 불이 나면, 연기가 눈에 들어와 눈물이 날 거야. 그 사랑의 불씨가 꺼지면 연기가 눈에 들어와 눈물이 날 거야.
22 | 23 | 너무 좋아하는 가사고 내용인데, 아마 이 책에서는 화장장에서의 연기를 이야기하는 것 아닐까, 생각해본다.
24 | 수없이 많은 사람들을 태우고, 수없이 많은 사람들을 만나며 케이틀린이 죽음을 대하는 태도가 바뀌는 것을 볼 수 있다. 25 | 26 | ###### 후기 27 | - 유쾌하고 신랄하다기엔 한국적인 해학(...)과 적나라함을 느꼈다. 28 | - 식사를 하면서, 특히 죽(...)을 먹으면서 보기엔 조금 힘들 수도 있는 책이다. 자꾸 사람들을 태우고 녹는 통에. 29 | - 굉장히 많은 에피소드가 지나간다. 내용적으로 많다는 생각을 했다. 30 | - 그만큼 죽음이라는 주제에 대해 고민해볼 기회도 많은 책이다. 작가는 무언가 결론에 도달했으나 나는 아직인 걸로! 31 | 32 | 33 | -------------------------------------------------------------------------------- /computer_science/apache_errorlog.md: -------------------------------------------------------------------------------- 1 | ## apache error log 2 | 3 | 결론부터 말하자면 4 | ``` 5 | /var/log/apache2/error.log 6 | ``` 7 | 8 | **500 Internal Server Error**가 뜨면 일단 막막하다. 마치 C 프로그래밍하다가 segmentation error 가 뜨던 것과 느낌이 비슷했다. (물론 segmentation error가 메모리 접근에서 틀려먹어서 나오는 에러임을 알고 나서는 적당히 눈버깅이 가능해졌다..) 9 | 10 | Internal Server Error 화면에서 이렇게 말한다. 11 | "The server encountered an internal error or misconfiguration and was unable to complete your request." 12 | 13 | 만약 환경설정 중이었다면 높은 확률로 configuration에서 문제가 생겼을 것이라고 생각한다. 나는 venv상태에서 django와 apache 설정 중이었고, 14 | 15 | - settings.py 16 | - wsgi.py 17 | - /etc/apache2/apache2.conf 18 | - /etc/apache2/sites-enabled/000-default.conf 19 | 20 | 네 개의 파일을 수정중이었다. 그런데 어디서 틀렸는지 도통 모르겠는데, 접때 나의 환경설정을 도와주던 후배가 apache error log를 찾아보던 기억이 나서 'apache error log location'이라고 구글링해서 알게 된 것이 바로 다음과 같다. 21 | 22 | ``` 23 | /var/log/apache2/error.log 24 | ``` 25 | 26 | 후기: 그래서 에디터에, ```cat /var/log/apache2/error.log``` 해보니 어디서 틀렸는지 찾기가 수월해졌다. 27 | 28 | 29 |
30 | 31 | ###### 참고 링크들 32 | - (슥 훑어본) MDN [Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) 33 | - [Django 및 WSGI 설정하기](http://tronzebk.tistory.com/5) 34 | -------------------------------------------------------------------------------- /computer_science/machine_learning/linear_regression.md: -------------------------------------------------------------------------------- 1 | ## linear regression 2 | 3 | #### 간단한 용어 정리 4 | - intercept : linear regression에 사용할 상수 부분을 의미한다. 5 | 6 | 7 | #### 용례 8 | ```python3 9 | frames= [df_monthly.iloc[:, 0:5], df_monthly.iloc[:, 5+1]] 10 | X = pd.concat(frames, axis=1) # dataframe of X 11 | y = df_monthly.iloc[:, 5+2] # series of dependent variable 12 | X = sm.add_constant(X) 13 | 14 | # Note the difference in argument order 15 | model = sm.OLS(y, X) 16 | results = model.fit() 17 | 18 | # Print out the statistics 19 | results.summary() 20 | ``` 21 | 22 | #### various linear regression packages 23 | - Wolfram [Linear Regression Package](https://reference.wolfram.com/language/LinearRegression/tutorial/LinearRegression.html) 24 | - R [Multiple (Linear) Regression](https://www.statmethods.net/stats/regression.html) 25 | - Python [sklearn.linear_model.LinearRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html) 26 | - [Linear Regression Example](https://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html) 27 | - [statsmodels.regression.linear_model.OLS](https://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.OLS.html) 28 | -------------------------------------------------------------------------------- /computer_science/math/statistics.md: -------------------------------------------------------------------------------- 1 | #### A 2 | 3 | #### B 4 | - bootstrapping 5 | 6 | #### CDEFGHJIKLM 7 | 8 | #### N 9 | - null hypothesis 귀무 가설 H_{0} (H-null, H-zero) 10 | - (모집단의 어떤 특성에 대해 )기본적으로 참으로 추정하는 가설. 11 | 옳다는 것은 실험으로 증명할 수 없지만 가설이 잘못되었음은 실험으로 증명할 수 있는 경우 12 | - a null hypothesis is rejected if the observed data are significantly unlikely to have occurred if the null hypothesis were true. 13 | - 귀무가설을 참으로 했을 때 확률상 나오기 힘든 결과가 나타나면 14 | 대립가설(Alternative Hypothesis;귀무가설이 거짓일 경우 대안으로 참이 되는 가설 H_{1})을 채택한다. 15 | 16 | #### OPQ 17 | 18 | #### R 19 | - rejection region (or critical region) 20 | - the subset of the sample space, where H_{0} will be rejected 21 | - the complement is called the *acceptance region*. 22 | 23 | #### S 24 | - subsampling 25 | 26 | #### TUV 27 | 28 | #### W 29 | - Wald test 월드(왈드) 검정 https://en.wikipedia.org/wiki/Wald_test 30 | - 통계에서, 어떤 매개변수의 [constraint](https://en.wikipedia.org/wiki/Constraint_(mathematics)) 31 | (최적화 문제에서 solution이 만족해야 하는 조건)을 평가한다. 32 | - 평가는 귀무가설 하에서 어떤 point/interval estimate(표본에 기반한 추정치)와 hypothesized value간의 weighted distance에 기반한다. 33 | 이 때 weight는 추정의 정밀도이다. 이 weighted distance가 클수록 constraint가 유효하지 않을 가능성이 크다. 34 | 35 | 36 | #### XYZ 37 | -------------------------------------------------------------------------------- /computer_science/python/list.md: -------------------------------------------------------------------------------- 1 | # python list 2 | > 20191231의 이야기: 파이썬에서 가장 대표적이고 활용도가 좋은 자료형이 아마 list라고 생각한다. 3 | 여러 자료형을 한번에 담을 수 있다는 점에서 다른 컴퓨터 언어들과는 다른- 특이한 자료형이랄까? 2019년의 마지막 날에 정리하기 딱 좋은 주제다 :blush: 4 | 5 | ## 각종 조작 방법 6 | 아래는 자주 쓰는, 기발하다고 여기는 리스트 조작법이다. 7 | 8 | - 리스트 뒤집기 9 | ```python3 10 | 리스트[::-1] 11 | ``` 12 | 13 | - n열종대 줄세우듯 짝 짓는 리스트 만들기 14 | ```python3 15 | 리스트(zip(리스트1, 리스트2, ... , 리스트n)) 16 | ``` 17 | 18 | - 리스트 앞에 인덱스 만들어서 반복문 돌기 19 | ```python3 20 | for i, (리스트 내용) in enumerate(리스트): 21 | ``` 22 | 23 | ## list comprehension 24 | 파이썬에는 물론, 아주 간단한 작업을 편하게 해주는 lambda, map, filter의 함수형 기능이 있지만 처음 보는 사람들이 쓰기에는 모양새도 잘 이해가 안가고, 25 | 유연성이 떨어진다고 생각한다. 진입장벽이 좀 있는 함수형 대신 아래 list comphrehension을 사용해 보는 것은 어떨까? 26 | 27 | python3.7 [list comprehension documentation](https://docs.python.org/3.7/tutorial/datastructures.html#list-comprehensions) 28 | ```python3 29 | [ (x에 관한 식) for x in 리스트 if (x에 관한 조건) ] 30 | ``` 31 | 크게 두 부분으로 나눌 수 있는데, 32 | 33 | 1. ```(x에 관한 식) for x in 리스트```
34 | (리스트)를 돌면서 각 element에 관한 식을 수행한다. 35 | 36 | 2. ``` if (x에 관한 조건)```
37 | 이 부분은 선택적으로 넣으면 된다. 이 조건을 만족하는 x에 대해서만 앞의 (x에 관한 식)을 수행한다. 38 | 39 | ###### resources 40 | - [5 Python features I wish I had known earlier](https://towardsdatascience.com/5-python-features-i-wish-i-had-known-earlier-bc16e4a13bf4) by Eden Au 41 | -------------------------------------------------------------------------------- /computer_science/machine_learning/nlp_keyword_extraction.md: -------------------------------------------------------------------------------- 1 | # 키워드 추출 2 | 가장 간단한 방식의 키워드 추출은 전처리 -> 형태소 분석 -> 빈도 분석의 3단계로 나뉜다. 3 | - 키워드 추출은 NLP Task라고 하기도 조금 애매한 면이 있는 것 같다. 키워드를 뽑는 것 그 자체보다는 그 이후의 활용이 중요한 느낌... summarization이라든지... 4 | - 2021년에는 key-phrase의 추출을 연구한 논문들이 좀 있다. 5 | - ELSKE: Efficient Large-Scale Keyphrase Extraction 6 | - Phraseformer: Multimodal Key-phrase Extraction using Transformer and Graph Embedding 7 | 8 | ## 전처리 9 | - 특수문자 10 | - 대소문자 통합 11 | - 띄어쓰기 및 맞춤법 12 | - 불용어 제거 13 | - 정규화: ㅋㅋㅋㅋㅋㅋ -> ㅋㅋ 등으로 정리하는 것 14 | - 한국어에는 해당 없는: 빈도가 적은 단어, 짧은 길이의 단어 제거 15 | 16 | 17 | ## 형태소 분석 18 | - KoNLPy와 Mecab을 사용 19 | - [사용자 정의 사전도 추가](https://bitbucket.org/eunjeon/mecab-ko-dic/src/df15a487444d88565ea18f8250330276497cc9b9/final/user-dic/README.md)해준다. 20 | - 불용어 처리가 번거로워서 N으로 시작하는 품사(체언)를 다 살렸다. 21 | - NNG: 일반 명사, NNP:고유 명사, NNB:의존 명사, NR:수사, NP:대명사 22 | - [품사태그표](https://docs.google.com/spreadsheet/ccc?key=0ApcJghR6UMXxdEdURGY2YzIwb3dSZ290RFpSaUkzZ0E&usp=sharing#gid=4) 23 | 24 | 25 | ## 빈도 분석 26 | - 대표적인 방식: TF-IDF 27 | - 골머리 앓는 중... 28 | 29 | 30 | ## 그 외 31 | - Task로써의 Keyword Extraction이 궁금하면 [Keyword Extraction: papaerswithcode](https://paperswithcode.com/task/keyword-extraction)를 참고할 수 있다. 32 | Phraseformer 라는 Phraseformer: Multimodal Key-phrase Extraction using Transformer and Graph Embedding 33 | -------------------------------------------------------------------------------- /computer_science/machine_learning/scaler.md: -------------------------------------------------------------------------------- 1 | # Feature Scaling 2 | 3 | 머신러닝을 할 때, loss로 주로 MSE(Mean Squared Error)를 사용한다. MSE의 범위가 너무 커지면 학습에 어려움이 생길 것이다. 4 | 따라서 범위를 줄이기 위해 feature들을 적절히 scale하여 비슷한 크기를 가지게 해야 한다. 5 | 6 | ### Feature Scaling의 여러 방법 7 | 8 | 대표적인 것 몇 가지만 적는다. 9 | 10 | **Standardization** 11 | - mean=0이고 std=1인 분포로 바꿔준다. 12 | - 값들을 Z score로 바꾼다. 13 | - 평균을 기준으로 각 value가 떨어진 정도에 해당한다. 14 | 15 | 16 | **Min-Max Scaling** 17 | - 데이터를 [0,1] 범위로 변환하는 것이다. 18 | - (값-최솟값) / (최댓값-최솟값) 19 | - Standardization과 다른 점: outlier에 영향을 많이 받는다. 20 | 21 | 22 | **Mean Normalization** 23 | - -1과 1 사이의 값으로 바꿔준다. (mean=0) 24 | 25 | 26 | 27 | ### 어떻게 쓰는데요? 28 | 29 | 주로 scikit-learn 패키지에서 제공하는 함수들을 사용한다. 30 | 31 | ```python3 32 | #from sklearn.preprocessing import scale 33 | from sklearn.preprocessing import MinMaxScaler, Standartdcaler 34 | 35 | data = [] 36 | 37 | std_scaler = StandardScaler() 38 | data_scaled = std_scaler.fit_transform(data) 39 | 40 | minmax_scaler = MinMaxScaler() 41 | data_scaled = minmax_scaler.fit_transform(data) 42 | ``` 43 | 44 | 45 | ###### resources 46 | - [Why, How and When to Scale your Features](https://medium.com/greyatom/why-how-and-when-to-scale-your-features-4b30ab09db5e) 47 | 48 | ###### 이모저모 49 | - 2020.03.17 모델 개선의 여지를 찾다가 Feature Scaling으로 흘러들어왔다. 그리고 갑자기 standardize랑 normalize가 헷갈려서 쓰기 시작한거 맞다 50 | -------------------------------------------------------------------------------- /book/readme.md: -------------------------------------------------------------------------------- 1 | 읽은 책을 정리해두는 공간 2 | 3 | ### ㄱㄴㄷㄹ 4 | 5 | ### ㅁ 6 | - [매일 의존하며 살아갑니다](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/care_therapy.md) | 도하타 가이토, 김영현 옮김 | 다다서재 7 | 8 | ### ㅂ 9 | - [배움의 발견](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/educated.md) | 타라 웨스트오버Tara Westover 지음, 김희정 옮김 | 열린책들 10 | 11 | ### ㅅ 12 | - [생체리듬의 과학](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/the_circadian_code.md)| 사친 판다 지음, 김수진 옮김 | 세종서적 13 | - [실전 퀀트투자](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/quantitative_investment.md) | 홍용찬 | 이레미디어 14 | 15 | ### ㅇ 16 | - [왜 일하는가](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/hataraki_kata.md) | 이나모리 가즈오, 신정길 옮김 | 도서출판 서돌 17 | - [이러지도 저러지도 못하는 당신에게](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/this_or_that.md) | 강주원 | 비로소 18 | 19 | ### ㅈ 20 | - [정말 하고 싶은데 **너무 하기 싫어**](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/addiction_procrastination_and_laziness.md) | 로먼 겔페린 지음, 황금진 옮김 | 동양북스 21 | - 미리보기: 더굿북 네이버 포스트 연재 [정말 하고 싶은데 너무 하기 싫어](https://m.post.naver.com/my/series/detail.nhn?seriesNo=395336&memberNo=29566044) 22 | - [잘해봐야 시체가 되겠지만](https://github.com/codingbowoo/codingbowoo-resource/blob/master/book/smoke_gets_in_your_eyes.md) | 케이틀린 도티 지음, 임희진 옮김 | 반비 23 | 24 | ### ㅊㅋㅌㅍㅎ 25 | -------------------------------------------------------------------------------- /computer_science/machine_learning/dropout.md: -------------------------------------------------------------------------------- 1 | # Dropout 2 | 논문 [Dropout: A Simple Way to Prevent Neural Networks from Overfitting](http://jmlr.org/papers/v15/srivastava14a.html) 3 | 4 | - overfitting을 막기 위해 regularize(정규화) ~~개인적으로 standardization표준화와 종종 한국어가 헷갈린다~~하는 방법들 중 하나인 Dropout 5 | - 의도적으로 몇몇 값을 0으로 바꿔버린다. (forward-pass할 때 신경망의 연결을 끊는 것!) 6 | 7 | #### Pytorch의 예시 8 | - [PyTorch documentation Dropout layers](https://pytorch.org/docs/stable/nn.html#torch.nn.Dropout) 9 | - parameters 중 p 는 0이 되는 원소의 비율이다. 기본값은 0.5이고, 베르누이이항분포에 따라 랜덤하게 정한다. 10 | - ```torch.nn.LSTM```의 parameters 중에도 dropout이 있는데 이 때 기본값은 0이다.
11 | 자세한 것은 공식문서 참고하기 [PyTorch documentation LSTM](https://pytorch.org/docs/stable/nn.html#lstm) 12 | - inplace – If set to True, will do this operation in-place. Default: False 13 | - [FAQ] 앗! dropout은 training할 때만 사용해야 하는거 아닌가요? 그럼 test할 때는 dropout을 제외한 모델을 따로 만들어 사용해야 하나요? 14 | - A: 그건 아니고, 그저 test 전에 ```model.eval()```을 불러만 주십시오.
그럼 알아서 dropout을 건너뜁니다. 15 | - Q: 왜요?! 16 | - A: ```torch.nn.functional```의 구현을 보면 training=True일때만 dropout을 적용한다고 해요. 17 | 18 | 19 | ###### 참고자료 20 | - [SOURCE CODE FOR TORCH.NN.MODULES.DROPOUT](https://pytorch.org/docs/stable/_modules/torch/nn/modules/dropout.html) 21 | - [SOURCE CODE FOR TORCH.NN.FUNCTIONAL](https://pytorch.org/docs/stable/_modules/torch/nn/functional.html) 22 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch_internals.md: -------------------------------------------------------------------------------- 1 | LSTM구현의 detail이 보고 싶었을 뿐이고... 2 | 3 | 디테일은 ```LSTM```을 타고 ```RNNBase```을 거쳐 ```_VF```까지 왔는데 이친구의 상상도 못한 정체를 보았다. 4 | 5 | [_VF.py](https://github.com/pytorch/pytorch/blob/f70945b1c34ca730311bc211919107e5f9f26feb/torch/_VF.py) 6 | 7 | ```python3 8 | import torch 9 | import sys 10 | import types 11 | 12 | 13 | class VFModule(types.ModuleType): 14 | def __init__(self, name): 15 | super(VFModule, self).__init__(name) 16 | self.vf = torch._C._VariableFunctions 17 | 18 | def __getattr__(self, attr): 19 | return getattr(self.vf, attr) 20 | 21 | sys.modules[__name__] = VFModule(__name__) 22 | ``` 23 | 24 | 그럼 torch._C는 어디 있느냐! 했는데 아무리 찾아도 _C.py는 없었고, 아래 링크가 내가 찾은 답변이다. 25 | 26 | - [Where does `torch._C` come from?](https://discuss.pytorch.org/t/where-does-torch-c-come-from/2015/10) 27 | - [torch._C._functions](https://github.com/pytorch/pytorch/blob/ded3a3b317fbc8b165235c98f238c193e1482ad5/torch/csrc/autograd/functions/init.cpp#L239) 28 | 29 | c++ 이라, 조금 읽어보다가 눈물을 머금고 일단 후퇴했다...
30 | 31 | 추가로 32 | 33 | - [https://stackoverflow.com/questions/48874968/how-to-find-functions-imported-from-torch-c-in-source-code](https://stackoverflow.com/questions/48874968/how-to-find-functions-imported-from-torch-c-in-source-code) 34 | - [A Tour of PyTorch Internals (Part I)](https://pytorch.org/blog/a-tour-of-pytorch-internals-1/) 35 | -------------------------------------------------------------------------------- /computer_science/machine_learning/ml_flow.md: -------------------------------------------------------------------------------- 1 | # ML-flow 2 | 3 | 문제를 정의하고, 데이터를 준비하고, 알고리즘을 평가하고 결과를 개선하고 모델을 저장하고 예측을 하고 결과를 저장하고... 하는 과정, 4 | 같은 모델을 사용하지만 다른 데이터를 다룰 때 재사용 가능한 코드 만들기.... 이런 일련의, 머신러닝 실험 전체에 걸친 프로세스와 관련한 고민을 정리하는 문서. 5 | 6 | 미디엄 Towards Data Science에 올라온 아래 글을 처음 접하고 본 이미지에 실소를 터뜨렸다. 내 컴퓨터인가 ^^;
7 | 해당 글에서는 GNU make를 사용해 전체 workflow를 관리한다. 적용해보려면 조금 시간을 두고 읽어야겠는걸. 8 | 9 | - [Structure and automated workflow for a machine learning project](https://towardsdatascience.com/structure-and-automated-workflow-for-a-machine-learning-project-2fa30d661c1e) 10 | - [Structure and automated workflow for a machine learning project — part 2](https://towardsdatascience.com/structure-and-automated-workflow-for-a-machine-learning-project-part-2-b5b420625102) 11 | 12 | 13 | 그 외에도, 여러 회사들에서도 이런 workflow에 대한 고민을 가지고 있다. 14 | 대표적으로 Facebook의 FBLearner Flow - 재사용성과 유연성, 완전한 자동화에 대해 고민한다! 15 | - [Introducing FBLearner Flow: Facebook’s AI backbone](https://engineering.fb.com/ml-applications/introducing-fblearner-flow-facebook-s-ai-backbone/) 16 | : 2016년 글 17 | 18 | 19 | ### ML flow를 도와주는 도구들 20 | - [Weights&Biases](https://docs.wandb.com/) 21 | - [Sacred](https://github.com/IDSIA/sacred) 22 | - 함께 써요 [Omniboard](https://github.com/vivekratnavel/omniboard) 23 | - [Tensorboard in Pytorch](https://pytorch.org/docs/stable/tensorboard.html) 24 | - 시각화 도구 [Visdom](https://github.com/facebookresearch/visdom) 25 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch_tensorboard.md: -------------------------------------------------------------------------------- 1 | 자세한 것은 https://www.tensorflow.org/tensorboard/ 를 참고하자. 2 | 3 | 4 | 설치 5 | ```shell 6 | pip install tensorboard 7 | ``` 8 | 9 | 실행 10 | ```shell 11 | tensorboard --logdir=runs 12 | ``` 13 | 14 | # [Tensorboard in PyTorch](https://pytorch.org/docs/stable/tensorboard.html) 15 | 16 | 기본 세팅은 아래와 같다. 기록을 하는데 핵심이 되는 것은 ```SummaryWriter```다. 17 | ```python3 18 | import torch 19 | from torch.utils.tensorboard import SummaryWriter 20 | 21 | # Writer will output to ./runs/ directory by default 22 | writer = SummaryWriter() 23 | 24 | # 이렇게 comment를 붙일 수 있다. 25 | writer = SummaryWriter(comment="LR_0.1_BATCH_16") 26 | ``` 27 | 이 상태에서 모델을 부르고, 학습을 시킨다. 28 | 29 | 그런 다음 Tensorboard에서 확인하고 싶은 항목들을 추가해준다. 30 | 31 | 32 | scalar, histogram, image, matplotlib figure, video, audio, text, pr(precision/recall) curve, hyperparameter 등을 추가할 수 있다. 33 | ```python3 34 | writer.add_scalar('tagname(eg.Loss/train)', np.random.random(), 0) # tag, scaler_value, global_step=None 35 | writer.add_text('tagname', 'Lorem Ipsum', 0) # tag, text_string, global_step=None 36 | writer.add_graph(model) # model, input_to_model=None, verbose=False 37 | for i in range(5): 38 | writer.add_hparams({'lr': 0.1*i, 'bsize': i}, 39 | {'hparam/accuracy': 10*i, 'hparam/loss': 10*i}) 40 | ``` 41 | 42 | 마무리로 43 | ```python3 44 | writer.close() 45 | ``` 46 | 47 | 48 | -------------------------------------------------------------------------------- /computer_science/machine_learning/oop_in_ml.md: -------------------------------------------------------------------------------- 1 | # OOP in ML 2 | Object-Oriented Programming in Machine Learning 3 | 4 | 5 | 내가 슬슬 스스로 코드를 짜면서 아주 난처하게 여기는 순간들이 있었는데, 예를 들면 이런 거다. 6 | 7 | > **나: 머신러닝 모델 만들거다! train도 하고 test도 할거다!** 8 | 9 | 1. 인터넷의 튜토리얼: main에서 train도 test도 한다 10 | - ```class MLModel():``` 아래에는 ```__init__()```, ```forward()```, 그리고 가끔 ```init_hidden()```정도? 11 | - ~~그리고 대부분 패키지에서 제공하는 Dataset을 쓴다~~(이 문서와는 무관하나 나는 아주 난처해..) 12 | 13 | 2. 깃헙에서 찾은 누군가의 코드 : 모델 class 내부에 train, test를 메소드로 구현했다. 14 | - 사실 튜토리얼들 찾아보다가 이런 구성도 봤으나 지나쳤다 15 | - 물어볼 수가 없다 (여러 이유로) 16 | 17 | 3. 내 코드 : 없을 무 18 | 19 | 20 | 대략 ```???``` 한 상태가 되는데, 1은 따라하기 쉽지만 튜토리얼마다 내용이 조금씩 다르고, 보통 내 (특수한) 상황에 적용하려면 고생을 많이 한다. 21 | 2는 다소 복잡하므로 코드를 읽어내는 데 시간이 오래 걸리고, 이 코드의 작성자가 왜 이렇게 짰는지에 대한 고민이 필연적으로 따라온다. 22 | 보통 나는 고민을 많이 하다가 손을 늦게 움직이는 편(...) 23 | 24 | 그런데 적어도 **머신러닝 모델 클래스**에 대해서는 이런 고민을 좀 덜어줄 글을 발견했다! 25 | 26 | - [Object-oriented programming for data scientists: Build your ML estimator](https://towardsdatascience.com/object-oriented-programming-for-data-scientists-build-your-ml-estimator-7da416751f64) by Tirthajyoti Sarkar 27 | - [Understanding Object-Oriented Programming Through Machine Learning](https://dziganto.github.io/classes/data science/linear regression/machine learning/object-oriented programming/python/Understanding-Object-Oriented-Programming-Through-Machine-Learning/) by David Ziganto 28 | 29 | 30 | -------------------------------------------------------------------------------- /computer_science/server/rm.md: -------------------------------------------------------------------------------- 1 | # rm 2 | > 랩몬스터 아니고 linux command "rm" 맞습니다. 3 | 4 | #### 오늘의 검색어 5 | ```restore file after rm * ``` 6 | 7 | (보기만 해도 안타깝다...) 8 | 9 | ```rm (파일이름)``` 명령어는 파일에 해당하는 데이터와 파일 이름 사이의 연결을 끊고, 해당 메모리 공간을 쓰기 작업에서 사용 가능한 것으로 표시한다. 10 | 따라서 **```rm``` 하자마자**는, 엄밀하게 말하면, 데이터는 살아 있지만 더이상 파일 이름으로 해당 메모리에 접근할 수 없는 것이다. 11 | ```rm``` 자체를 되돌릴 수는 없다! [Linux rm command](https://www.computerhope.com/unix/urm.htm)를 참고하자. 12 | 13 | 혹시 ext3 또는 ext4 파티션에 위치한 파일을 삭제했다면 아래 링크와 유틸리티들을 확인해보자. 14 | - [Can files/directories deleted with rm be restored?](https://askubuntu.com/questions/6698/can-files-directories-deleted-with-rm-be-restored) 15 | - [extundelete](http://extundelete.sourceforge.net/) 16 | - [TestDisk](https://www.cgsecurity.org/wiki/TestDisk) 17 | 18 | 메모리에 내용이 덧씌워지지 않았다면, 내용검색을 통해 되살릴 수도 있겠다. 19 | - [Recovering accidentally deleted files](https://unix.stackexchange.com/questions/2677/recovering-accidentally-deleted-files) 20 | - [The Perl Script That May Save Your Life](https://etherealbits.com/2012/06/the-perl-script-that-may-save-your-life/) 21 | 22 | 그러나... 높은 확률로 복구가 불가능하므로... 23 | 24 | 1. 심호흡을 하고 25 | 2. 괜찮다고 스스로를 달래 진정시키고 26 | 3. 새롭게 코드를 짜는 것이 가장 빠른 복구 방법이다. 27 | 28 | #### 소 잃기 전에... 29 | 1. ```rm``` 명령어는 30 | 31 | - ```rm -i``` : *정말 지우시겠습니까?* 확인창이 한번 더 뜸 32 | - ```mv (휴지통경로)``` : 영영 삭제하지 않고 옮겨두기 33 | 34 | 에 alias 해두자..! 35 | 2. 백업, version control을 일상화 합니다. 36 | -------------------------------------------------------------------------------- /computer_science/shell/bashrc.md: -------------------------------------------------------------------------------- 1 | # 슬기로운 bashrc 생활 2 | 3 | 터미널을 쓰다 보면 언젠가는 만나게 되는 ```bashrc``` ! 4 | 5 | **bash** 는 GNU OS의 shell, 혹은 command language interpreter이다. 6 | 자세한 설명은 링크로 대체한다. [GNU bash manual 1.1 What is Bash?](https://www.gnu.org/software/bash/manual/html_node/What-is-Bash_003f.html) 7 | 8 | **rc**는 무려 run command의 줄임말이다. 그래서 우리는 ```.vimrc```, ```.zshrc``` 등 많은 rc파일들을 마주한다. 9 | 10 | bashrc를 수정하려고 보면 비슷한 이름의 파일들이 많다. 11 | ```.bash_history```, ```.baxh_logout```, ```.bash_profile```, ```.bashrc```... 12 | 그 중 헷갈리는 두 개의 차이를 살펴보자면 아래와 같다. 13 | 14 | - ```.bashrc``` **for non-login** shell (reload every time I start a new copy of bash) 15 | - ```.bash_profile``` **for login** shell. 보통 PATH와 같은 environment variable을 넣는다. 16 | 17 | .bashrc 파일을 수정한 후에는 새로운 bash 창을 열거나, 아래 명령어를 입력해야 수정한 내용을 적용할 수 있다. 18 | 19 | ```shell 20 | source ~/.bashrc 21 | ```` 22 | 23 | ```~/.bash_profile```에는 아래 코드를 추가해주었다. 24 | ```shell 25 | if [ -f $HOME/.bashrc ]; then 26 | source $HOME/.bashrc 27 | fi 28 | ``` 29 | 30 | ## alias 31 | .bashrc 파일을 수정하는 경우 가장 쉽게, 많이 접하는 명령어는 alias일 듯 하다! 32 | ```shell 33 | # 기본 용례 34 | alias rm='rm -i' 35 | 36 | # 2개 이상의 명령어를 한번에 실행하고 싶을 땐 ;로 구분한다 37 | alias cclear='clear;clear' 38 | ``` 39 | 40 | 41 | 그 외 다양한 alias를 확인할 수 있는 https://stuff.lhunath.com/.bashrc : [여기](https://stackoverflow.com/questions/902946/about-bash-profile-bashrc-and-where-should-alias-be-written-in) 답변에서 찾았따. 42 | 43 | -------------------------------------------------------------------------------- /interest/euthanasia.md: -------------------------------------------------------------------------------- 1 | # Euthanasia 2 | 3 | 엄청나게 생소한 이 단어의 뜻은 '안락사' 이다. 다른 말로는 '조력자살'.
4 | 신체적으로 심한 질환이나 불편함을 겪고 있는 사람만 조력자살이 가능하다. [기사](http://news.khan.co.kr/kh_news/khan_art_view.html?art_id=200911241728455#csidxd5737b6fc81f2a1a347ad03b02ba314) 5 | 6 | 기록하고 싶은 기사 목록이 있어 문서를 남긴다. 7 | 8 | - 서울신문 [존엄한 죽음을 말하다] 9 | - 실반 룰레이 디그니타스 공동대표 인터뷰 [죽음을 얘기하다 삶의 해결책을 찾기도 합니다](https://www.seoul.co.kr/news/newsView.php?id=20190306005003) 10 | - [파란 집에서 8시간, 노인들은 그렇게 생을 끝냈다](https://www.seoul.co.kr/news/newsView.php?id=20190307009002) 11 | - [결국.. 저는 오랜 친구의 안락사를 도왔습니다](https://news.v.daum.net/v/20190305190102940) 12 | - [친구가 택한 존엄한 죽음, 내겐 존엄하지 않았다](https://www.seoul.co.kr/news/newsView.php?id=20190307008012) 13 | - [죽음, 두렵지요 하지만 ‘끝’은 선택하고 싶어요](https://www.seoul.co.kr/news/newsView.php?id=20190311004005) 14 | - [2000명의 생각을 들었습니다…‘존엄한 죽음’ 에 대한 정답은 없었습니다](https://www.seoul.co.kr/news/newsView.php?id=20190313008007) 15 | 16 | 17 | * * * 18 | 안락사는 일반적인 자살과는 제법 다른 맥락에 있지만, 19 | 자살과 관련한 기사 밑에는 늘 밑의 문구가 붙어 있으므로 기록해두자면 20 | - [서울시정신건강증진사업](http://touch.mindspa.kr/main.asp)에서 우울 및 불안과 관련한 서비스를 제공하니 해봄직하고, 21 | - 본인이 속한 단체에서 상담서비스를 제공하는 경우라면 시도해보면 좋고, 22 | 23 | 좀 뜬금없지만 24 | 25 | - [한국기자협회 자살보도 윤리강령](http://www.journalist.or.kr/news/section4.html?p_num=5) 도 알아두면 좋겠다. 26 | 27 | > ※우울감 등 말하기 어려운 고민이 있거나 주변에 이런 어려움을 겪는 가족·지인이 있을 경우 28 | 자살 예방 핫라인 ☎1577-0199, 희망의 전화 ☎129, 생명의 전화 ☎1588-9191, 청소년 전화 ☎1388 등에서 29 | 24시간 전문가의 상담을 받을 수 있습니다. 30 | 31 | -------------------------------------------------------------------------------- /finance/measurement.md: -------------------------------------------------------------------------------- 1 | ## [Annualized Return](#), [Annualized Volatility](#) 2 | ## [Sharpe Ratio](#) 3 | Reward-to-volatility ratio;ratio of portfolio excess return to standard deviation 4 | - **excess return** : rate of return in excess of the risk-free rate 5 | 6 | ## [Information Ratio](#) 7 | Ratio of alpha to the standard deviation of diversifiable risk. 8 | - **benchmark error** Use of an inappropriate proxy for the true market portfolio. 9 | - **benchmark portfolio** Portfolio against which a manager is to be evaluated. 10 | 11 | ## [Skewness](https://www.investopedia.com/terms/s/skewness.asp) 12 | A measure of the asymmetry of a probability distribution. 13 | - skewness=0 : normal distribution 14 | - positive skewness : ^\ (tail on positive side) 15 | - negative skewness : /^ 16 | 17 | ## [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) 18 | Measure of the fatness of the tails of a probability distribution. 19 | Indicated probability of observing extreme high or low values. 20 | - high kurtosis: investeors will experience occasional "extreme" returns. 21 | - low kurtosis: has skinny tails 22 | > Relative to: Mesokurtic, Leptokurtic(skinny distribution, fatter tails), Platykurtic(skinny tails) 23 | 24 | ## [Maximum DrawDown](#) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | ###### Resources 34 | - [Bodie, Z., Kane, A., & Marcus, A. J. (2013). Investments: tenth edition. McGraw Hill Education](https://isbnsearch.org/isbn/0077861671) 35 | -------------------------------------------------------------------------------- /computer_science/papers.md: -------------------------------------------------------------------------------- 1 | Papers 2 | 3 | ## RNN 4 | - [A. Graves, A. Mohamed and G. Hinton, "Speech recognition with deep recurrent neural networks," 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, Vancouver, BC, 2013, pp. 6645-6649.](https://ieeexplore.ieee.org/abstract/document/6638947) 5 | - [Sutskever I, Vinyals O, Le QV. Sequence to sequence learning with neural networks. InAdvances in neural information processing systems 2014 (pp. 3104-3112).](http://papers.nips.cc/paper/5346-sequence-to-sequence-learnin) 6 | - [Cho, Kyunghyun, et al. "Learning phrase representations using RNN encoder-decoder for statistical machine translation." arXiv preprint arXiv:1406.1078 (2014)](https://arxiv.org/abs/1406.1078) 7 | - [Vinyals, Oriol, and Quoc Le. "A neural conversational model." arXiv preprint arXiv:1506.05869 (2015).](https://arxiv.org/abs/1506.05869) 8 | - [Chen, Xinlei, and C. Lawrence Zitnick. "Mind's eye: A recurrent visual representation for image caption generation." Proceedings of the IEEE conference on computer vision and pattern recognition. 2015.](https://www.cv-foundation.org/openaccess/content_cvpr_2015/html/Chen_Minds_Eye_A_2015_CVPR_paper.html) 9 | 10 | ## Others 11 | - [Aljundi, Rahaf, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. "Memory aware synapses: Learning what (not) to forget." In Proceedings of the European Conference on Computer Vision (ECCV), pp. 139-154. 2018.](https://arxiv.org/abs/1711.09601) 12 | -------------------------------------------------------------------------------- /interest/developer_culture/coc.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | https://en.wikipedia.org/wiki/Code_of_conduct 3 | 4 | 한국어로는 행동 지침, 행동 강령 등으로 번역하는 code of conduct는 말 그대로 '어떻게 행동하라'는 권고이다. 5 | 이제껏 만나본 CoC들은 어떤 행사나 단체를 운영할 때, 그 안에서 상호 존중과 원활한 상호작용이 일어날 수 있도록 노력하는 내용이었다. 6 | 7 | ### CoC 모음 8 | 9 | ###### Code of Conduct in Korean 10 | - [Spoqa Creators](https://github.com/spoqa/code-of-conduct) 11 | - [WTM Korea](https://wtm-korea-2018.firebaseapp.com/) (사이트 좌측 하단) 12 | - [PyCon Korea](https://github.com/pythonkr/pycon-code-of-conduct) 13 | - [Festa! FCOC](https://festa.io/code-of-conduct) 14 | 15 | ###### Code of Conduct in English 16 | - [Coursera](https://learner.coursera.help/hc/en-us/articles/208280036-Coursera-Code-of-Conduct) 17 | - [Linux Foundation](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8a104f8b5867c682d994ffa7a74093c54469c11f) (더이상 code-of-conflict가 아니다!) 18 | - 관련글 : [Linux 4.19-rc4 released, an apology, and a maintainership note](https://lkml.org/lkml/2018/9/16/167) 19 | - [Contributor Covenant](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html) 20 | - [Stack Overflow](https://stackoverflow.com/conduct) 21 | - 조금 다른 내용이지만, 읽어보면 좋을 [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) 22 | - [CVPR](http://cvpr2020.thecvf.com/node/479) 23 | - [numpy](https://numpy.org/devdocs/dev/conduct/code_of_conduct.html) 24 | 25 | 26 | ###### CoC는 아니지만 27 | - [카카오 AI 윤리](https://www.kakaocorp.com/page/responsible/aiEthics) 28 | -------------------------------------------------------------------------------- /interest/newsletters.md: -------------------------------------------------------------------------------- 1 | curated list of newsletters
2 | 이름에 걸린 링크는 구독 링크입니다. 3 | 4 | | 분야 | 이름 | 언제 | 플랫폼 |
캐치프레이즈
|
비고
| 5 | |:----:|:---:|:---:|:----:|:---------------------------|:--------------------| 6 | | 시사 | 🦔[뉴닉 NEWNEEK](https://newneek.co/) |월수금 아침 7시 반|[스티비](https://stibee.com/)| 우리가 시간이 없지, 세상이 안 궁금하냐!| 텀블벅 펀딩 [10만 명에게 뉴스를 알려주는 고슴도치가 있다고?](https://tumblbug.com/newneek?utm_source=website&utm_medium=358d538f0ace3696&utm_campaign=%EB%89%B4%EB%8B%89%20%EC%9B%B9%EC%82%AC%EC%9D%B4%ED%8A%B8%20%EB%B0%B0%EB%84%88)| 7 | | 경제 | 💰[어피티 UPPITY](https://uppity.co.kr/)|월-금 아침 8시|[스티비](https://stibee.com/)|사회초년생을 위한 첫 번째 경제미디어|2019년 12월 23일(월)~2020년 1월 1일(수)까지 머니레터 휴간| 8 | | 강연 |[세바시](https://bit.ly/2PgEBT2)|화, 금 오전 9시|[스티비](https://stibee.com/)|15분이 만들어 낼 기적을 기대하세요!| 세상을 바꾸는 시간 15분 \[[홈페이지](https://www.sebasi.co.kr/)] \[[유튜브](https://www.youtube.com/channel/UCgheNMc3gGHLsT-RISdCzDQ)]| 9 | | 잡지 |[종이잡지클럽](https://www.wereadmagazine.com/02-services)|매월 20일즈음| [WIX 이메일 캠페인](https://support.wix.com/ko/wix-%EC%9D%B4%EB%A9%94%EC%9D%BC-%EB%A7%88%EC%BC%80%ED%8C%85/%EC%9D%B4%EB%A9%94%EC%9D%BC-%EC%BA%A0%ED%8E%98%EC%9D%B8-%EC%A0%9C%EC%9E%91) | WE READ MAGAZINES | Read Magazine \| Stay Keen \| Connect with the Real World \[[인스타그램](https://www.instagram.com/the_magazine_club/)]| 10 | | 메이커 |[TIDE](http://www.tideinstitute.org/newsletter/)|월간|[스티비](https://stibee.com/)| 혁신적인 교육으로 스스로 선도하는 미래를 만든다 | TIDE Institute (사)타이드인스티튜트 \[[홈페이지](http://www.tideinstitute.org/) [2020 TIDE WEEK](https://event-us.kr/tideinstitute/event/14205) 11 | -------------------------------------------------------------------------------- /computer_science/machine_learning/conjugate.md: -------------------------------------------------------------------------------- 1 | # Conjugate 2 | 3 | [Understanding LSTM Networks](https://colah.github.io/posts/2015-08-Understanding-LSTMs/)를 읽던 도중, 아래 문장을 마주쳤다. 4 | 5 | *For example, it might output whether the subject is singular of plural, 6 | so that we know what form a verb should be **conjugated** into if that's what follows next.* 7 | 8 | 9 | 그런데 Conjugate라는 단어가 너무 익숙하고도 낯선 것이다!
10 | 그래서 옥스포드 영어사전(이라 쓰고 네이버 영어사전이라 읽는다)에 찾아본 결과가 아래와 같다. 11 | 12 | **[conjugate](https://endic.naver.com/enkrEntry.nhn?sLn=en&entryId=28deb4ba777a46dda5dd5aacb408448c&query=conjugate)** 13 | ``` 14 | Verb(문법) 15 | 1.[타동사][VN] (동사를 수·인칭·시제에 따라) 활용시키다[다른 형태를 쓰다] 16 | 2.[자동사][V] (동사가) 활용하다[형태가 달라지다] 17 | ``` 18 | 19 | '활용하다'라는 의미는 위 문장에서 conjugate의 의미에는 꼭 맞아떨어지지만,
20 | 단어가 익숙한 이유를 충분히 설명할 수는 없어서 어디서 봤는지 곰곰 떠올려 보았다. 21 | 22 | 그 결과 두 가지 이유를 찾을 수 있었다. 23 | 24 | - **Conjugate gradient method** 25 | - 첫째로 이 논문([Forecasting exchange rate using deep belief networks and conjugate gradient method](https://www.sciencedirect.com/science/article/abs/pii/S0925231215005408)) 26 | 제목이 어렴풋이 기억에 남았나보다. 27 | - 최적화 기법과 관련있는 내용이고, 설명은 링크로 대체한다. 28 | - wikipedia [Conjugate gradient method](https://en.wikipedia.org/wiki/Conjugate_gradient_method) 29 | - cmu [Conjugate Gradient Descent](http://www.cs.cmu.edu/~aarti/Class/10725_Fall17/Lecture_Slides/conjugate_direction_methods.pdf) 30 | 31 | - **Complex conjugate** 32 | - 또 하나는 **켤레복소수**가 영어로 complex conjugate라는 사실이다. 33 | 34 | 35 | 36 | * * * 37 | 38 | ###### 트리비아 39 | 40 | - 오랜만에 애매한 영어단어를 명확히 하니까 기분이 좋군! 41 | -------------------------------------------------------------------------------- /computer_science/machine_learning/recall.md: -------------------------------------------------------------------------------- 1 | ## Recall 2 | 3 | 오늘의 의문은, 도대체 machine learning에서 이야기하는 'recall'이란 무엇인가? 이다. 4 | 5 | ##### 찾아보게 된 이유 6 | 요즘 Peter Flach의 [*Machine Learning:The Art and Science of Algorithms that Make Sense of Data*](https://www.amazon.com/Machine-Learning-Science-Algorithms-Sense/dp/1107422221)을 읽고 있다. 7 | 52 - 61쪽에 걸쳐 Classification에 대한 이야기를 하고 있는데, 어찌어찌 True/False Positive/Negative 까지는 이해를 했다. 8 | 그런데 갑자기 **average recall**이라는 말이 나오는 것이 아닌가. 읽다보면 이해하겠지, 하고 넘겼더니 61쪽이 나오기까지 이해를 못했다! 9 |
도와줘! 구글링! 10 | 11 | ##### recall이 무엇인고 하니 12 | 13 | [다크 프로그래머 - precision, recall의 이해](http://darkpgmr.tistory.com/162)와 14 | [테리의 딥러닝 토크 #1.5. Accuracy, Precision, Recall](https://youtu.be/1jboC7nWnfM)를 참고했다. 15 | 16 | 짧게 말하면 정확도와는 별도의 개념인 **검출율**이라고 한다. 17 | 18 | ###### 예시 19 | 10명의 사람 중에 안경을 쓴 사람이 3명이라고 하자. 20 | (편의상 사람 이름을 일,이,삼,사,...,구,십 이라고 했을때 일,이,삼이 안경을 썼다고 하자.) 21 | 22 | 내가 안경 쓴 사람을 데려와! 라고 했을 때, 23 | 일, 이, 삼만 데려오면 검출율 100%가 맞다. 24 | 그런데 검출율이라는게 골때리는게, 일, 이, 삼, ... , 구, 십을 다 데려와도 검출율은 100%다.
25 | 26 | 다크 프로그래머의 블로그에 있는 수식을 잘 이해하면 좋을 것 같다. 27 | 28 | ``` 29 | recall = (detected TRUE)/(total number of existing TRUE) 30 | precision = (TRUE detections)/(whole detections of an algorithm) 31 | ``` 32 | 33 | 위의 예시에 따르면, 34 | 일, 이, 삼만 데려오면 recall 100% (3 out of 3), precision 100% (3 out of 3)
35 | 일, 이, 삼, ... , 구, 십을 다 데려오면 recall 100% (3 out of 3) precision 30%(3 out of 10) 이다.
36 | 37 | 그러나 어떤 알고리즘을 단순히 recall이 얼마고 precision이 얼마여서 성능이 좋고 나쁘다고는 말하기 어렵다고 한다! 38 | 오늘은 여기까지! 39 | 40 | 41 | + 다음날 덧붙이는 말: 그래서 ROC curve를 놓고 해당 커브를 이해하는 작업이 필요했다고 한다..... 42 | -------------------------------------------------------------------------------- /computer_science/python/dataframe.md: -------------------------------------------------------------------------------- 1 | # DataFrame 2 | 3 | pandas에서 가장 사랑하는 자료형 (여담인데 2020.03.04기준으로 pandas 1.0.1이고, documentation 페이지가 엄청 예뻐졌다..?) 4 | DataFrame! 5 | 6 | 아래처럼 pandas를 import 했고 모종의(?) 데이터가 든 DataFrame이 있다고 가정하자. 7 | ```python3 8 | import pandas as pd 9 | df = pd.DataFrame() 10 | ``` 11 | 12 | # 목차 13 | - [df.head(), df.tail()](#head-tail) 14 | - [null 확인하기](#check-null) 15 | - [중복 columns 없애기](#remove-dupl-cols) 16 | 17 | 18 | 19 | * * * 20 | ### 인덱스 기준으로 앞에서부터(**head**), 뒤에서부터(**tail**) N개 데이터 보기 21 | ```python3 22 | df.head() # 빈 칸으로 두면 5개 데이터를 보여준다. 23 | df.tail(10) # 숫자 N을 넣으면 N개 데이터를 보여준다. 24 | ``` 25 | 26 | * * * 27 | ### null이 있는지 확인하기, 각 column마다 null이 몇 개 인지 확인하기 28 | ```axis``` option 확인하면 각 row를 확인할 수도 있겠다. 29 | ```python3 30 | df.isnull() # DataFrame의 각 element가 값이 있으면 True, NaN이면 False인 DataFrame을 보여준다. 31 | df.isnull().sum() # 이렇게 하면 True 다 더해지니까 NaN값 개수를 쉽게 볼 수 있다. 32 | ``` 33 | 34 | * * * 35 | ### 중복 columns 없애기 36 | ```python3 37 | df = df.loc[:,~df.columns.duplicated()] 38 | ``` 39 | - [pandas.DataFrame.duplicated](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.duplicated.html) 40 | - [Remove duplicate columns by name in Pandas](https://www.interviewqs.com/ddi_code_snippets/remove_duplicate_cols) 41 | 42 | * * * 43 | ### 추가 예정 44 | ```python3 45 | ``` 46 | 47 | 48 | 49 | ##### 모르는 것을 검색할 때 유용한 키워드 50 | ``` pandas DataFrame ... ```, ```elementwise```, ```index```, ```DateTimeIndex```, ```column``` 51 | 52 | -------------------------------------------------------------------------------- /computer_science/math/covariance.md: -------------------------------------------------------------------------------- 1 | ## Covariance matrix 2 | 3 | **공분산** 이라는 이름으로 익숙한 covariance
4 | 5 | variance 개념만으로는 한 축의 데이터 (2차원으로 예를 들면 x축과 y축 각각)가 흩뿌려져 있는 모양새만 설명할 수 있어서,
6 | 서로 다른 변수들 사이의 관계(correlation)를 설명하기 위해 공분산이라는 개념을 도입한다.

7 | 기존에 알고있던 variance가 퍼짐의 정도(spread)라면, covariance는 방향(orientation)을 나타낸다고 볼 수 있겠다.
8 | 이 두가지를 묶어서 확인할 수 있는 것이 covariance matrix이다. (2변량 이상일 때 사용하고, diagonal line이 variance와 같다.)

9 | 10 | 11 | 아래는 공분산 행렬에 관련된 이모저모이다. 12 | 13 | * (x와 y의 관계) == (y와 x의 관계) 이므로, 공분산 행렬은 언제나 symmetric하다. 14 | * covariance matrix는 eigenvector와 eigenvalue로 표현 가능하다. (eigenv와의 관계를 좀 더 직관적으로 이해하고 싶다...) 15 | * white data는 unit covariance matrix를 가진다. (white data라 함은 unscaled(1) 이고 unrotated인 data를 뜻한다.) 16 | * 엄청난 사실인데, observed data의 covariance matrix는 white, uncorrelated data의 선형 변환 행렬과 엄청난 연관이 있다. (도움이 된 링크 \[1] 의 후반부 예시가 이를 잘 설명해주고 있다.) 17 | 18 |
19 |
20 | 21 | ###### 도움이 된 링크 22 | \[1] [A geometric interpretation of the covariance matrix](http://www.visiondummy.com/2014/04/geometric-interpretation-covariance-matrix/)
23 | \[2] [Eigenvectors, Eigenvalues, PCA, Covariance and Entropy 中 Covariance](https://skymind.ai/wiki/eigenvector#covariance)
24 | \[3] [공돌이의 수학정리노트 - 주성분분석 (PCA)](https://wikidocs.net/7646)
25 | 26 | 27 | ###### 공부하다 새롭게 알게 된 것: 이런저런 링크를 타다가 완전히 새롭게 접한 내용들 28 | - [Hermitian Matrix](https://en.wikipedia.org/wiki/Hermitian_matrix) 29 | - [Rayleigh Quotient](https://en.wikipedia.org/wiki/Rayleigh_quotient) 30 | 31 | ###### 충격 잘 모르고 있는 줄도 몰랐던 사실 32 | - "quadratic form" 은 모든 항의 차수가 2인 다항식이었다... 33 | 34 | ###### 더 공부해야 할 것 35 | - SVD(Singular Value Decomposition, 특이값 분해) 36 | -------------------------------------------------------------------------------- /finance/maximum_drawdown.md: -------------------------------------------------------------------------------- 1 | # Maximum Drawdown(MDD) 2 | 3 | **최대 낙폭**이라고 번역할 수 있는 maximum drawdown(이하 MDD)는 [1, T]의 시간동안 어떤 주식을 보유(hold)한 상태에서 발생할 수 있는 최대 손실을 의미한다. 4 | [1,T]의 시계열 중 이전 최고점(peak)에서 최저점(trough)까지의 낙폭 중 최댓값(a peak-to-trough decline during a specific period for an investment, trading account, or fund)이다. 5 | 6 | - **drawdown D(T) "at" time T** 7 | - **maximum drawdown "up to" time T** 8 | 9 | 수익률이 series로 들어온다고 가정했을 때 mdd를 구하는 코드는 다음과 같다. 10 | - mdd는 price와 관련된 개념이므로 가격으로 변환하여 mdd를 구한다. 11 | - ```get_times=True```면 해당 MDD의 최고점, 최저점이 언제인지 그 날짜도 함께 반환한다. 12 | 13 | ```python3 14 | import pandas as pd 15 | 16 | def maximum_drawdown(rtrn, get_times=False): 17 | assert isinstance(rtrn, pd.Series) 18 | p = (rtrn.sort_index(ascending=True)+1).cumprod() 19 | 20 | drawdowns = {} 21 | t_max = p.index[0] 22 | max_so_far = p.iloc[0] 23 | 24 | for idx, item in p.iteritems(): 25 | if item > max_so_far: 26 | t_max = idx 27 | max_so_far = item 28 | drawdown = 0 29 | else: 30 | drawdown = (max_so_far - item)/max_so_far 31 | drawdowns[(t_max, idx)] = drawdown 32 | 33 | mdd = max(drawdowns.values()) 34 | t_max, tau = max(drawdowns, key=drawdowns.get) 35 | 36 | if get_times==False: 37 | return mdd 38 | else: 39 | return mdd, t_max, tau 40 | ``` 41 | 42 | ###### resources 43 | - https://github.com/GreatYoungShaw/Calculating-maximum-drawdown 의 코드를 참고했다. 44 | - 위 레포와 달리 pandas Series 타입 dependent하다. 45 | - 특정 날짜(혹은 인덱스)를 반환하는 기능을 추가했다. 46 | - [Drawdown Definition and Example](https://www.investopedia.com/terms/d/drawdown.asp) 47 | -------------------------------------------------------------------------------- /computer_science/machine_learning/ICML.md: -------------------------------------------------------------------------------- 1 | Break 2 | Tutorial 3 | Talk 4 | Invited Talk 5 | Oral 6 | Poster 7 | Workshop 8 | 9 | ICML Oral 구분 체계 10 | Active Learning 11 | Adversarial Examples 12 | Applications 13 | Applications: Computer Vision 14 | Applications: Natural Language Processing 15 | Approximate Inference 16 | Bandits and Multiagent Learning 17 | Bayesian Deep Learning 18 | Bayesian Methods 19 | Bayesian Non-parametric 20 | Causality 21 | Combinatorial Optimization 22 | Convex Optimization 23 | Deep Generative Models 24 | Deep Learning 25 | Deep Learning Algorithms 26 | Deep Learning Architectures 27 | Deep Learning Optimization 28 | Deep Learning Theory 29 | Deep RL 30 | Deep RL 1 31 | Deep RL 2 32 | Deep Sequence Models 33 | Fairness 34 | Gaussian processes 35 | General ML 36 | Generative Adversarial Networks 37 | Generative Models 38 | Information Theory and Estimation 39 | Interpretability 40 | Kernel Methods 41 | Large Scale Learning and Systems 42 | Learning Theory 43 | Learning Theory: Games 44 | Monte Carlo Methods 45 | Networks and Relational Learning 46 | Non-convex Optimization 47 | Online Learning 48 | Optimization 49 | Optimization and Graphical Models 50 | Optimization: Convex and Non-convex 51 | Privacy 52 | Privacy and Fairness 53 | Probabilistic Inference 54 | Ranking and Preference Learning 55 | Reinforcement Learning and Bandits 56 | Reinforcement Learning Theory 57 | Representation Learning 58 | Robust Statistics and Interpretability 59 | Robust statistics and Machine Learning 60 | Statistical Learning Theory 61 | Supervised learning 62 | Supervised and Transfer Learning 63 | Time Series 64 | Transfer and Multitask Learning 65 | Unsupervised Learning 66 | 67 | -------------------------------------------------------------------------------- /computer_science/python/super.md: -------------------------------------------------------------------------------- 1 | ## super() 2 | 3 | 2019/01/17 의 기록
4 | 파이썬으로 코드를 짜면서 이런저런 의문이 들기 시작했다. 어제는 self란 무엇인가에 대한 짧은 탐구를 했고, 5 | 오늘은 super()에 대한 탐구이다. 부모자식 Class 간의 상속과 관련이 있다는 점 이상으로 아는 것이 없는 상황.
6 | 7 | 8 | ###### 도움이 된 링크 9 | 10 | 11 | (video) [Raymond Hettinger - Super considered super! - PyCon 2015](https://www.youtube.com/watch?v=EiOglTERPEo) 12 | >"Then why are you here?" 13 | > 1. Inheritance is for code reuse 14 | > 2. The problem is The diamond diagram(non-trivial multiple inheritance)- need linearization algorithm 15 | > 3. Inheritance == calling your parents(usually), but not in Python(This is the problem I guess.). It calls not MY ancestors but your CHILDREN(youngest in the tree)'s ancestors.(?!) 16 |
17 | 18 | > inheritance injection 19 |
20 | 21 | 22 | 그래서 읽은 글 두 편
23 | [Python's Super is nifty, but you can't use it (Previously: Python's Super Considered Harmful)](https://fuhm.net/super-harmful/) 24 | 25 | > One big problem with 'super' is that it sounds like it will cause the superclass's copy of the method to be called. This is simply not the case, it causes the next method in the MRO to be called. 26 | 27 | [Python’s super() considered super!](https://rhettinger.wordpress.com/2011/05/26/super-considered-super/)

28 | 29 | 미리 알고있다면 좋을 것이고 아니더라도 자연스레 찾아보게 될 내용
30 | - [C3 linearization](https://en.wikipedia.org/wiki/C3_linearization) 31 | - [Multiple inheritance](https://en.wikipedia.org/wiki/Multiple_inheritance) 32 | - [The diamond problem](https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem) 33 |
34 | 그리고 35 |
36 | [The Python 2.3 Method Resolution Order](https://www.python.org/download/releases/2.3/mro/#id1)
37 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch_datasets.md: -------------------------------------------------------------------------------- 1 | # Pytorch Datasets 2 | 3 | Pytorch에는 두 가지 종류의 Dataset이 존재한다. 4 | 5 | - Map-style datasets 6 | - Iterable-style datasets 7 | 8 | Map-style datasets는 **```Dataset``` class**와 관련이 있다. 9 | - ```__getitem()__```, ```__len()__``` 메소드와 연관이 있고 인덱스나 키를 데이터 샘플들에 매핑시킨다. 10 | 11 | ```python3 12 | class Dataset(object): 13 | r"""An abstract class representing a :class:`Dataset`. 14 | 15 | All datasets that represent a map from keys to data samples should subclass 16 | it. All subclasses should overwrite :meth:`__getitem__`, supporting fetching a 17 | data sample for a given key. Subclasses could also optionally overwrite 18 | :meth:`__len__`, which is expected to return the size of the dataset by many 19 | :class:`~torch.utils.data.Sampler` implementations and the default options 20 | of :class:`~torch.utils.data.DataLoader`. 21 | 22 | .. note:: 23 | :class:`~torch.utils.data.DataLoader` by default constructs a index 24 | sampler that yields integral indices. To make it work with a map-style 25 | dataset with non-integral indices/keys, a custom sampler must be provided. 26 | """ 27 | 28 | def __getitem__(self, index): 29 | raise NotImplementedError 30 | 31 | def __add__(self, other): 32 | return ConcatDataset([self, other]) 33 | ``` 34 | 35 | 36 | Iterable datasets는 **```IterableDataset``` class**의 subclass이다. 37 | - ```__iter()__``` 메소드의 구현과 관련이 있다. 38 | 39 | 40 | 41 | ###### resources 42 | - [Pytorch documentation: Dataset Types](https://pytorch.org/docs/master/data.html#dataset-types) 43 | - [Code for Dataset](https://pytorch.org/docs/master/_modules/torch/utils/data/dataset.html#Dataset) 44 | -------------------------------------------------------------------------------- /book/educated.md: -------------------------------------------------------------------------------- 1 | # 배움의 발견 EDUCATED 2 | 3 | > 나의 특별한 가족, 교육, 그리고 자유의 이야기 4 | 5 | 2020.03.09 ~ 2020.04.16 6 | 7 | 네이버 책 [배움의 발견](https://book.naver.com/bookdb/book_detail.nhn?bid=15975184)
8 | 9 | 타라 웨스트오버Tara Westover 지음, 김희정 옮김. 열린책들 10 | 11 | ###### 읽기 전에 12 | 13 | - 핫하다는 소문을 듣고 빌렸는데, 빌리고 나서 꾸준히 예약신청이 들어오는 책이다. 14 | - 처음 서른 장을 읽은 엄마는 엄청난 책이라고 했다. 15 | - 작가는 공교육을 거부하는 아버지로 인해 16년간 학교에 다니지 못했다, 즉 기초교육을 받지 못했다. 16 | - 책을 열자마자 **존 듀이**라는, 교육학을 공부하던 시절 많이도 들었던 익숙한 이름을 봤고, 갑자기 읽고 싶어졌다...
17 | 내 안의 교육학도가 깨어날 것만 같다. 18 | 19 | 20 | ###### 읽는 중 21 | 22 | > 마지막으로 나는 교육이 끊임없이 경험을 재구성해 가는 것으로 이해되어야 한다고 믿는다.
23 | 교육의 목적과 과정은 동일한 것이다. - 존 듀이 24 | 25 | > 과거는 영향을 끼칠 수 없는, 대단치 않은 유령에 불과했다. 무게를 지닌 것은 미래뿐이었다. 26 | 27 | > "그 주제에 관한 어떤 지식도 최종적 결론이 될 수는 없다." 28 | 29 | > 불편함을 말로 표현할 수 있는 어휘들을 쌓다. 30 | 31 | > 그렇게 하는 것은 내가 여기 있을 자격이 없는 사람이라는 것을 큰 소리로 광고하는 것이나 다름없다는 생각이 들어서였다. 32 | 33 | > 자신이 누군지를 결정하는 가장 강력한 요소는 그 사람의 내부 34 | 35 | > 그들의 목소리는 강하고, 단호하고, 절대적이었다. 내 목소리가 그들의 목소리만큼 강할 수 있다는 생각을 한 번도 해보지 못했던 것이다. 36 | 37 | > 내가 오빠를 아무리 증오해도 오빠 자신이 스스로에게 느끼는 혐오감에는 미치지 못한다는 진실 말이다. 38 | 39 | 40 | 41 | ###### 후기 42 | - 필자가 끊임없이 스스로를 의심하고, 자신의 탓으로 돌리는 모습이 마음이 아팠다. 끊임없는 자기검열의 굴레를 끊어내는건 정말 어렵다. 43 | - 스스로를 이방인으로 여기는 모습에 공감했다.스스로가 이방인이라고 여겨질 때, 어떤 태도를 취할 것인가? 무리에 속하고자 노력할 것인가, 나와 맞는 다른 무리를 찾고자 헤맬 것인가? 나는 어떤 무리에서 소속감을 느끼는가? 44 | - 자신의 말과 생각을 가지는 모습을 부러워했다. 탄탄한 근거를 지닌 사람이고 싶다. 45 | - 가족들로부터의 폭력을 안타까워했고, 지속적인 조력자들의 존재에 안도했다. 46 | - 사람은 참 입체적이라는 생각을 했다. 나는 나 이외의 사람을 온전히 이해할 수 없다. 47 | - 내 목소리도 강하고, 단호하고 싶다. 절대적이고 싶지는 않다. 48 | - 자신에 대한 믿음이 뒷받침되어야 한다고 생각한다. 49 | - 내가 생각하는 배움은 세상에 내가 모르는 구석들을 알아가는 일, 새로운 관점을 가질 수 있게 되는 일. 아는 만큼 보인다고도 하고, 시야를 넓히는 일이라고도 할 수 있다. 나는 기계학습의 눈으로, 금융의 눈으로, 교육학자의 눈으로, 페미니스트의 눈으로 세상을 바라볼 수 있다. 다양한 눈을 가질 때 세상은 풍부하다. 50 | -------------------------------------------------------------------------------- /computer_science/shell/shell_assign.md: -------------------------------------------------------------------------------- 1 | ## = 와 := 의 차이 2 | [Makefile](https://opensource.com/article/18/8/what-how-makefile) 에 대해 읽다가, 3 | ```CC = gcc``` 라고 variable을 선언했을 때, 후에 스스로를 재할당(reassign)하는 경우 무한루프에 빠진다는 내용이 나왔다. 4 | 예를 들어, 5 | ```shell 6 | CC = gcc 7 | CC = ${CC} 8 | 9 | all: 10 | @echo ${CC} 11 | ``` 12 | 위와 같은 Makefile을 ```make```하며 다음과 같은 에러메시지를 남긴다. 13 | 14 | Makefile:8: *** Recursive variable 'CC' references itself (eventually). Stop. 15 | 16 | 그래서 Makefile을 작성할 때 ```=``` 대신 ```:=```연산자(operator)를 사용한다.
17 | 18 | **그런데 대체 ```=```와 ```:=```은 무엇이 다른 것인가?**
19 | 20 | ```:=```은 **simply expanded variable**이라고 부른단다. (```=```은 recursively expanded variables라고 부른다.)
21 | 22 | 변수(variable)에 담기는 것은 함수일 수도 있고 다른 변수에 대한 reference일 수도 있다. 23 | 24 | 변수에 다른 변수에 대한 reference를 담았을 때 차이가 생긴다. 25 | ```=```으로 할당을 할 경우, 코드를 쭉 따라가다가, 변수 이름이 나오면 그 내용으로 확장(expand)하고, 그제서야 reference를 참조한다. 26 | 그러니 ```CC = ${CC}```가 무한루프를 돌 수 밖에.... 27 | 28 | 그런데 이 **simply expanded variable**의 경우는 변수를 선언할 때 reference의 참조값을 담는다. 29 | 따라서 아까 그 코드의 두번째 줄을 ```CC := ${CC}```로 바꾸면 결국 ```CC = gcc```가 되므로 무한루프를 돌지 않는다는 사실. 30 | 31 | 32 | ###### 번외: 변수가 초기화가 되어있지 않을 때만 값을 정하려면 ```=```대신 ```?=```를 사용하면 되고, 이것은 conditional variable assignment operator라고 부른다. 33 | 34 | 35 | 아참, 그래서 아까 그 Makefile은 이렇게 바꿔주면 된다. 36 | ```shell 37 | CC := gcc 38 | CC := ${CC} 39 | 40 | all: 41 | @echo ${CC} 42 | ``` 43 | ### Reference 44 | - [What is a Makefile and how does it work?](https://opensource.com/article/18/8/what-how-makefile) 45 | - [Setting Variables](https://www.gnu.org/software/make/manual/html_node/Setting.html#Setting) 46 | - [The Two Flavors of Variables](https://www.gnu.org/software/make/manual/html_node/Flavors.html) 47 | -------------------------------------------------------------------------------- /finance/finance-resources.md: -------------------------------------------------------------------------------- 1 | - [AHL Explains](https://www.youtube.com/playlist?list=PLwmBa3RpZcUrebD4o1TNt3d9wplBktmdS) 2 | > AHL Explains is a video series that has been created to explain key concepts at Man AHL. Narrated by Dr. Anthony Ledford, Chief Scientist at Man AHL, our intention is to bring each concept to life by focusing on principles rather than detail. 3 | 4 | - [Python for finance tutorial](https://github.com/datacamp/datacamp-community-tutorials/blob/master/Python%20Finance%20Tutorial%20For%20Beginners/Python%20For%20Finance%20Beginners%20Tutorial.ipynb) 5 | 6 | - [Fama-French Research Portfolios and Factors](https://wrds-www.wharton.upenn.edu/pages/support/research-wrds/research-guides/fama-french-research-portfolios-and-factors/#beme-book-to-market) 7 | 8 | - [FACTOR ALLOCATION 101: EQUAL VS VOLATILITY-WEIGHTED](https://www.factorresearch.com/research-factor-allocation-101-equal-vs-volatility-weighted) 9 | 10 | ## Dataset 11 | - [Kenneth R. French - Data Library](https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html) 12 | 13 | ## Portfolio 14 | - [포트폴리오 이론](https://flyinglightly.tistory.com/category/%EC%9E%AC%EC%A0%95%ED%95%99) 15 | - [Skewness and Kurtosis](https://www.evestment.com/resources/investment-statistics-guide/assessing-skewness-and-kurtosis-in-the-returns-distribution/) 16 | - [Are the Skewness and Kurtosis Useful Statistics?](https://www.spcforexcel.com/knowledge/basic-statistics/are-skewness-and-kurtosis-useful-statistics) 17 | - [Measuring portfolio skewness](https://core.ac.uk/download/pdf/4834498.pdf) 18 | 19 | ## 책 20 | - [감정을 이기는 퀀트투자 스마트 베타: 퀀트 펀드매니저가 쓴 계량투자 입문서 현명한 베타를 통한 알파 추구](https://book.naver.com/bookdb/book_detail.nhn?bid=12722739), 김병규 , 이현열WATER BEAR PRESS(워터베어프레스)2017.11.06 21 | -------------------------------------------------------------------------------- /computer_science/python/multiprocessing.md: -------------------------------------------------------------------------------- 1 | > 5개의 데이터셋에 대해 병렬적으로 실행 가능한 내용이 있다. 2 | 현재는 5개의 주피터 노트북 파일을 사용해 실행 중인데, 여러 탭을 켜두려니까 상당히 번거롭다. 3 | 이에 multiprocessing이 도움이 될까 싶어 정리할 예정이다. 4 | 5 | ### [multiprocessing](https://docs.python.org/3.7/library/multiprocessing.html) in python 3.7 6 | ```python3 7 | import multiprocessing 8 | ``` 9 | 10 | - ```multiprocessing.cpu_count()``` : core의 개수와 컴퓨터가 실행할 수 있는 job의 개수를 알려준다.
>>> sample output: ```12``` 11 | 12 | - starting method: **spawn**(Unix and Windows), **fork**(Unix only), **forkserver** 13 | 14 | 15 | ### [Joblib: running Python functions as pipeline jobs](https://joblib.readthedocs.io/en/latest/) 16 | ```python3 17 | from joblib import Parallel, delayed 18 | ``` 19 | 20 | - **```Memory```**```([location, backend, cachedir, …])```: A context object for caching a function’s return value each time it is called with the same input arguments. 21 | - **```Parallel```**```([n_jobs, backend, verbose, …])```: Helper class for readable parallel mapping.
>>> sample code: 22 | ```python3 23 | Parallel(n_jobs=multiprocessing.cpu_count()) 24 | ``` 25 | - **```dump```**```(value, filename[, compress, protocol, …])```: Persist an arbitrary Python object into one file. 26 | - **```load```**```(filename[, mmap_mode])```: Reconstruct a Python object from a file persisted with joblib.dump. 27 | - **```hash```**```(obj[, hash_name, coerce_mmap])```: Quick calculation of a hash to identify uniquely Python objects containing numpy arrays. 28 | - **```register_compressor```**```(compressor_name, compressor)```: Register a new compressor. 29 | 30 | 31 | 참고자료 32 | - [Quick and Easy Parallelization in Python](https://medium.com/@mjschillawski/quick-and-easy-parallelization-in-python-32cb9027e490) 33 | -------------------------------------------------------------------------------- /computer_science/docker_useful.md: -------------------------------------------------------------------------------- 1 | 나도 이제 도커 사람! 동료들이 도커 이렇게 쓰면 돼! 하고 알려준 명령어들 모아두고 무슨 말인지 알아들어보자..! 2 | 3 | - [container 생성](#container) 4 | - [docker mount가 안돼요](#no-mount) 5 | - [jupyter notebook 만들기](#make-jupyter) 6 | - [실행 중 container에 포트 추가하기](#add-port-to-running-container) 7 | - [포트 포워딩](#port-forward) 8 | 9 | 10 | 11 | ## docker mount가 안돼요 12 | https://github.com/moby/moby/issues/34532#issuecomment-322738970 13 | 14 | ## 실행 중 container에 포트 추가하기 15 | 1. 실행중인 컨테이너를 종료 16 | - ```docker stop (컨테이너 이름)``` 17 | 2. 현재 상태를 이미지로 만든다/ commit으로 수정사항 반영 18 | - ```docker commit (컨테이너 이름) (이미지 이름)``` 19 | - ```docker rm (컨테이너 이름)``` 20 | 21 | 3. 해당 이미지 실행 시 포트 추가하기 22 | - [image에 수정사항이 있는 경우](https://medium.com/sjk5766/%EC%8B%A4%ED%96%89%EC%A4%91%EC%9D%B8-container%EC%97%90-port-or-volume-%EC%B6%94%EA%B0%80-ae8889344c68) 23 | 24 | 25 | 26 | ## container 생성 27 | ```bash 28 | # version 1 29 | $ nvidia-docker run -ti --rm --ipc=host -p 8888:8888 --name ex -v ~/exDir:/mnt/data example:0.1 30 | 31 | # version2 32 | $ docker run -it --name (container 이름) -v (host의 폴더):(container 안에서의 폴더) -p (포트):(포트) (도커 이미지) /bin/bash 33 | 34 | # 정리하자면 35 | $ docker run [옵션] 이미지[:태그] [커맨드] [인자] 36 | ``` 37 | 38 | ## jupyter notebook 만들기 39 | ```bash 40 | # version 1 41 | $ jupyter notebook --ip=0.0.0.0 --no-browser --allow-root& 42 | 43 | # version 2 44 | $ docker attach (container 이름) 45 | $ nohup jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --port=(포트) & 46 | ``` 47 | 48 | ## 학교 밖에서 쓰고 싶어... 포트 포워딩 49 | ```bash 50 | $ ssh -N -L (로컬에서_실행할_port):(서버_ip):(서버_port) (경유_컴퓨터_ip) 51 | ``` 52 | 내 경우 서버ip는 fml2, 경유하는 컴퓨터 ip는 fml1 이다. 53 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch1_intro.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | ## Security Goals 4 | - **Confidentiality** (Protecting confidential informtaion) 5 | - Snooping, Traffic analysis 6 | - **Integrity** (Information to be changed constantly, change only made by authorized entities & mechanisms) 7 | - Modification, Masquerading, Replaying, Repudiation(sender of receiver later deny that she has sent/received the message) 8 | - **Availability** (Information should be available to authorized entities) 9 | - Denial of service 10 | 11 | ## Services and Mechanisms 12 | ### Security Services 13 | - Data confidentiality 14 | - Data Integrity: Anti-change, Anti-replay 15 | - Authentication: Peer entity, Data origin 16 | - Nonrepudation: Proof of origin, Proof of delivery 17 | - Access control 18 | 19 | ### Security Mechanisms 20 | - Encipherment: hiding/covering data (confidentiality: cryptography/steganography) 21 | - Data integrity: a short checkvalue created from the data itself 22 | - Digital signature: the sendes/receiver can electronically sign/verify the signature 23 | - Authentication exchange: two entities exchange messages for identification 24 | - Traffic padding: insert some fake data to invalidate traffic analysis 25 | - Routing control 26 | - Notarization: set third party control center 27 | - Access control: passwords, PINs 28 | 29 | ## Techniques 30 | ### Cryptography 31 | - "secret writing" 32 | - Encryption/Decryption: conceal the contents of a message by enciphering 33 | - Symmetric encipherment: single secret key 34 | - Asymmetric encipherment: one public key & one private key 35 | - Hashing: from variable-length to fixed-length message 36 | 37 | ### Steganography 38 | - "covered writing" 39 | - "conceling the message itself by covering it with something else" 40 | -------------------------------------------------------------------------------- /computer_science/python/recursionlimit.md: -------------------------------------------------------------------------------- 1 | 살다살다 오늘(191215)은 이런 에러를 봤다. 2 | ```python3 3 | RecursionError: maximum recursion depth exceeded 4 | ``` 5 | 6 | 이것이 무엇인고 하니, 역시나 documentation에 정리가 되어있다.
7 | 8 | > exception [RecursionError](https://docs.python.org/3.7/library/exceptions.html#RecursionError) 9 | 10 | 이전에는 ```RuntimeError```로 분류되던 것인데, python3.5 버전부터 별도의 이름을 붙여 준 에러라고 한다. 11 | Python에서는 최대 재귀recursion 깊이를 정해두는데, 이 최대 재귀 횟수를 넘어서 재귀 호출을 하고 있다는 뜻이다...
12 | 13 |
14 | 15 | > 왜 그런게 있나? 그게 뭔가? 16 | 17 | 최대 재귀 깊이를 설정함으로써 무한 재귀를 막고,
18 | C 스택에 오버플로우가 나서 Python이 정지하는 상황을 방지하기 위함이다. 19 | 20 | 이 제한limit은 플랫폼에 따라 다르고, 만약 더 깊은 수준의 재귀를 사용해야 한다면 limit값을 크게 해야 한다. 21 | 그렇지만 과도한 재귀로 python이 멈춰버릴 수 있음을 염두에 두자. 22 | 23 | 24 | 이 문제는 여러 방법으로 해결할 수 있는데, 하나는 앞서 언급했듯 limit을 늘려주는 것이다. 25 | 26 | > [sys.setrecursionlimit(limit)](https://docs.python.org/3.7/library/sys.html#sys.setrecursionlimit) 27 | 28 | 위 함수를 통해 Python 인터프리터 스택의 최대 깊이를 늘릴 수 있다. 29 | 30 |
31 | 32 | > 언제 이런 문제 상황이 발생하는가? 33 | 34 | 내 경우는 이런 문제가 있었다. 아래는 문제 부분만 단순화한, 내 코드의 일부분이다. 35 | ```python3 36 | import pandas as pd 37 | import utils as u #자체제작한 모듈 utils.py 38 | 39 | class myDataFrame(pd.DataFrame): 40 | def __init__(self): 41 | self.daily = u.read_data("../data/Daily.csv") 42 | """ utils.py 43 | def read_data(filepath): 44 | df_r = pd.read_csv(filepath, index_col=[0]) 45 | . . . 46 | return df_r 47 | """ 48 | ``` 49 | 요즘 class 연습을 하고 있는데, 이런저런 실험을 하다가 50 | class를 만들 때 상속을 받아놓고는 그만 내부에서 pd.read_csv라고 호출한 것이 화근이었나보다. 51 | 현재 코드에서는 pd.DataFrame을 상속받겠다고 했지만 실제로 사용하고 있지는 않아서, 52 | 해당 상속을 없애주는 것으로 당장의 문제를 해결했다.
53 | 54 | 그러나 만약 pandas 내부 클래스를 상속한다고 했을 때, 55 | 어떻게 코드를 수정해야 pandas 내부의 함수를 내가 만든 class에서도 사용할 수 있을지는 아직 의문이다. 56 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch4_mathematics_cryptography.md: -------------------------------------------------------------------------------- 1 | # Mathematics of Cryptography 2 | 3 | ## Algebraic Structures 4 | ### Groups (Z_n or Z_n*) 5 | ** Set of elements with a binary operation that satisfies four properties. 6 | 7 | **Properties of a group** 8 | - Closure 9 | - Associativity 10 | - Commutativity 11 | - Existence of identity 12 | - Existence of inverse 13 | 14 |
Terms 15 | - finite group 16 | - order of a group ```|G|``` a number of elements in the group 17 | - subgroups 18 | - cyclic subgroups: a^n = a * a * a * ... * a 19 | - Lagrange's Theorem: If H is a subgroup os G then ```|H|``` | ```|G|``` 20 | - Order of an element: the order of the cyclic group it generates 21 | 22 | ### Rings (Z) 23 | ```R = <{...}, o1, o2> ``` : o1, o2 are operations
24 | **Distribution of o2 over o1** 25 | - o1: Closure, Associativity, Commutativity, Existence of identity and inverse 26 | - o2: Flosure, Associativity, Commutativity 27 | 28 | ### Fields(Z_p) 29 | ```F = <{...}, o1, o2> ```
30 | **Distribution of o2 over o1** 31 | - o1: Closure, Associativity, Commutativity, Existence of identity and inverse 32 | - o2: Closure, Associativity, Commutativity, Existence of identity and inverse 33 | - **The identity element of the first operation o1 has no inverse w.r.t. the second operation o2.** 34 | - Finite Fields: A Galois field GF(p^n) is a finie field with p^n elements 35 | 36 | 37 | ## GF(2^n) Fields 38 | **n-bit words** and **two operations** that satisfies the properties defined for a field 39 | - repsentation of an ```n-bit word``` by a polynomial, a polynomial of degree n-1 40 | - irreducible polynomial(modulus), reducible polynomial 41 | - additive/multiplicative identity and inverse(gained with extended Euclidean algorithm) 42 | - Generator : {0, 1, g, g^2, ..., g^N}, where N=(2^n)-2 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /computer_science/machine_learning/reinforcement_learning.md: -------------------------------------------------------------------------------- 1 | ## reinforcement_learning 2 | 3 | 강화학습과 관련된 간단한 용어 정리 쯤으로 봐두자. 4 | 5 | #### 기본 용어 6 | - Agent & Environment 7 | - Observation, Action, Reward 8 | - Policy, Value function and Model 9 | 10 | #### Problems with RL 11 | 1. Learning vs. Planning 12 | 2. Exploration vs. Exploitation 13 | 3. Prediction vs. Control 14 | 15 | #### Markov 어쩌구저쩌구 16 | 1. Markov Property(Markov Chain) 17 | - State & State transition probability 18 | 2. Markov **Reward** Process 19 | - Markov Chain + Reward function & discounting factor 20 | - Return; Value function (Expectation of the Returns; the env is stochastic) 21 | - Bellman Equation 22 | - iterative expectation 23 | 3. Markoc **Decision** Process 24 | - MRP + Action 25 | - Policy; a mapping from state to action. a distribution over actions given states. 26 | - Bellman Equation for (1) State Value function (2) Action Value function 27 | - Bellman **Expectation** Equation 28 | - Bellman **Optimality** Equation 29 | 30 | #### Policy gradient 31 | - [Policy Based Reinforcement Learning, the Easy Way](https://towardsdatascience.com/policy-based-reinforcement-learning-the-easy-way-8de9a3356083) by Ziad SALLOUM 32 | - [Score function with Softmax policy](https://math.stackexchange.com/questions/2013050/log-of-softmax-function-derivative) 33 | 34 | ###### 도움이 된 링크 35 | - [Reinforcement Learning: An Introduction 2nd edition](http://incompleteideas.net/book/the-book-2nd.html) : 강화학습 교과서 36 | - [UCL Course on RL](http://www0.cs.ucl.ac.uk/staff/d.silver/web/Teaching.html) by David Silver(Google DeepMind) 37 | - [An intro to Advantage Actor Critic methods: let’s play Sonic the Hedgehog!](https://medium.freecodecamp.org/an-intro-to-advantage-actor-critic-methods-lets-play-sonic-the-hedgehog-86d6240171d) 38 | by Thomas Simonini 39 | -------------------------------------------------------------------------------- /computer_science/machine_learning/dl_with_pytorch.md: -------------------------------------------------------------------------------- 1 | # DEEP LEARNING WITH PYTORCH 2 | 3 | [DEEP LEARNING WITH PYTORCH](https://pytorch.org/deep-learning-with-pytorch) 책을 통해 정리하는 파이토치 **딥러닝** 기초
4 | https://github.com/deep-learning-with-pytorch/dlwpt-code 도 참고하자. 5 | 6 | ## 1 Introducing deep learning and the PyTorch library 7 | - Pytorch의 핵심 자료구조는 **Tensor** : numpy array와 비슷한 다차원 배열 8 | - 거의 비슷하지만 GPU 가속, autograd 등의 추가적인 기능 제공 9 | - 책에서 주로 다루는 예제는 2D, 3D 데이터에 대한 이미지 프로세싱 (이런) 10 | - DEEP LEARNING: NO MORE HANDCRAFTED FEATURES 11 | - but operating on a mathematical entity so that it discovers representations from the training dta autonomously 12 | - 너무 당당하게 내가 처음으로 배워야 할 딥러닝 라이브러리가 PyTorch라고 쓰여 있음. 매력적인걸? 13 | - 자세한 내용은 앞서 정리한 [pytorch 문서](https://github.com/codingbowoo/codingbowoo-resource/blob/master/stack/ML/pytorch.md) 참고 14 | 15 | ## 2 It starts with a tensor 16 | - 딥러닝은 결국 여러 단계의 representation에 대한 이야기: PyTorch는 데이터를 어떻게 처리하고 저장할까? 17 | - 다시 한 번, PyTorch의 핵심 자료구조는 **Tensor** : numpy array와 비슷한 다차원 배열 18 | - PyTorch tensor의 indexing과 operating 19 | - NumPy 다차원배열과 함께 사용하기 20 | - GPU에서 사용하기 21 | 22 | 2.1 Tensor fundamentals 18 23 | 2.2 Tensors and storages 22 24 | 2.3 Size, storage offset, and strides 24 25 | 2.4 Numeric types 30 26 | 2.5 Indexing tensors 31 27 | 2.6 NumPy interoperability 31 28 | 2.7 Serializing tensors 32 29 | 2.8 Moving tensors to the GPU 34 30 | 2.9 The tensor API 35 31 | 32 | ## 3 Real-world data representation with tensors 33 | 3.1 Tabular data 40 34 | 3.2 Time series 49 35 | 3.3 Text 54 36 | 3.4 Images 60 37 | 3.5 Volumetric data 63 38 | 39 | ## 4 The mechanics of learning 40 | 4.1 Learning is parameter estimation 70 41 | 4.2 PyTorch’s autograd: Backpropagate all things 83 42 | 5 Using a neural network to fit your data 101 43 | 5.1 Artificial neurons 102 44 | 5.2 The PyTorch nn module 110 45 | 5.3 Subclassing nn.Module 120 46 | -------------------------------------------------------------------------------- /computer_science/python/dictionary.md: -------------------------------------------------------------------------------- 1 | # Python dictionary 2 | ##### Contents 3 | - [Merge 2+ dictionaries](#merge-dicts) 4 | - [Initialize a dictionary](#init-dicts) 5 | 6 | 7 |
8 | 9 | * * * 10 | 11 | #### Initialize a dictionary 12 | key의 목록만 Dictionary를 빈 리스트로 초기화 할 일이 많은데, 구글링 해보면 처음 찾을 수 있는 답 중에 이런게 있다. 13 | ```python3 14 | keys = [1, 2, 3, 4] 15 | d = dict.fromkeys(keys, []) 16 | 17 | print(d) 18 | # {1: [], 2: [], 3: [], 4: []} 19 | ``` 20 | 문제는... 이 ```d```라는 dictionary는 초기화가 예쁘게 된 것 같지만 난처한 상황이 발생할 소지가 다분하다. 21 | key값이 1인 리스트에 1을 append를 하면 아래와 같은 상황을 볼 수 있다. 22 | ```python3 23 | d[1].append(1) 24 | 25 | print(d) 26 | # {1: [1], 2: [1], 3: [1], 4: [1]} -> ?! 27 | ``` 28 | fromkeys 메소드의 경우 하나의 list object로 각 key의 value를 몽땅 초기화하기 때문에 이런 상황이 발생하는 것! documentation에 친절하게도 29 | 30 | > All of the values refer to just a single instance, so it generally doesn’t make sense for value to be a mutable object such as an empty list. 31 | 32 | 라고 쓰여있다. 그렇다면 각 key들을 서로 다른 주솟값을 가지는, 서로 다른 list로 어떻게 초기화해야 하지? 두 가지 방법이 있다! 33 | ```python3 34 | # 방법 1 35 | d = {} 36 | for key in keys: 37 | d[key] = [] 38 | 39 | # 방법 2 40 | d = {key: [] for key in keys} 41 | 42 | print(d) 43 | # {1: [1], 2: [], 3: [], 4: []} -> 편-안 44 | ``` 45 | 이제 append를 마음껏 할 수 있다! 46 | 47 | related to 48 | [python3 documentation dict.fromkeys()](https://docs.python.org/3/library/stdtypes.html#dict.fromkeys) 49 | 50 | * * * 51 | 52 | #### Merge 2 dictionaries 53 | 54 | ```python3 55 | >>> d1 = {'a': 1, 'b': 2} 56 | >>> d2 = {'c': 3, 'd': 4} 57 | 58 | >>> d3 = {**d1, **d2} 59 | 60 | >>> d3 61 | {'d': 4, 'c': 3, 'b': 2, 'a': 1} 62 | ``` 63 | 64 | related to 65 | - [PEP448 (원문)](https://www.python.org/dev/peps/pep-0448/) 66 | - 정리노트 [pep448.md](https://github.com/codingbowoo/codingbowoo.github.io/blob/master/stack/pythonpractice/pep448.md) 67 | -------------------------------------------------------------------------------- /computer_science/machine_learning/heuristic.md: -------------------------------------------------------------------------------- 1 | ## Heuristic? 2 | 3 | 흘러다니는 이야기들을 가만 듣고 있자면, **휴리스틱**한 접근... **휴리스틱**하게 시도... 어쩌구... 저쩌구... 들이 종종 들린다. 4 | 그래서 이 휴리스틱이 뭔데!! 말하는 중에 휴리스틱이 뭐냐고 매번 물어보지만 아아, 나의 두뇌는 어찌 매번 까먹는 것이더냐. 5 | 이번 기회에 휴리스틱이 뭔지 기억해 보리라...! 6 | 7 | 일단 영어사전을 찾아보았다. 8 | **heuristic**을 **(교수법・교육이) 체험적인[스스로 발견하게 하는]** 이라고 정의하고 있다. 9 | 우리가 보통 사용하는 의미랑 좀 더 가까울 **heuristic approach**는 **(컴퓨터) 발견적 해결 방법 ((복잡한 문제를 푸는 데 있어 시행착오를 반복 평가하여 자기 발견적으로 문제를 해결하는 방법))** 이라 정의한다. 10 | 출처 [네이버 영어사전](http://endic.naver.com/search.nhn?sLn=kr&isOnlyViewEE=N&query=heuristic) 11 | 12 | 13 | 14 | [위키피디아](https://en.wikipedia.org/wiki/Heuristic)는 다음과 같이 말하고 있다. 15 | ``` 16 | A heuristic technique (/hjʊəˈrɪstɪk/; Ancient Greek: εὑρίσκω, "find" or "discover"), 17 | often called simply a heuristic, is any approach to problem solving, learning, or discovery 18 | that employs a practical method not guaranteed to be optimal or perfect, but sufficient for the immediate goals. 19 | 20 | Where finding an optimal solution is impossible or impractical, 21 | heuristic methods can be used to speed up the process of finding a satisfactory solution. 22 | Heuristics can be mental shortcuts that ease the cognitive load of making a decision. 23 | Examples of this method include using a rule of thumb, an educated guess, an intuitive judgment, guesstimate, stereotyping, profiling, or common sense. 24 | ``` 25 | 휴리스틱 테크닉(이하 휴리스틱)은 문제를 풀거나, 배우거나, 발견하는 데에 있어서의 접근법이다. 근데 이 접근이, 실험적으로 이루어진다. 최적이나 완벽한 결과를 보장하지 않는다! 그치만 뭔가 이루어 내는데는 충분한, 그런 접근이다. 26 | 음, 언제 쓰이냐고? 최적의 해를 찾는 것이 불가능하거나 비현실적일 때 쓰인다. 어쩌면 휴리스틱한 접근이, 적당한 해를 찾기엔 더 빠른 방법일지도 모른다. 27 | 뭐랄까 결정하는데, 너무 인지적으로 많은 과정을 거치는 것을 줄여줄수도 있고 말이다. 28 |
29 | 마지막 예시가 진짜 골때리는데, 휴리스틱한 방법의 예는 [rule of thumb](https://en.wikipedia.org/wiki/Rule_of_thumb), 근거 있는(경험에서 나온) 추측, 직관적 판단, 어림짐작, 유형화, 프로파일링(성능 분석?), 상식(...)이 있다. 30 | 31 | 32 | - 33 | 알고 보니 적당한 시행착오를 반복한다는 말인데, 단어가 참 어렵게도 생겼다. 34 | -------------------------------------------------------------------------------- /computer_science/python/mutability.md: -------------------------------------------------------------------------------- 1 | # Mutability 2 | 3 | > python 공부를 하다 보면 한 번 쯤은 mutable/ immutable object 라는 말을 들어보았을 것이다. 4 | 나 역시도 예외가 아니고, 그저 바뀌는/ 바뀌지 않는 정도로만 이해하고 있었다. 5 | 그러나 이게 웬걸, 프로젝트에서 pandas의 DataFrame을 엄청나게 자주 사용하면서 '나는 값을 바꿨는데.. 분명 바꿨는데.. 어찌 아무것도 바뀌지 않는가...'의 6 | 굴레에 빠지고 나니 mutable vs immutable 을 정리해 봐야겠다는 생각이 냉큼 들었다. 7 | 8 | 9 | 먼저 예시를 살펴보는 것도 좋겠다.
10 | 앞서 pandas 이야기를 꺼냈는데, 11 | [Pandas Package Overview: Mutability and copying of data](https://pandas.pydata.org/pandas-docs/stable/getting_started/overview.html#mutability-and-copying-of-data)에 12 | 친절한 설명이 나와있다. 13 | ``` 14 | All pandas data structures are value-mutable (the values they contain can be altered) but 15 | not always size-mutable. The length of a Series cannot be changed, but, for example, 16 | columns can be inserted into a DataFrame. However, the vast majority of methods produce new 17 | objects and leave the input data untouched. In general we like to favor immutability where sensible. 18 | ``` 19 | 20 | 이론으로 가보자. Python3 documentation에서 일부를 따왔다. 21 | 22 | ``` 23 | The value of some objects can change. Objects whose value can change are said to be mutable; objects 24 | whose value is unchangeable once they are created are called immutable. (The value of an immutable 25 | container object that contains a reference to a mutable object can change when the latter’s value is 26 | changed; however the container is still considered immutable, because the collection of objects it 27 | contains cannot be changed. So, immutability is not strictly the same as having an unchangeable value, 28 | it is more subtle.) 29 | An object’s mutability is determined by its type; 30 | for instance, numbers, strings and tuples are immutable, while dictionaries and lists are mutable. 31 | ``` 32 | 33 | ###### 참고문헌 34 | - [python3 documentation 3.1. Objects, values and types](https://docs.python.org/3/reference/datamodel.html) 35 | -------------------------------------------------------------------------------- /computer_science/server/get-process.md: -------------------------------------------------------------------------------- 1 | # get-process 2 | : 실행 중인 프로세스 목록을 보여준다. 3 | - 별도 매개변수 없이 실행하면 전체 프로세스 목록을 보여준다. 4 | - 실행 시 나오는 항목은 다음과 같다. 5 | - Handles: 프로세스가 연 윈도우 핸들의 수 6 | - NPM(K): 프로세스가 사용하는 Non-Paged Memory의 크기. 단위는 KB. 7 | - PM(K): 프로세스가 사용하는 Pageable Memory의 크기. 단위는 KB. 8 | - WS(K): 프로세스의 Working Set의 크기. 단위는 KB. Working Set은 최근에 참조한 메모리 페이지로 구성된다. 9 | - VM(M): 프로세스가 사용하는 Virtual Memory 크기. 단위는 MB. Virtual memory 는 디스크 페이징 파일 저장소를 포함한다. 10 | - CPU(s): 모든 프로세서에 대해 프로세스가 사용한 시간. 단위는 초(sec). 11 | - ID: 프로세스 ID (PID) 12 | - ProcessName: 프로세스 이름 13 | 14 | - ```get-process [문자열]``` 을 실행하면 해당 문자열을 포함하는 이름의 프로세스만 보여준다. 15 | - ```ps```, ```gps```로도 get-process를 참조할 수 있다. 16 | 17 | 18 | ###### 관련 개념 19 | - **Paging** 20 | : 가상메모리를 최소 단위로 쪼갠 일정한 크기의 블럭을 Page라 한다. Paged Memory는 가상 메모리 공간 중 Page-In/Out이 가능한 공간이고 Non-Paged Memory는 Page 운영체제를 구성하기 위한 코드 등 Paging이 발생하지 않는 공간을 의미한다. 메모리 파편화(fragmentation) 문제를 해결하기 위해 Paging을 사용한다. paging file은 swap file이라고도 부른다. 21 | (참고: [가상 메모리 (Virtual memory)](http://egloos.zum.com/sweeper/v/2988689)) 22 | - **Handle**: 윈도우 커널이 관리하는 리소스들의 토큰. 커널의 오브젝트를 사용하기 위해 필요한 일종의 장치 23 | (참고: [윈도우 핸들이란? 프로세스 Windows Handle 설명](https://codingcoding.tistory.com/201)) 24 | 25 | ###### resource 26 | - [Process Cmdlet으로 프로세스 관리](https://docs.microsoft.com/ko-kr/powershell/scripting/samples/managing-processes-with-process-cmdlets?view=powershell-6#getting-processes-get-process) 27 | - Microsoft Docs [Get-Process](https://docs.microsoft.com/en-us/previous-versions//dd347630(v=technet.10)?redirectedfrom=MSDN) 28 | 29 | ###### 트리비아 30 | - 2019/10/05 특정 프로세스의 CPU 사용량이 알고 싶었는데 그 내용이 아니었다,, 31 | - 2019/10/06 그냥 `작업 관리자`를 확인할 일이었나 싶다 :cry: ,
32 | Linux에서의 관리는 [리눅스(Linux) 프로세스 관리](https://aonenetworks.tistory.com/644), 33 | 리눅스 제타위키[리눅스 메모리 사용량순 프로세스 보기](https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EB%A9%94%EB%AA%A8%EB%A6%AC_%EC%82%AC%EC%9A%A9%EB%9F%89%EC%88%9C_%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4_%EB%B3%B4%EA%B8%B0) 34 | 를 참고하자! 35 | -------------------------------------------------------------------------------- /computer_science/python/pdb.md: -------------------------------------------------------------------------------- 1 | # pdb — The Python Debugger 2 | 3 | > 2019.10.09의 이야기: 오늘도 열심히 프린트로 디버깅을 하던 나를 보고 친구가 "언니는 디버깅 어떻게 해?" 했다. 4 | 나는 "아이고.. 저는 프린트로 디버깅을 깎습니다.." 했고 그러자 친구는 "pdb 한번 찾아봐" 라고 했다. 그리고 이 문서가 생겼다 짜잔 5 | 6 | pdb는 당연하게도 Python DeBugger의 약자이다. 이 말을 글쓴이는 gdb를 떠올렸다... 때는 2014년 대학교 1학년, C프로그래밍 프로젝트... 7 | PuTTY로 학교 서버에 접속해서 주어진 것이라고는 vi editor와 터미널 뿐인 내게 친구가 알려준.. segmentation fault를 잡는(이라 해봐야 무한 run) 방법... 8 | pdb라니 이름만 봐도 알겠네, gdb 비슷한 것 아니겠어? 그래서 gdb가 뭐였는지 먼저 간단히 정리해보기로 했다. 9 | 10 | 11 | #### [GDB: The GNU Project Debugger](https://www.gnu.org/software/gdb/) 12 | 13 | 전체 documentation: http://sourceware.org/gdb/current/onlinedocs/gdb/ 14 | 15 | GDB는 [GNU 프로젝트](https://ko.wikipedia.org/wiki/GNU_%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8) 디버거이다. 16 | GDB를 사용하면 어떤 프로그램이 실행되는 동안 그 내부에서 무슨 일이 일어나고 있는지/ 충돌이 발생했을 때 어떤 일이 일어나고 있었는지 확인할 수 있다. 17 | 18 | 버그를 잡기 위해서, GDB가 할 수 있는 것은 크게 4가지 정도로 나눌 수 있다. 19 | ``` 20 | 1. Start your program, specifying anything that might affect its behavior. 21 | 프로그램 동작에 영향을 줄 만한 것은 무엇이든 지정한 채로 프로그램을 시작할 수 있다. 22 | 23 | 2. Make your program stop on specified conditions. 24 | 특정한 조건에서 프로그램을 중지할 수 있다. 25 | 26 | 3. Examine what has happened, when your program has stopped. 27 | 프로그램이 멈췄을 때 무슨 일이 일어나고 있는지 조사할 수 있다. 28 | 29 | 4. Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another. 30 | 프로그램의 내용을 변경할 수 있다. 한 버그를 고친 것이 다른 버그에 어떤 영향을 미치는지 실험할 수 있다. 31 | ``` 32 | 아무튼 범용 디버거이고, Ada, Assembly, C, C++, D, Fortran, Go, Objective-C, OpenCL, Modula-2, Pascal, Rust 등의 언어를 지원한다. 33 | (음! python은 없군!) 34 | 여담으로 GNU홈페이지에 웃긴거 있다.... [[1]gdb 노래](https://www.gnu.org/music/gdb-song.html) [[2]gnu 깔깔유머집](https://www.gnu.org/fun/humor.html) 35 | 36 | #### PDB 37 | ```python3 38 | import pdb 39 | ``` 40 | (간단 설명 및 실 사용 예 추가할 것) 41 | 42 | 43 | resource 44 | 45 | - [Python3 documentatioin pdb](https://docs.python.org/3/library/pdb.html) 46 | - [Integration of IPython pdb](https://github.com/gotcha/ipdb) 47 | -------------------------------------------------------------------------------- /computer_science/conda.md: -------------------------------------------------------------------------------- 1 | # conda channel 2 | (2019-09-11) fbprophet package를 update 할 필요가 있어 보여서, 어떤 명령어를 사용해야 하는가에 대한 탐구를 함. 3 | ```shell 4 | conda update fbprophet 5 | ``` 6 | 하니까 그런 패키지는 없어! 라는 에러를 뱉길래, 다운로드 받을 때 사용한 명령어를 살펴보니 다음과 같았다. 7 | ```shell 8 | conda install -c conda-forge fbprophet 9 | ``` 10 | 11 | 그런데 **-c**도 **conda-forge**도 당최 뭔지 모르겠는 것이다.. 그래서 아래와 같이 구글링 했다.
12 | 13 | ```anaconda package upgrade``` --> ```conda install "-c" meaning``` --> [```conda-forge```](https://conda-forge.org/docs/) 14 | 15 | - ```-c``` option은 channel의 줄임말이다. default channel은 ~~Anaconda Cloud~~ https://repo.anaconda.com/pkgs/main/win-64 (이곳인듯 하다/내 경우 win-64 platform임)이고, conda-forge는 어떤 channel 이름이다. 16 | - 결론은 fbprophet은 conda-forge 채널에서만 다운받을 수 있는 패키지였다는 말씀이다. 17 | 18 | 19 | # conda virtual environments 20 | (2019-09-16) 지금까지 jupyter notebook 켤 때 GUI 버튼 눌러서 시작했는데... 무려 그것이 예전에 만들어둔 torchenv 환경이었음을 깨달았다. 21 | 결국 fbprophet 사용하는... 새로운 가상환경 만들기로... 매번 찾는 것 같아서 기록해둔다.
22 | - [Managing environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) 23 | 24 | 새로운 환경에 fbprophet을 설치하려고 보니 첫 번째로 해야 할 일은 gcc를 까는 것인듯 했다. 그런데 무려 gcc 패키지가... linux 와 osX 용으로밖에 없는 것이다... 대체 패키지를 찾기 위해선 25 | 26 | 1. 내 플랫폼을 안다 27 | 2. 플랫폼에 맞는 패키지가 있나 https://anaconda.org/ 에서 찾아보고 install! 28 | 29 | 정도인데, 내 플랫폼을 알려면 ```conda info``` 명령어를 실행해보자. 30 | 31 | ### virtualenv 복사하기 32 | 같은 스펙의 가상환경을 만들고 싶을 때, 물론 ```pip freeze > requirements.txt```를 사용해 ```pip install -r requirements.txt``` 33 | conda에서는 다음 명령어를 사용하면 된다. 34 | ```shell 35 | conda create --name (새로 생성할 가상환경 이름) --clone (원래 가상환경 이름) 36 | ``` 37 | ```conda create```의 옵션으로는 ```--name```외에도 38 | - ```--prefix```, ```--p```: 가상환경의 위치 설정 39 | - ```--no-default-packages``` : 기본 패키지 없이 생성! ... 인데 일반 ```conda create --name (생성할 가상환경 이름)```이랑 다른지 잘 모르겠다. 40 | - ```python=3.6``` 처럼 python 버전을 설정할 수 있다. 41 | - 기타 옵션들은 ```conda create --help``` 를 통해서 확인해보자! 42 | 43 | ### 프로젝트 관리를 위해 environment.yml로 export! 44 | 45 | ```python3 46 | conda env export > environment.yml 47 | ``` 48 | -------------------------------------------------------------------------------- /today/18-03-28.md: -------------------------------------------------------------------------------- 1 | ## iTerm2 2 | 3 | ##### 왜때문에 이제서야 4 | 연구실 맥북을 사용하고 있는 요즘인데, terminal이 아니라 뭔가를 전에 사용했던 것 같은데, 영 기억이 나지 않아 terminal로 매일같이 작업을 하던 중이었다.
5 | 후배와의 만남에 멍하니 그의 맥북 화면을 보고 있다가 망각의 함에 들어가있던 그 이름 ```iTerm``` 을 꺼냈다... 오... 나란 사람... 별걸 다 까먹어...
6 | 7 | [본격 macOS에 개발 환경 구축하기](https://subicura.com/2017/11/22/mac-os-development-environment-setup.html) 이 블로그를 보고 조금조금 설정했다. 8 | 9 | 10 | [iTerm2 colorschemes 모음 사이트](http://iterm2colorschemes.com/) 여기서 예쁜 테마를 다운받고 11 | 12 | 다음으로 zsh(a.k.a. 쯔쉬-애정하는 나의 친구 뚀와 나는 제트쉘을 꿋꿋이 쯔쉬라고 부르고 있다-) 를 설치했다. 13 | zsh의 여러 테마는 [여기](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes)서 확인할 수 있다. 14 | 15 | * * * 16 | 17 | ## 주니어개발자 18 | 19 | 미디엄 데일리 다이제스트 보다가 [이 글](https://hackernoon.com/dont-be-a-junior-developer-608c255b3056)에서 따왔다 20 | 21 | Can you explain to your family members how the internet works? How a computer works? How websites work? 22 | Do you have a basic understanding of HTML, CSS and Javascript so you can build your own websites? 23 | Do you know a little bit of React? 24 | Have you built a few projects on your own on Github and you are comfortable putting up websites and apps online? 25 | Good, then you are not a junior developer. 26 | 27 | ~ 중략 ~ 28 | 29 | Stop calling yourself a junior developer. 30 | Have a junior developer mindset where you are constantly looking to learn from others, 31 | but never settle for a junior developer role. 32 | Apply for roles for which you are under qualified not overqualified. 33 | Remember that if you never ask the answer will always be no. 34 | 35 | ***Don’t overestimate the world and underestimate yourself. You are better than you think.***
36 | 시무룩한 와중에 조금 도움이 된 것 같다. 37 | 38 | ##### 오늘의 단어 39 | **pigeonhole**
40 | ```pigeonhole yourself as ~``` 라는 구문이 있었는데, pigeonhole 비둘기집인데 요 문맥에서 해석 어떻게하지 하고 찾아봤다.
41 | [네이버 영어사전 pigeonhole](http://endic.naver.com/enkrEntry.nhn?sLn=kr&entryId=4268d0d4e60545f7a7109e15b8d01b94&query=pigeonhole)\ 42 | 명사로는 비둘기집 맞는데 동사중에 ```(대충)분류하다``` 라는 뜻이 있었다. 아마 너를 쉽게 ~로 치부하지 마라. 이런 의미인 것 같다. 43 | -------------------------------------------------------------------------------- /computer_science/computer_architecture/ch1_computer_architecture_review.md: -------------------------------------------------------------------------------- 1 | # Chapter 1: Computer Architecture Review 2 | 3 | ## Contents 4 | - [Metrics: 좋은 컴퓨터 아키텍처란?](#metrics) 5 | - [Performance](#metrics-performance) 6 | - [Power consumption](#metrics-power-consumption) 7 | - [What to Improve?](#what-to-improve) 8 | - [Common case](#common-case) 9 | - [Amdahl's law](#amdahl-s-law) 10 | 11 | * * * 12 | 13 | ## Metrics 14 | 컴퓨터가 좋다 나쁘다 판단하는 일반적인 평가 기준, performance와 power consumption
15 | 컴퓨터 구조는 크게 3가지 종류로 나뉜다: Desktop(일반), Server(고성능), Embedded(내장;제한적) 16 | 17 | ### Performance 18 | 무엇을 세냐면... 19 | - [level 0] number of **operations** (알고리즘 레벨, big-O notation) 20 | - 그런데, operation마다 걸리는 시간이 다 다를 수도 있잖아. 21 | - [level 1] number of **machine instructions**(CPU가 single cycle에 실행시킬 수 있는 program의 unit) **per operations** (PL, Compiler 레벨) 22 | - 그런데, 일반적으로는 machine instruction이 single cycle이 걸린다고야 하지만- 사실은 2 cycles가 걸릴 수도 있고 3 cycles가 걸릴 수도 있잖아. 23 | cache missing이라도 나면 memory IO는 수십~수백 사이클이잖아. 24 | - **[level 2] 어떤 Instruction이 실제로 얼마나 빨리 수행되는가? (CPU, architecture 레벨)** 25 | - [bonus] I/O device access가 얼마나 빠른가? (운영체제 레벨) 26 | 27 | #### CPU Time (= Execution time) 28 | computation time을 잴 때 가장 많이 사용하는 metric, ```실행 시간``` 29 | - 어떤 프로그램을 실행시킬 때 얼마나 많은 clock cycle을 필요로 하는가? (= **CPU Clock Cycles**) 30 | - 한 clock cycle을 실행하는데 얼마나 많은 Wall clock time(the actual amount of time taken to perform a job)이 소모되는가 (= **Clock Cycle Time**) 31 | ``` 32 | (CPU Time) = (CPU Clock Cycles) * (Clock Cycle Time) 33 | = (CPU Clock Cycles) / (Clock Rate) 34 | ``` 35 | 그래서 우리는 36 | 1. CPU Clock Cycle을 줄이거나 37 | 2. Clock Rate(CCT의 역수)를 늘리거나 한다. 38 | - 이 말이 곧 Clock Cycle Time(이하 CCT)를 줄인다는 뜻이다.
39 | 참고로 1GHz CPU의 CCT는 1ns, 3Ghz CPU의 CCT는 0.33ns이다. 40 | 41 | 42 | ### Power consumption 43 | - list 44 | 45 | * * * 46 | 47 | ## What to improve 48 | 어떤 방법으로 성능을 향상시킬 것인가? 49 | ### Common case 50 | - list 51 | 52 | ### Amdahl's law 53 | - list 54 | -------------------------------------------------------------------------------- /finance/smart_beta.md: -------------------------------------------------------------------------------- 1 | ## Smart beta 2 | > passive investing(buy and hold)과 active investing 의 장점을 결합한 투자 전략 3 | 4 | smart beta의 목적은 전통적인 active management보다는 낮은, straight index investing보다는 높은 비용으로 5 | 6 | 1. [alpha](https://www.investopedia.com/terms/a/alpha.asp)를 얻는 것 (이 때 알파는 간단히 말하면 초과수익) 7 | 2. risk를 낮추는 것 8 | 3. 포트폴리오 다각화diversification (소형주, 가치주 등 여러 팩터를 결합) 9 | 10 | 하는 것이다. 11 | 12 | 13 | 장기적으로 주가지수 이상의 성과를 낼 수 있는 매우 체계적(rule-based)이고 투명한 운용 방식이다. 14 | 15 | 16 | 사실상 smart beta는 17 | 18 | - 주가는 모든 정보를 반영하고 있고, 일관된 alpha 생성은 불가능하다는 내용의 *효율적 시장 가설*[efficient-market hypothesis](https://www.investopedia.com/terms/e/efficientmarkethypothesis.asp) 19 | - 가치에 비해 가격이 과소평가 된 경우 매수하는 *가치투자*[value investing](https://www.investopedia.com/terms/v/valueinvesting.asp) 20 | 21 | 의 조합이라고 볼 수 있다. ( 효율적 시장 가설에 의하면 투자자들은 가치를 판단할 수 없으니, 서로 반대? 되는 이론이라고 할 수 있다. 22 | 물론 EMH가 언제나 정확한 것은 아니다; 주가에 모든 정보가 반영된 것이라도 사람마다 정보를 판단하는 기준이 달라서 가치 판단도 다르게 이루어지고, 23 | 정보가 반영되는 속도도 모두 다르다. 또 투자자들이 항상 합리적인 선택만 한다는 보장이 없으며, 시장에 뭔가 문제가 생겨 이득을 보는 경우도 있다. 24 | 따라서 위 두 이론이 공존하는 데는 무리가 없다. ) 25 | 26 | 주식equities, 채권fixed income, 상품commodities, 다중자산 등 에 적용할 수 있으며, 경제학자 Harry Markowitz가 modern portfolio theory에서 처음 이론화했다. 27 | 28 | smart beta는 29 | 30 | 1. 전통적인 시가총액 기반 지수 대신 새로운 index 구성 방식을 사용하는 일련의 투자 전략을 말한다. 31 | 2. 규칙 기반으로 펀드매니저늬 주관적 판단이 개입하지 않으며 체계적이고 투명하며, 이를 통해 투자요소 혹은 시장 비효율성을 잡아낼 것을 강조한다. 32 | 3. 장기적으로 투자할 경우 큰 손실을 피하고자 한다. NASDAQ, S&P, KOSPI와 같은 시가총액가중지수Capitalization-weighted index에 대한 risk-adjust된 수익률 개선을 꾀한다. 33 | 4. 스마트 베타는 요소factor 차원에서의 다각화에 대한 요구와 연관지을 수 있다. 변동성volatility, 유동성liquidity, 퀄리티quality, 가치value, 규모size, 모멘텀momentum 등 다양한 가중치 체계에 노출함에 따른 다각화 전략을 꾀한다. (전통적인 지수에 구애받기보다는 새로운 가중치를 고려하는데 집중한다.) 34 | 35 | 36 | ###### References 37 | - [Smart beta](https://www.investopedia.com/terms/s/smart-beta.asp) from Investopedia 38 | - https://en.m.wikipedia.org/wiki/Capitalization-weighted_index 39 | - [확실한 요소를 기반으로 결정해 투자하는 ‘팩터 투자’란?](https://m.post.naver.com/viewer/postView.nhn?volumeNo=16340445&memberNo=2993146) 네이버포스트 40 | - [감정을 이기는 퀀트투자 스마트 베타: 퀀트 펀드매니저가 쓴 계량투자 입문서 현명한 베타를 통한 알파 추구](https://book.naver.com/bookdb/book_detail.nhn?bid=12722739), 김병규 , 이현열WATER BEAR PRESS(워터베어프레스) 41 | -------------------------------------------------------------------------------- /computer_science/python/metaclass.md: -------------------------------------------------------------------------------- 1 | 앞서 [recursionlimit](https://github.com/codingbowoo/codingbowoo-resource/blob/master/stack/pythonpractice/recursionlimit.md) 2 | 문서에서의 문제 상황을 당장 해결했지만, 도무지 recursion이 발생하는 포인트를 찾지 못했다.
3 | 그리고 범인은 바로바로... 4 | 5 | # metaclass 6 | 7 | Metaclass가 뭐야? 한다면 python3.7 documentation [Metaclasses](https://docs.python.org/3.7/reference/datamodel.html#metaclasses)
8 | 간단하게 설명하자면, (type을 상속받아서) 클래스를 만드는 클래스 이다. 9 | 실제 사용 예시는 라이브러리의 클래스에서 많이 찾아볼 수 있는데, 구체적인 예시로 pandas의 DataFrame이 있다. 10 | 11 | ```python3 12 | type(pandas.DataFrame) 13 | ``` 14 | 15 | 를 실행시키면 16 | 17 | ``` 18 | type 19 | ``` 20 | 21 | 이라는 결과를 얻을 수 있다. 22 | 23 | +) 내가 새로운 class를 만들어서, 예를 들어 pandas의 DataFrame을 상속하는 myDataFrame을 생성했다고 하자.
24 | 내가 생성한 myDataFrame은 DataFrame과 동일한 성질을 가진다. (어떤 메타클래스의 instance이다.) 25 | 26 | 클래스 정의에 지정된 키워드 인수들arguments은 아래 메타클래스 작업을 거친다. 27 | 28 | 1. MRO(Method Resolution Order) 결정
29 | : ```클래스이름.mro()``` 또는 ```클래스이름.__mro__```로 현재 클래스의 메소드 탐색 순서를 확인할 수 있다. 30 | 2. Metaclass 결정
31 | : 일반적으로 ```object``` 32 | 3. class namespace 준비 33 | 4. class body 실행 34 | 35 | 36 | * * * 37 | 위 [recursionlimit](https://github.com/codingbowoo/codingbowoo-resource/blob/master/stack/pythonpractice/recursionlimit.md) 문서에서의 문제 상황을 다시 살펴보자. 38 | ```python3 39 | import pandas as pd 40 | import utils as u #자체제작한 모듈 utils.py 41 | 42 | class myDataFrame(pd.DataFrame): 43 | def __init__(self): 44 | self.daily = u.read_data("../data/Daily.csv") 45 | """ utils.py 46 | def read_data(filepath): 47 | df_r = pd.read_csv(filepath, index_col=[0]) 48 | # 중략 49 | return df_r 50 | """ 51 | ``` 52 | 53 | 54 | 나의 의도는 pd.read_csv()의 결과물을 DataFrame으로 받자!였으나, 이 경우 DataFrame 대신 pd.read_csv가 그 결과를 myDataFrame으로 반환한다. 따라서 recursionlimit 에러가 발생한다. 55 | DataFrame을 반환하는 다른 판다스 함수들도 myDataFrame으로 반환을 시도할 것이다. 당연히 recursion이 발생한다. 56 | 57 | 58 | 정리해보면 아래와 같다. 59 | 60 | > 1. myDataFrame()을 생성 61 | > 2. (init 중) pd.load_csv()를 호출 62 | > 3. pd.load_csv() 결과를 저장하자. 어디에? pd.DataFrame을 상속받은 클래스(myDataFrame)에! 63 | > 4. 1 로 이동 및 무한반복 64 | 65 | 66 | 해당 상속을 없애주는 것/ 함수로 만드는 것으로 문제를 해결할 수 있다. 잘 알아보고 사용하기! 67 | -------------------------------------------------------------------------------- /today/18-01-11.md: -------------------------------------------------------------------------------- 1 | 오늘의 궁금증 해결 2 |
3 | ## .bashrc 와 .bash_profile 의 차이점 4 | : 친구의 vim 설정을 구경해보니 alias 들은 .bashrc에 많이 적는 것 같았고, .bash_profile에는 함수를 사용해서 alias를 적어주고 있는 것 같았다. 5 | 함수를 사용한다는게 무슨 말이냐면 이런 말이다. 6 | ``` 7 | function pmanage { 8 | python3 ~/manage.py $@ 9 | } 10 | 11 | function pmigrate{ 12 | pmanage makemigrations 13 | pmanage migrate 14 | } 15 | ``` 16 | 17 | 구글링 해서 알아들은 말은 다음과 같다. 18 | - .bashrc 는 bash가 실행될 때마다 수행된다. 로그인을 안 한 shell에서도 실행된다. 19 | - .bash_profile은 bash에 로그인할 때마다 수행된다. 20 | 21 | - 새 터미널 창을 열 때마다 .bashrc를 로드하고자 한다면 .bash_profile 에서 .bashrc 22 | - .profile이라는 것이 있는데, .bash_profile과의 구분은 bash와 상관이 있는지 없는지 여부. 로그인 할 때 로드 23 | 24 | ###### 실험해보니 25 | : 실험하고 싶은데 아직 실험 못 해봤다. 26 | 27 | ###### 참고한 블로그 28 | - http://uroa.tistory.com/114 29 | - http://keichee.tistory.com/14 30 | 31 | * * * 32 |
33 | 34 | ## mod-wsgi 와 python3 35 | 36 | ``` 37 | sudo apt-get install libapache2-mod-wsgi 38 | ``` 39 | 를 열심히 했는데 자꾸 에러메세지가 나왔다. 40 | 41 | 알고보니 python3을 사용하는 나, 42 | ``` 43 | sudo apt-get install libapache2-mod-wsgi-py3 44 | ``` 45 | 를 했어야 했다. 별도의 패키지가 있었다 ㅠ0ㅠ 46 | 47 | 48 | 이 과정에서 **끼웃** 해서 알게 된 것은, 49 | ``` 50 | sudo apt-get purge (패키지이름) 51 | ``` 52 | 하면 uninstall 할 수 있다는 것이다. 53 | 54 | 55 | 구글링해보니 56 | ```apt-get remove```와 ```apt-get purge``` 를 놓고 이런저런 이야기가 있었지만 이미 머리가 포화되어 버렸따. 57 | 58 | * * * 59 |
60 | 61 | ## linux ```scp``` command 62 | 63 | : ```scp```는 안전하고(secure), 암호화된(encrypted) 네트워크 연결 상에서 파일을 복사하는 것이다. 64 | 65 | 언제 썼냐면 친구가 자기 vim 설정 불러오느라 사용하는걸 또 **끼웃**해서 알게 되었다. **s**ecure **c**o**p**y라서 ```scp```다. 66 | 67 | 68 | ``` 69 | cp (source) (destination) 70 | ``` 71 | cp 명령어에 익숙해서 알아먹기 엄청 어렵지는 않았다. 72 | ``` 73 | scp (source) (destination) 74 | ``` 75 | 이었기 때문이다. 76 | 77 | remote한 곳에서 받아오고 싶으면 78 | ``` 79 | scp (id)@(host):(source) (destination) 80 | ``` 81 | 82 | 해주면 된다. 예를 들면 ```scp lisabowoo@163.239.26.104:/home/lisabowoo/image/hello*.jpg /home/lisabowoo/downloads``` 이런 식으로 하면 163.239.26.104의 /home/lisabowoo/image/ 에 저장된 hello(뫄뫄).jpg 들을 죄다 로컬디렉토리의 /home/lisabowoo/downloads로 저장할 것이다. 83 | 84 | - secure 하다는 것이 포인트다. 85 | 86 | ###### 참고 링크 87 | - https://www.computerhope.com/unix/scp.htm 88 | -------------------------------------------------------------------------------- /finance/terms.md: -------------------------------------------------------------------------------- 1 | (영어 기준 ABC순) (**word** 단어: 의미) 2 | 3 | # A 4 | - **Alpha 알파**: 베타를 감안한 기대수익률 대비 거둔 수익, 벤치마크와 무관하게 낼 수 있는 초과 수익률 5 | 6 | # B 7 | - **Backtest**: 어떤 투자 전략을 과거에 적용해서 어떤 결과가 나오는지 알아보는 과정 8 | - **Beta 베타**: 벤치마크(e.g. KOSPI지수) 대비 포트폴리오의 민감도, 벤치마크에 얼마나 영향을 받는가 9 | - **Buy and Hold**: 한번 매수한 종목을 계속 보유하는 것 10 | 11 | # C 12 | - **Cross Section 크로스 섹션**: 같은 시간위치에 존재하는 것 13 | - **Cross-sectional momentum 횡단면 모멘텀**: portfolio stock을 결정지을 때 winner-loser 판단 기준을 "상대적"으로 하는 것 14 | - time-series가 absolute return을 판단 기준으로 하는 것과 대비된다. 15 | 16 | # D 17 | - **Drawdown 드로우다운**: 고점 대비 저점까지의 하락폭 18 | - 하락폭이 지나치게 크면 고점을 회복하기 힘들다. 19 | 20 | # E 21 | - **Earning Surprise 어닝 서프라이즈**: 시장의 기대치보다 기업의 실적이 높게 발표되는 것 22 | - **EPS 주당순이익** 23 | - **Equal weighted 동일가중**: ```1/N(종목 개수)```의 비율로 투자하는 것 24 | 25 | # F#G#H 26 | 27 | # I 28 | - **Idiosyncratic Volatility 고유 변동성**: 주가 수익률의 변동성에서, 주식 수익률에 영향을 줄 수 있는 *시장 효과* 등의 다양한 변수들을 통제한 후의 변동성. 29 | - e.g. 파마-프렌치 3팩터로 회귀분석을 실시한 후 팩터로 설명되지 않는 잔차를 **고유수익**으로 설정, 이 값의 변동성을 구한다. 30 | 31 | # J#K#L 32 | 33 | # M 34 | - **Market cap 시가총액**: (특정 종목의 발행주식 수)\*(주가) 35 | - **Market Microstructure 시장미시구조**: 36 | - **Momentum 모멘텀**: 주가가 상승하던 종목은 지속적으로 상승, 하락하는 종목은 지속적으로 하락하는 경향 37 | - 절대Absolute 모멘텀: 특정 주식이 과거 주가 대비 상승한 정도(=시계열Time-series 모멘텀) 38 | - 상대Relative 모멘텀: 특정 주식이 타 주식 대비 주가가 강한 정도(=횡단면Cross Sectional 모멘텀) 39 | - 듀얼Dual 모멘텀: 절대, 상대 모멘텀을 같이 고려하는 것 40 | 41 | # N#O 42 | 43 | # P 44 | - **Panel 패널**: 여러 시간에 대한 여러 개의 데이터를 가지는 크로스 섹션 데이터 (e.g. 주가, 시가 총액을 모두 갖고 있는 데이터) 45 | - 주로 DataFrame/ 3차원 Panel 객체로 표현 46 | - **PBR 주가순자산비율**: (주가)/(주당순자산), (시가총액)/(총자본) 47 | - **PER 주가수익비율**: (주가)/(주당순이익), (시가총액)/(당기순이익) 48 | - **Portfolio 포트폴리오**: 분산투자의 투자 대상의 총칭 49 | 50 | # Q 51 | - **Quant 계량투자**: 정량적인 분석만으로 투자하는 것 52 | 53 | # R 54 | - **Rebalancing 리밸런싱**: (정기적으로) 종목을 교체하는 것 55 | - **ROE 자기자본이익률**: (당기순이익)/(평균자본) 56 | 57 | # S 58 | - **Sharpe ratio 샤프 지수**: (Annualized return 연간 수익률)/(Annualized Volatility 연율화 변동성) 59 | - **Survivalship Bias 생존 편향**: 60 | 61 | # T#U 62 | 63 | # V 64 | - **Volatility Drag 변동성 드래그**: 수익과 손해의 비대칭성 65 | 66 | # W#X#Y#Z 67 | 68 | ##### 참고자료 69 | - 실전 퀀트투자, 홍용찬, 이레미디어 70 | - 스마트 베타, 김병규/이현열, WATER BEAR PRESS(워터베어프레스) 71 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch9_math_of_crypto.md: -------------------------------------------------------------------------------- 1 | # Mathematics of Cryptography 2 | 3 | prime numbers, primality test algorithms, factorization algorithms, 4 | Chinese remainder theorem, quadratic congruence, modular exponentiation and logarithm 5 | 6 | 7 | ## Primes 8 | - **prime**, **composite**, **coprime(relatively prime)** 9 | - cardinality 10 | - checking primality 11 | - Euler's Phi-Function: finds the numver of integers that are smaller than n and relatively prime to n 12 | - Fermat's Little Therem: If p is prime and a is an integer, 1) a^(p-1) ≡ 1 (mod p) 2) a^p ≡ a (mod p) 13 | - Euler's Therorem: Fermat's little theorem w/o the condition taht a and n should be coprime 14 | - Generating Primes: mersenne primes, fermat primes 15 | 16 | ## Primality Testing 17 | - Deterministic Algorithms 18 | - Divisibility Algorithm 19 | - Probabilistic Algorithms 20 | - Fermat Test 21 | - Square Root Test 22 | - Miller-Rabin Test : ```n-1 = m * 2^k```, finding a strong pseudoprime 23 | 24 | ## Factorization 25 | **security of several public-key cryptosystems** 26 | - Greatest Common Divisor 27 | - Least Common Multiplier 28 | - Trial Division Method 29 | - Fermat MethodPollard rho Method 30 | 31 | ## Chinese Remainder Theorem 32 | **solve a set of songruent equations with one variable but different moduli(relatively prime)** 33 | - solution 34 | 1. Find common modulus M = m1 * m2 * ... * mk 35 | 2. Find M1 = M/m1, M2 = M/m2, ..., Mk = M/mk 36 | 3. Dinf the multiplicative inverse of M1, ..., Mk using the corresponding moduli 37 | 4. The solution: ```x = (a1*M1*inv(M1) + a2*M2*inv(M2) + ... + ak*Mk*inv(Mk)) mod M``` 38 | 39 | ## Quadratic Congruence 40 | **x^2 ≡ a (mod n)** 41 | - ```a```: quadratic residue(QR) if the equation has two solutions 42 | - ```a```: quadratic nonresidue(QNR) if the equation has no solutions 43 | 44 |
45 | 46 | - Euler's Criterion: **a^((p-1)/2) ≡ 1 (mod p)** -> QR, **a^((p-1)/2) ≡ -1 (mod p)** -> QNR 47 | - Quadratic Congruence Modulo a Composite 48 | - complexity: **solving a quadratic congruence modulo a composite is as hard as factorization of the modulus** 49 | 50 | ## Exponentiation and Logarithm 51 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch_loss_func.md: -------------------------------------------------------------------------------- 1 | # PyTorch Loss Function 2 | 3 | 4 | 아래와 같은 Fully Connected Layer 3개(+ 사이사이에 ReLU)로 구성한 Net이 있다고 하자 5 | ```python3 6 | import torch 7 | import torch.nn as nn 8 | import torch.nn.functional as F 9 | 10 | class Net(nn.Module): 11 | 12 | def __init__(self): 13 | super(MLP, self).__init__() 14 | self.fc1 = nn.Linear(21*12, 21*6) 15 | self.fc2 = nn.Linear(21*6, 21) 16 | self.fc3 = nn.Linear(21, 1) 17 | 18 | def forward(self, x): 19 | x = x.view(-1, self.num_flat_features(x)) 20 | x = F.relu(self.fc1(x)) 21 | x = F.relu(self.fc2(x)) 22 | x = self.fc3(x) 23 | return x 24 | 25 | def num_flat_features(self, x): 26 | size = x.size()[1:] # all dimensions except the batch dimension 27 | num_features = 1 28 | for s in size: 29 | num_features *= s 30 | return num_features 31 | ``` 32 | 33 | ```python3 34 | net = Net() 35 | _input = torch.randn(1, 252) 36 | output = net(_input) 37 | 38 | target = torch.randn(1) 39 | target = target.view(1, -1) 40 | 41 | criterion = nn.MSELoss() 42 | 43 | loss = criterion(output, target) 44 | ``` 45 | 위와 같이 해주면 ```grad_fn```으로 다음 함수를 확인할 수 있다. 46 | ```python3 47 | print(loss.grad_fn) 48 | print(loss.grad_fn.next_functions) 49 | 50 | # Output: 51 | # 52 | # ((, 0),) 53 | ``` 54 | 55 | 꼬리에 꼬리를 물고 확인 가능하다. 이 예시에서는 처음에 net의 flow가 아래와 같다. 56 | > input -> view -> linear -> relu -> linear -> relu -> linear
57 | > -> MSELoss
58 | > -> loss
59 | 60 | ```grad_fn```과 ```next_functions```로 그래프를 백트래킹 해보면 다음과 같다. (괄호 안을 주목, **연결고리는 굵은 글씨**) 61 | > input -> view()
62 | -> linear(\<**AddmmBackward** object>) -> relu()
63 | -> linear(\<**AddmmBackward** object>) -> relu()
64 | -> linear(\<**AddmmBackward** object>)
65 | > -> MSELoss(\<**MseLossBackward** object>)
66 | > -> loss
67 | 68 | ###### resources 69 | - [Pytorch tutorial loss function](https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html#loss-function) 70 | -------------------------------------------------------------------------------- /computer_science/machine_learning/nlp_parsing.md: -------------------------------------------------------------------------------- 1 | ### Grammars and Parsing 2 | 1. Grammar 문법: 문장의 구조적 성질을 규칙으로 표현한 것 **A set of rewrite rules**, Context Free Grammar(CFG) 3 | 2. Syntactic Parsing 구문 분석기: 문법을 이용하여 문장의 구조를 찾아내는 process, Tree형태로 표현. 몇 개의 형태소 -> 구문 요소(구: phrase) -> 구문 요소들간의 결합구조: Tree형태로 최종 구문 구조; S> NP, VP > NP+PP, Pro, V, Det+N, Prep+NP 등 // Produces all possible parse trees -> Syntactic Ambiguity 발생 4 | 1. Given 1) a string of terminals and 2)a CFG, determine if the string can be generated by the CFG / Top-Down, Bottom-up, Caching(Memoizing) 5 | 2. Dynamic Programming Parsing Methods: **CKY Parser**(First grammar -> Chomsky normal form(CNF), O(n^2) cells, O(n) split points —> O(n^3) in the end), Earley’s parser, Tomita’s Parser(LR Parser) 6 | 7 | ### Language Modeling with N-grams 8 | - Conditional Probability, Language Modeling, Markov Assumption —> N-Gram Models 9 | - Maximum Likelihood Estimation 10 | - Problems 1) the perils of overfitting, 2) zeros of not? Zipf’s law 11 | - ** Smoothing** 1) Robin Hood, 2) Laplace(Add-one), 3) Add-k +a) Backoff, Interpolation 12 | - Evaluation: **Perplexity** an intrinsic evaluation measure of how well a model “fits” the test data; the probability of the test set(assigned by the language model), normalized by the number of words. Minimize perplexity == Maximizing probability == Better model 13 | - Unknown words: Out Of Vocabulary(OOV) 14 | 15 | ### POS Tagging, Sequence Labeling, and HMM 16 | 1. Part Of Speech Tagging: the lowest level of syntactic analysis. —>는 ambiguity 발생 -> probability를 활용하자(HMM) 17 | 2. Sequence Labeling 18 | 3. Hidden Markov Models: A set of states, Transition probabilities, Distinguished start and end states 19 | 1. Decoding: Forward Algorithm, The Viterbi algorithm 20 | 4. Baum-Welch algorithm/ EM algorithm 21 | 22 | ### Statistical Parsing 23 | - Phrase Chunking as Sequence Labeling: B(begin)I(inside)O(other) tagging 24 | - Probabilistic(P)CKY Parser 25 | - 한국어 구문 분석: Dependency Grammars 의존문법을 이용 1) 투영의 원칙(엇갈린 의존관계X) 2) 지배성분(Head) 유일의 원칙(임의의 문장 성분은 다른 하나의 문장 성분만을 수식) 3) 지배성분 후위의 원칙 26 | 27 | ### Neural Shift-Reduce Dependency Parsing 28 | - Shift-Reduce dependency parser 29 | - Shift: Push the next word in the buffer onto the stack 30 | - Reduce: Replace a set of the top elements on the stack with a constituent composed of them, 31 | -------------------------------------------------------------------------------- /computer_science/machine_learning/parameter_search.md: -------------------------------------------------------------------------------- 1 | # Hyperparameter Tuning / Neural Architecture Search 2 | 간단 정리 & 자료 모음 3 | 4 | 5 | #### 사전지식 반영 X 6 | - grid search 7 | - scikit-learn GridSearchCV 8 | - random search 9 | - scikit-learn RandomizedSearchCV 10 | 11 | #### 사전지식 반영 O 12 | - Bayesian Optimization 13 | - 현재까지의 입력값-함숫값 바탕으로 미지의 목적 함수의 형태에 대한 확률적 추정을 수행하는 **surrogate model** (주로 gaussian process 사용) 14 | - 목적 함수에 대한 현재까지의 확률 추정 결과를 바탕으로 최적 입력 x\*를 찾는데 유용할 만한 다음 입력값 x_(t+1)을 추천하는 **acquisition function** (keyword: exploitation & exploration, Expected Improvement) 15 | - 정리하자면 surrogate model 확률 추정 결과 바탕으로 acquisition function 최대로 하는 x_(t+1) 추천, x_(t+1)에 대한 objective function값 계산, 기존 입력값-함숫값 set에 추가한 수 surrogate model로 돌아간다. 이후 반복. 16 | 17 | - 수아랩 리서치 블로그 [Bayesian Optimization 개요: 딥러닝 모델의 효과적인 hyperparameter 탐색 방법론 (1)](https://research.sualab.com/introduction/practice/2019/02/19/bayesian-optimization-overview-1.html) 18 | - MLconf [Let’s Talk Bayesian Optimization](https://mlconf.com/blog/lets-talk-bayesian-optimization/) by Meghana Ravikumar 19 | - bayes_opt https://github.com/fmfn/BayesianOptimization 20 | - https://gist.github.com/mohit-sinha/be3f2999eb21d1992d03b7590fe2d88b 21 | - 다시 수아랩 리서치 블로그 [Bayesian Optimization 개요: 딥러닝 모델의 효과적인 hyperparameter 탐색 방법론 (2)](http://research.sualab.com/introduction/practice/2019/04/01/bayesian-optimization-overview-2.html) 22 | 23 | - 한 단계 더: paper [BOHB: Robust and Efficient Hyperparameter Optimization at Scale](http://proceedings.mlr.press/v80/falkner18a/falkner18a.pdf) 24 | 25 | #### evolutionary algorithms for NAS 26 | - paper [Large-Scale Evolution of Image Classifiers](https://arxiv.org/abs/1703.01041) 27 | - paper [Regularized Evolution for Image Classifier Architecture Search](https://arxiv.org/abs/1802.01548) 28 | - Google AI Blog [Using Evolutionary AutoML to Discover Neural Network Architectures](https://ai.googleblog.com/2018/03/using-evolutionary-automl-to-discover.html) 29 | - paper [Towards Automated Deep Learning: Efficient Joint Neural Architecture and Hyperparameter Search](https://arxiv.org/abs/1807.06906) 30 | 31 | 32 | #### ML optimization을 돕는 패키지들 33 | - hyperopt https://github.com/hyperopt/hyperopt 34 | - studioml http://docs.studio.ml/en/latest/hyperparams.html 35 | - tune https://ray.readthedocs.io/en/latest/tune.html 36 | - DEAP 37 | -------------------------------------------------------------------------------- /book/care_therapy.md: -------------------------------------------------------------------------------- 1 | # 매일 의존하며 살아갑니다 2 | 3 | 2020.02.17 ~ 4 | 5 | 네이버 책 [매일 의존하며 살아갑니다: 일상이 괴로워진 당신을 위한 의존과 돌봄의 심리학](https://book.naver.com/bookdb/book_detail.nhn?bid=15769246)
6 | 7 | 도하타 가이토Kaito Tohata, 김영현 옮김 8 | 다다서재 9 | 10 | 정확한 제목은 **居るのはつらいよ: ケアとセラピーについての覚書 ([シリーズ ケアをひらく](https://www.igaku-shoin.co.jp/prd/care_hira/ch_pamphlet.pdf))」**, 11 | '있기'는 괴로워: 돌봄(케어)와 치료(테라피)에 대한 기록 (돌봄을 열다 시리즈) 이라는 뜻이다. 12 | 13 | 14 |
15 | 읽으며 기록한 문장들 16 | 17 | - 논 자취는 없어도 공부한 공은 남는다.12 18 | - 나는 그때, 완전히, 철저하게, 치명적으로, 어리석었다.23 19 | - 그 무렵의 나는 박사가 되었다는 성취감에 취하고 백수가 될 지 모른다는 공포감에 떨다가 많은 것을 흘려버렸다.24 20 | - 분명 유리 씨는 지금쯤 불타고 있을 것이다. 입원을 하게 되겠지. 그리고 마음속 무언가가 전부 재가 되면 다시 시설로 돌아올 것이다.83 21 | - 모두들 히가미사가 브레이크 밟는 것을 느끼지 못했다. 아니, 히가미사가 운전하고 있다는 것 자체를 몰랐다. 사고가 나거나 급제동을 하지 않는 이상 아무도 깨닫지 못할 것이다. 의존노동이란 그런 것이다.113 22 | - 의존노동은 당연한 일을 너무도 당연하다는 듯이 제공하는 것이며, 그럼으로써 받는 이는 자신이 의존한다는 사실을 깨닫지 못한다 ... 일을 잘할수록 누구도 고마워하지 않기 때문이다.114 23 | - 전문성은 일상에 녹아들었다.119 24 | - '평형상태 --> 비상사태 --> 새로운 평형상태'.125 25 | - 우리는 두 가지 시간을 살아가고 있습니다. 하나는 선을 그리는 시간으로 우리에게 이야기를 줍니다. 다른 하나는 원을 그리는 시간으로 우리에게 일상을 줍니다.128 26 | - 그곳에는 무엇인가 있다. 하지만 그 무엇이 이쪽을 향해 아무것도 하지 않는다. 우리는 완벽하게 내버려져 있는 것이다. '공허에 방치된다는 것'이란 단순히 아무것도 없다는 뜻이 아니다. 그 무엇도 우리에게 아무것도 제공하지 않는다는 의미다(고쿠분 고이치로).141 27 | - 어떤 삶이 옳은지 현대 사회에서는 아무도 알 수 없다.193 28 | - 시설에서는 돌봄을 받는 것이 일이다. 돌봄을 받는 것이 곧 멤버를 돌보는 셈이기 때문이다.221 29 | - 돌봄 시설에서 일하며 돌봄을 받는다는 것은 누군가의 마음 일부가 되는 것과 마찬가지였다 ... 어쨌든 엄연한 노동이었기 때문에 사람을 지치게 한다. 나군가의 마음 일부가 되는 것이니 내 마음도 피로할 수밖에 없다.222 30 | - 유지로 씨를 떠올리기만 해도 우리는 돌봄을 받을 수 있었다. ... 유지로 씨를 떠올림으로써 우리는 지금도 유지로 씨를 돌보고 있다.237 31 | - 이별을 느끼지 못하도록, 이별을 깨달았을 무렵에는 이미 멀리 떨어져 있게끔 도망쳤다.250 32 | - 돌봄은 상처 입히지 않는 것(욕구의 충족)이다, 치료는 상처와 마주 보는 것(욕구의 수정)이다.278-281 33 | - '있기' 위해서는 추궁당하지 않고, 상처 입지 않고, 마음을 놓을 수 있는 장소가 필요하다.295 34 | - 대체할 사람이 수없이 많기 때문에 '있기'는 도외시된다. 308 35 | - 돌봄을 받는 사람들의 '있기'는 깨지기 쉽고, 동시에 돌보는 사람들의 '있기'는 무시되기 쉽다.318 36 | - 시간을 들이자. 흘러가는 시간 속에서 주의 깊게 관찰하고 생각하길 멈추지 말자. ... 어떻게든 될 거야. ... 그러니 초조해하지 말자. 천천히 하자. 설마 죽지는 않을 테니까. 느긋이 시간을 들여서 나를 패자로 만든 것의 정체를 밝혀내고 미래를 고민하자. 그래, 나는 패배했다. 패했을 때는 괜히 몸부림치지 않아야 하는 법이다. 움직이지 말고 시간을 잘 활용하자. 우선 일상부터 착실히 살아가자. 두 다리로 시간을 힘껏 밟으며 나아가자. 그렇게 해야 다시 시작할 수 있다. 323 37 | - "그래도 괜찮을까?".327 38 | - 우리는 "그래도 괜찮을까?"라는 질문에 저항할 수 없다. 아니, 나아가 시장에서 살아가는 우리 스스로 "이래도 괜찮을까?"라고 자문해버린다. 그러면 결국 '가만히 있는 것'은 변질된다.355 39 | - 견디지 못하면 돌봄에서 허무주의가 싹을 튼다.339 40 | 41 | ###### 후기 42 | - 박사님이 쓴 이야기라서 공감하는 부분이 종종 있었다. 학위와 불안함에 대한 부분이 특히 그랬다. 43 | - 마지막이 이런 종류의 통찰로 끝날 줄은 몰랐다. 현대의 사회는 얼마나 교묘하고 복잡하게 얽혀 있단 말인가. 44 | -------------------------------------------------------------------------------- /book/the_circadian_code.md: -------------------------------------------------------------------------------- 1 | # (밤낮이 바뀐 현대인을 위한) 생체리듬의 과학 2 | 3 | > 최강의 몸을 만드는 생체시계 혁명! 수술, 치료, 운동, 업무, 수면, 약 백신 예방접종
4 | > \- 최적의 시간을 활용해 최상의 컨디션을 유지하는 법! 5 | 6 | 2020.03.09 ~ 2020.03.24 7 | 8 | 네이버 책 [생체리듬의 과학](https://book.naver.com/bookdb/book_detail.nhn?bid=16121330)
9 | 10 | 사친 판다SACHIN PANDA, 김수진 옮김 세종서적 11 | 12 | > "언제" 먹는가, "언제" 조명을 끄는가 13 | 해뜨면 일어나고, 해지면 자야해가 아닌 **체내 시계**에 대한 이야기 14 | 15 | #### 1부 고장 난 생체시계가 건강을 위협한다 16 | - "사회적 시차증" 불규칙한 근무로 인한 수면장애에 따른 피로감 17 | - 모든 신체기관이 빛에 영향받는 것은 아니다. 각각의 기관에는 고유한 시계가 있다. 특히 수면, 영양섭취, 활동이 주요 리듬이다. 18 | - 물론 기준이 되는 생체 시계도 있다: 시교차 상핵 SCN Suprachiasmatic nucleus 19 | - 신경 퇴행성 질환 eg알츠하이머 에서는 SCN도 퇴행하면 환자가 시간감각을 잃는다. 밤낮이 없어진다. 20 | - 하루 중에, **무엇을 해야 하는지** 보다 **언제 해야 하는지**를 중요하게 생각해보자. 21 | - 1부 마지막에 신체/정신건강과 행동 습성에 대한 그렇다/아니다 체크리스트가 있는데, 그렇다가 엄청 많아서 조금 슬퍼졌다... 그러나 그렇다가 많다는 것은 개선의 여지가 아주 많다는 말이기도 하다^^; 22 | 23 | 24 | #### 2부 생체주기에 맞는 생활방식 25 | 2부는 어찌보면 너무나 당연한 이야기들을 하고 있다. 26 | - 수면 27 | - 숙면을 위해 노력하고(일찍 잠들기, 빛 멀리하기, 스트레스 상황 줄이기, 수면 시간에 스트레스 받지 않기), 28 | - 잠에서 깨면 밝은 빛에 노출/ 같은 시간에 일어날 것을 제안한다. 29 | - 이 외에도 실질적인 해결책을 제안하고 있다. 개인적으로는 비염이 있어서 산소공급에 대한 내용을 흥미롭게 읽었다. 30 | - 또, 조금 다른 맥락이긴 하지만, 김승섭 교수님의 [2014년 콜센터 노동자 건강 연구 관련 페북 포스팅](https://www.facebook.com/photo.php?fbid=10158413981649459&set=a.10150099858909459&type=3&theater)이 생각났다... 31 | - 식사 32 | - "언제 먹느냐가 어떤 음식을 먹느냐보다 중요하다"는 말과 함께, 음식 섭취 시간을 8-12시간 안으로 제한할 것을 추천한다. 33 | - 이게 생각보다 쉽지 않다! 8시간으로 제한하면 오전 8시에 아침을 먹고, 오후 4시부터 식사를 하지 않아야 한다. 10시간 제한에 9-7이 그나마 실천 가능한 계획이다. 12시간 제한으로도 충분하다. 34 | - 또, 혈당을 낮출 것을 이야기한다. 35 | - 타이밍: 학습과 일의 효율 36 | - 주의력: 집중된 상태를 유지하여 아무런 방해를 받지 않고 과제를 완수하는 능력 37 | - 적응력: 다른 활동에 효과적으로 대처하기 위해 한 가지 활동에서 물러날 줄 아는 능력 38 | - 작업기억: 정보를 흡수하고 보유하여 이를 이미 습들한 정보에 연결하는 능력 39 | - 수행능률과 직접 연결, 반응시간과 긴밀하게 연관, 반응시간은 수면 부족과 연관 40 | - 단기기억 -(해마: 기억 강화)-> 장기기억 41 | - 집중력: 진행 중인 과제에 착수하고 진행하는 능력 42 | - 빛 43 | 44 | #### 3부 최적의 생체리듬을 만드는 방법 45 | 앞서 언급한 수면, 식사, 활동, 빛 네 가지와 소화 기능, 면역력, 뇌 기능을 연결지어 설명한다. 46 | - 생체리듬의 교란이 전신성 염증과 세균성 감염에 대한 민감성 증가에 영향을 미친다고 한다. 식중독 등으로 크게 아팠던 날은 늘 밤을 지새운 다음 날이었어서 납득이 갔다. 47 | - 뇌건강과 관련한 부분도 흥미롭게 봤는데 우울, 불안, 양극성장애, PTSD(외상후스트레스장애), OCD(강박장애)와 연관이 있다고 한다. 스스로의 우울, 불안을 위해서라도 식사 시간을 제한하고, 충분한 수면을 확보해야겠다. 48 | 49 | ###### 후기 50 | - 밤에 자고 아침에 일어나는 간단한 것이 힘들어서 읽기 시작한 책이다. 51 | - 다 알면서 못 하는 거구나, 하는 생각과 과학적으로 증명하고자 하는 노력들이 있구나 하는 생각을 했다. 52 | - 실천 가능하고 구체적인 예시를 많이 들어서 좋다! 그런데 myCircadianClock이라는, 저자가 연구할 때 만든 어플을 사용해도 좋다는 일종의 홍보(ㅋㅋ)가 나오는데 어플리케이션 별점은 영 좋지 못하다(ㅠㅠ) 53 | - 뇌 기능과 생산성을 위해서 수면 사이클을 우선 교정할 필요가 있다. 수면 사이클을 교정하기 위해 식이 사이클 역시 교정해야 한다. 딱 두 가지다! 식사시간의 제한, 양질의 수면 확보(를 위한 빛, 식이, 활동 타이밍 조절) 54 | 55 | -------------------------------------------------------------------------------- /computer_science/server/yum.md: -------------------------------------------------------------------------------- 1 | # Package Management YUM 2 | 3 | ## Yum 이 뭐냐면 4 | Yellow dog Updater여서 원래 YU 였는데 Modified가 붙어서 YUM 인가보다. 5 | 6 | CentOS의 기본 패키지 매니저다. 7 | - Yum Home page : http://yum.baseurl.org/ 8 | 9 | ## 기본 사용 10 | ``` 11 | $ yum -h # 도움말 12 | $ yum list installed # yum 으로 다운받은 패키지 목록 보기 13 | $ yum search 패키지이름 14 | ``` 15 | 16 | ## 왜 찾아봤쟈면 17 | centos에 python 설치할 건데... 설치 전에 yum update 하라구요... 18 | ``` 19 | $ sudo yum -y update 20 | $ sudo yum -y groupinstall "Development Tools" 21 | $ sudo yum -y install wget make gcc openssl-devel bzip2-devel libffi-devel 22 | ``` 23 | 상용 서비스가 돌아가는 서버라서 yum update 해도 되는지도 모르겠다구요(주륵) 24 | 25 | 26 | 그래서 일단 미리 해봤는데요... 27 | ``` 28 | $ sudo yum update 29 | [sudo] password for 사용자: 30 | Failed to set locale, defaulting to C 31 | Loaded plugins: fastestmirror 32 | Loading mirror speeds from cached hostfile 33 | Resolving Dependencies 34 | --> Running transaction check 35 | ---> Package 패키지명 구버전정보 will be updated 36 | ---> Package 패키지명 신버전정보 will be an update 37 | 38 | --> Finished Dependency Resolution 39 | 40 | Dependencies Resolved 41 | 42 | ================================================================================================================================================================ 43 | Package Arch Version Repository Size 44 | ================================================================================================================================================================ 45 | Installing: 46 | 패키지명 arch 버전(e.g.x86_64) 버전 정보 updates 사이즈 47 | Updating: 48 | 패키지명 arch 버전(e.g.x86_64) 버전 정보 base/updates 등 사이즈 49 | (중략) 50 | Transaction Summary 51 | ================================================================================================================================================================ 52 | Install 1 Package 53 | Upgrade 139 Packages 54 | ``` 55 | - 네. 지금은 아닌 것 같아요. 죄송합니다. ㅠㅠ 56 | 57 | 58 | ## 혹시 yum update 등을 했는데 롤백해야한다면... ? 59 | - `yum history` `yum history rollback 숫자(transaction ID)` 해주면 된다고 한다 60 | - http://yum.baseurl.org/wiki/YumHistory.html 61 | - http://nojinho.blogspot.com/2012/11/yum-history.html 참고 62 | - CentOS 5 이상, 패키지 따라 의존성 문제로 롤백 안되는 경우도 많고 63 | 64 | 65 | 66 | ## 이모저모 67 | - `yum list installed | grep python` 및 그 pre-requisites 를 확인하고 없는 것만 yum으로 설치해봐야겠다. 68 | -------------------------------------------------------------------------------- /computer_science/automata/automata.md: -------------------------------------------------------------------------------- 1 | 기본 개념 정리 2 | 3 | - States, Inputs, transitions 4 | - The set of strings accepted by an automaton A : the language of A, L(A) 5 | - Finite Automata and the languages they recognize 6 | - FAs are designed to : 7 | - *accept* some strings of symbols 8 | - *recognize* a language 9 | - FA is a machine covering all lengths (compared to circuits or decision trees) 10 | - Terminology& notations 11 | - Finite Alphabet of symbols 12 | - Word, length, empty string, concatenation 13 | - language L(A) : {w|w is accepted by a FA M} 14 | - FA consists of 15 | - Finite set of states 16 | - Finite set (alphabet) of input symbols 17 | - Lambda, the transition function 18 | - Start, Accepting state 19 | - Language L(A) 20 | - Is **regular** or **FA-recognizable** if it is recognized by some FA. 21 | - Operations on languages: operations used to construct languages (from other ones) 22 | - Set operations: union, intersection, complement, set difference 23 | - Operations for sets of strings: concatenation, star 24 | - Among the operations above, **concatenation**, **star**, and **union** I are called as *Regular operat*i*ons* 25 | - FA-recognizable languages are closed under all six(union, intersection, complement, set diff, concat, star) operations 26 | - Nondeterministic FAs 27 | - Add nondeterminism(allowing alternative computations on the same input string) to FAs to generalize 28 | - Add a guessing capability to FAs - How? 29 | - Allow δ(q, a) to specify more than one successor state 30 | - Add ε-transitions, transitions made for free , without consuming any input symbols 31 | : add ε to finite alphabet set 32 | - Languages NFAs recognizes: String w is *accepted* when there is at least one possible accepting end state 33 | - (Deterministic) FAs vs. Nondeterministic FAs 34 | - DFAs are special cases of NFAs 35 | - NFAs recognizes at least the DFA-recognizable (regular) languages; If M is an NFA then L(M) is DFA-recognizable 36 | 37 | (continue) 38 | - Regular Expressions 39 | 40 | 41 | 42 | #### Resources 43 | - Introduction to the Theory of Computation, 2nd / 3rd Ed., Sipser, PWS Publishing Co., 2006 / 2013. (S) 44 | - The Nature of Computation, Moore and Mertens, Oxford University Press, 2011. (M&M) 45 | - MIT 6.045 (Great Ideas in Theoretical Computer Science) by Prof. Lynch. 46 | - UCSD CSE105 (Intro. To Computability Theory) by Prof. Israeli. 47 | 48 | 이번 학기에 오토마타 조교를 하고 있는데 아무래도 기본기가 부족하다
49 | [Automata, languages, and grammars](http://www.nature-of-computation.org/supplements/automata-notes.pdf) by Christopher Moore 50 | -------------------------------------------------------------------------------- /computer_science/server/install_python3_on_centos7.md: -------------------------------------------------------------------------------- 1 | # 서버에 python3 설치하기 2 | 3 | 우선 OS를 확인해보자 4 | 5 | ``` 6 | $ cat /etc/system-release 7 | CentOS Linux release 7.x (Core) 8 | ``` 9 | 10 | 어디선가 `yum install python3`만 하면 된다고!! 헐!!
11 | ...은 내 yum은 python3 중에 3.6.8이 기본이네요... 소스에서 설치해야겠다...! 12 | 13 | 14 | ## Prerequisites 15 | ``` 16 | $ sudo yum -y install openssl-devel **bzip2-devel** 17 | 18 | $ sudo yum -y update 19 | $ sudo yum -y groupinstall "Development Tools" 20 | $ sudo yum -y install gcc openssl-devel bzip2-devel libffi-devel # 여러 곳에서 공통으로 명시한 패키지 21 | $ sudo yum -y install zlib-devel, xz-devel # 일부 레퍼런스에서 명시한 패키지 22 | 23 | $ sudo yum install wget make -y # 없으면 추가적으로 설치해야 하는 것 24 | ``` 25 | 제법 많은 블로그에서 말하는 pre-requisites인데, 저것들이 뭔지 알아야 말이지... 26 | (상용 서비스가 돌아가는 서버라서 마음대로 yum update 해도 되는지도 모르겠다구요 주륵) 27 | - [참고] [\[Linux\] 리눅스 -dev, -devel 패키지란?](https://mentha2.tistory.com/214) 28 | 29 | 30 | **(풀리지 않은 의문)conda로 설치했을 때는 저 prerequisite들이 어디에 어떻게 깔리는거지?** 31 | 32 | 확인 결과 서버에 python 3.7이 존재하는건 conda를 설치해서일 공산이 크지만 33 | 찾아본 내용이 아까우니 yum을 이용해서 소스코드로 python3 설치하는 내용은 마저 정리해둔다. 34 | 35 | 36 | 37 | ## 소스코드 다운로드 38 | 나는 3.7.6 버전 받을거니까... 39 | https://www.python.org/downloads/source/ 에서 원하는 버전의 40 | Gzipped source tarball의 마우스 오른쪽 버튼 누르고 Copy Link Address 해주자 41 | ``` 42 | $ wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz 43 | ``` 44 | 45 | ## 시스템 준비 46 | ``` 47 | $ sudo apt-get update 48 | $ sudo apt-get upgrade 49 | ``` 50 | - 이것도 해도 되냔 말이지! 이미 다운받아둔 것들이 업데이트 되는 건 아니지만... 51 | 52 | 다음으로 빌드 requirements 를 확인하는데, 우리는 위에서 이미 확인했으니 pass! 53 | - 위에 적은 내용은 CentOS 한정(yum으로 패키지 관리하는 경우)이고, apt를 기반으로 하는 경우는 아래 코드 스니펫 참고. 54 | ``` 55 | # For apt-based systems (like Debian, Ubuntu, and Mint) 56 | $ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ 57 | libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ 58 | libncurses5-dev libncursesw5-dev xz-utils tk-dev 59 | ``` 60 | 61 | ## 파이썬 빌드 62 | ``` 63 | # 다운받은 파일 압축 해제 및 페이지로 들어가기 64 | $ tar xvf Python-3.7.6.tgz 65 | $ cd Python-3.7.6 66 | 67 | $ ./configure --enable-optimizations (--with-ensurepip=install 옵션을 추가한 경우도 있다) 68 | $ make -j 8 # -j 8: compile 빠르게 하기 위해 병렬 빌드를 가능하게 하는 옵션 69 | $ sudo make altinstall 70 | 71 | # ln: 리눅스 파일시스템 상에서 링크 파일을 만들어준다. 72 | $ sudo ln -sfn /usr/local/bin/python3.7 /usr/bin/python3.7 73 | $ sudo ln -sfn /usr/local/bin/pip3.7 /usr/bin/pip3.7 74 | $ rm /usr/src/Python-3.7.6.tgz 75 | 76 | $ python3.7 --version # 최종 버전 확인 77 | ``` 78 | make -j 8을 진행하는데, 79 | 80 | ## Reference 81 | - [Python 3 Installation & Setup Guide by Real Python](https://realpython.com/installing-python/#how-to-build-python-from-source-code) 82 | - https://vinodpandey.com/how-to-install-python3-on-centos-7/ 83 | 84 | ## 이모저모 85 | - 각 옵션, pre-requisite 패키지에 대한 내용도 곧 정리해야지! 86 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch.md: -------------------------------------------------------------------------------- 1 | # Pytorch 2 | - 여러 언어로 만들어진 라이브러리. 사용자는 Python의 쉬운 UI와 C++의 빠른 속도 모두를 향유할 수 있다. 3 | - python API를 호출하면 C++이나 CUDA로 구현된 코드가 돌아갈 것! 4 | - 비율은 C++ 51.7% Python 31.9% Cuda 7.4% C 4.9% CMake 1.7% Objective-C++ 0.6% Other 1.8% 5 | - 참고로 Tensorflow의 경우 C++ 60.5% Python 30.5% HTML 3.6% Go 1.4% MLIR 1.3% Java 0.7% Other 2.0% 이다. 6 | - eager mode: immediate execution 7 | - direct access to the Python objects 8 | - exceptions can be raised directly 9 | 10 | - 가장 중요한 것 두 가지 11 | - Tensor라는 다차원 배열을 기본 자료구조로 가짐 12 | - ```torch.autograd``` 를 사용해 output의 derivative를 계산, tensor를 track할 수 있음 13 | 14 | ### 구성 15 | - 신경망을 구성할 때 사용하는 핵심 모듈들은 ```torch.nn``` 16 | - 데이터를 불러오고 다루는 것은 ```torch.util.data``` (그 중 ```Dataset```, ```DataLoader``` 클래스를 많이 보게 될 것) 17 | - 여러 대의 기기나 GPU를 사용한다면 ```torch.nn.DataParallel```, ```torch.distributed``` 18 | - 트레이닝을 마친 모델을 업데이트 할 때는 ```torch.optim``` 19 | 20 | ### TIL 목록 21 | - [nn.LSTM을 찾아서](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/pytorch_internals.md) 22 | - [PyTorch Datasets](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/pytorch_datasets.md) 23 | - [PyTorch loss function](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/pytorch_loss_func.md) 24 | - [Tensorboard in PyTorch](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/pytorch_tensorboard.md) 25 | - [TensorDataset and DataLoader](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/pytorch_dataloader.md) 26 | 27 | 28 | ### 관련 사이트 29 | - PyTorch [Get Started](https://pytorch.org/get-started/locally/) 30 | - PyTorch [Resources](https://pytorch.org/resources/) 31 | - 한국어 튜토리얼도 있다. [파이토치(PYTORCH) 튜토리얼](https://tutorials.pytorch.kr/) 32 | - [PyTorch Forum](https://discuss.pytorch.org/) 33 | 34 | ### Tutorials on GitHub 35 | - [Effective PyTorch](https://github.com/vahidk/EffectivePyTorch) 36 | - [Paperspace/PyTorch-101-Tutorial-Series](https://github.com/Paperspace/PyTorch-101-Tutorial-Series) 37 | - [keon/3-min-pytorch](https://github.com/keon/3-min-pytorch) 38 | - [victoresque/pytorch-template](https://github.com/victoresque/pytorch-template) 39 | - Python >= 3.5 (3.6 recommended), PyTorch >= 0.4 (1.2 recommended) 40 | - [GunhoChoi/PyTorch-FastCampus](https://github.com/GunhoChoi/PyTorch-FastCampus) 41 | - PyTorch로 시작하는 딥러닝 입문 CAMP (2017.7~2017.12) 강의자료 42 | - Python 3.6, pytorch 0.3.1 43 | - [jcjohnson/pytorch-examples](https://github.com/jcjohnson/pytorch-examples) 44 | - PyTorch 0.4 45 | ###### 참고자료 46 | - [DEEP LEARNING WITH PYTORCH](https://pytorch.org/deep-learning-with-pytorch) Chapter 1 47 | -------------------------------------------------------------------------------- /computer_science/machine_learning/deep_learning.md: -------------------------------------------------------------------------------- 1 | Contents for Ch1-5 of Deep Learning textbook at www.deeplearningbook.org 2 | 3 | 4 | #### Chapter1 Introduction 5 | 1.1 Who should read this book?
6 | 1.2 Historical Trends in Deep Learning
7 | 8 | #### Part1 Applied Math and Machine Learning Basics 9 | #### Chapter2 Linear Algebra 10 | 2.1 Scalars, Vectors, Matrices and Tensors
11 | 2.2 Multiplying Matrices and Vectors
12 | 2.3 Identity and Inverse Matrices
13 | 2.4 Linear Dependence and Span
14 | 2.5 Norms
15 | 2.6 Special Kinds of Matrices and Vectors
16 | 2.7 Eigendecomposition
17 | 2.8 Singular Value Decomposition
18 | 2.9 The Moore-Penrose Pseudoinverse
19 | 2.10 The Trace Operator
20 | 2.11 The Determinant
21 | 2.12 Example: Principal components Analysis
22 | 23 | #### Chapter3 Probability and Information Theory 24 | 3.1 Why Probability?
25 | 3.2 Random Variables
26 | 3.3 Probability Distributions
27 | - discrete variables and pmf 28 | - continuous variable and pdf 29 | 30 | 3.4 Marginal Probability
31 | 3.5 Conditional Probability
32 | 3.6 The Chain Rule of Conditional Probabilities
33 | 3.7 Independence and Conditional Independence
34 | 3.8 Expectation, Variance and Covariance
35 | 3.9 Common Probability Distributions
36 | - Bernoulli Distribution 37 | - Multinoulli Distribution 38 | - Gaussian Distirbution 39 | - Exponential Distirbution 40 | - Laplace Distirbution 41 | - Dirac Distirbution and Empirical Distirbution 42 | - Mixtures of Distirbutions 43 | 44 | 3.10 Useful Properties of Commom Functions
45 | 3.11 Bayes' Rule
46 | 3.12 Technical Details of Continuous Variables
47 | 3.13 Information Theory
48 | - KL Divergence 49 | 50 | 3.14 Structured Probabilistic Models
51 | 52 | #### Chapter 4 Numerical Computation 53 | 4.1 Overflow and Underflow
54 | 4.2 Poor Conditioning
55 | 4.3 Gradient-Based Optimization
56 | - Jacobian and Hessian Matrices 57 | 58 | 4.4 Constrained Optimization
59 | 4.5 Example: Linear Least Squares
60 | 61 | #### Chapter 5 Machine Learning Basics 62 | 5.1 Learning Algorithms
63 | - Task, Performance measure, Experience 64 | 65 | 5.2 Capacity, Overfitting and Underfitting
66 | 5.3 Hyperparameters and Validation sets
67 | 5.4 Estimators, Bias and Variance
68 | 5.5 Maximum Likelihood Estimation
69 | 5.6 Bayesian Statistics
70 | 5.7 Supervised Learning Algorithm
71 | - Probabilistic Supervised Learning 72 | - Support Vector machines 73 | 74 | 5.8 Unsupervised Learning Algorithms
75 | - Principal Component Analysis 76 | - K-means clustering 77 | 78 | 5.9 Stochastic Gradient Descent
79 | 5.10 Building a Machine Learning Algorithm
80 | 5.11 Challenge Motivating Deep Learning
81 | - The curse of Dimensionality 82 | - Local Constancy and Smoothness Regularization 83 | - Manifold learning 84 | 85 | -------------------------------------------------------------------------------- /computer_science/machine_learning/hyperparamer.md: -------------------------------------------------------------------------------- 1 | # Hyperparameters 2 | 3 | > Seq2Seq의 경우 영향을 가장 많이 미치는 하이퍼파라미터는
4 | ```batch_size```, ```optimizer_type```, ```learning_rate```, ```num_layers_encoder```, ```num_layers_decoder``` 5 | 6 | 이름에 통일성이 있어야 할 것 같아서 공통으로 많이 쓰는 파라미터들을 표로 정리해본다. 7 | (이 때 많이 쓰는 초기값의 기준은 Amazon SageMaker에서 따왔다.) 8 | 9 | | 이름 | 설명 | 초기값 | 10 | |---|---|:---:| 11 | | batch_size | 경사 하강에 대한 미니 배치 크기 | 64 | 12 | | checkpoint_frequency_num_batches | x회의 배치마다 체크포인트 및 검증 | 1000 | 13 | | clip_gradient | 경사 하강 최솟값 고정 (음수일 경우 비활성화)| 1 | 14 | | cnn_activation_type | 사용할 cnn 활성화 유형: glu, relu, softrelu, sigmoid, tanh | glu | 15 | | cnn_hidden_dropout | 컨볼루션 계층 사이의 dropout 정도 | 0 [0, 1]| 16 | | cnn_kernel_width_decoder | cnn 디코더에 대한 커널 너비 | 5 | 17 | | cnn_kernel_width_encoder | cnn 인코더에 대한 커널 너비 | 3 | 18 | | cnn_num_hidden | 인코더 및 디코더에 대한 cnn 숨겨진 유닛 수 | 512| 19 | | decoder_type | 디코더 유형: rnn 또는 cnn | rnn | 20 | | embed_dropout_source | source 임베딩에 대한 dropout 정도 | 0 | 21 | | embed_dropout_target | target 임베딩에 대한 dropout 정도 | 0 | 22 | | learning_rate | 초기 학습률 | 0.0003 | 23 | | loss_type | training에 대한 loss function : cross-entropy | cross-entropy | 24 | | max_num_batches | 처리할 업데이트/배치의 최대 수, -1일 때 무제한 | -1 | 25 | | max_num_epochs | training 데이터 epoch의 최대 수( < max_num_epochs ) | none | 26 | | max_seq_len_source | 소스 시퀀스의 최대 길이(더 긴 시퀀스는 길이에 맞게 cut | 100 | 27 | | min_num_epochs | early_stopping 사용 전의 최소 training epoch 수 | 0 | 28 | | momentum | sgd 모멘텀 상수(adam/rmsprop 사용 시 none) | none | 29 | | num_embed_source | source token의 임베딩 size | 512 | 30 | | num_layers_decoder | 디코더 rnn 또는 cnn 의 layer 수 | 1 | 31 | | optimized_metric | 최적화에 사용하는 지표: perplexity, accuracy, bleu | perplexity | 32 | | optimizer_type | adam, sgd, rmsprop | adam | 33 | | rnn_attention_in_upper_layers | 2개 이상 layer일 때 rnn 상위 계층으로 attention 전달 여부 | true | 34 | | rnn_attention_num_hidden | attention layer의 hidden unit 수 | rnn_num_hidden | 35 | | rnn_attention_type | 인코더의 어텐션 모델: dot, fixed, mlp, bilinear | mlp | 36 | | rnn_cell_type | 특정 유형의 rnn 아키텍처: lstm, gru | lstm | 37 | | rnn_decoder_state_init | last, avg, zero | last | 38 | | rnn_first_residual_layer | 첫 번째 rnn residual layer(num_layers_decoder>=2 일 때만) | 2 | 39 | | rnn_num_hidden | 인코더 및 디코더 rnn의 hidden unit 수(2의 배수 because of Bidirectional LSTM) | 1024 | 40 | | rnn_residual_connections | rnn 의 residual connection 여부 | false | 41 | | rnn_decoder_hidden_dropout | context- decoder rnn hidden state 사이의 dropout rate | 0 | 42 | | training_metric | validation data의 평가: perplexity, accuracy | perplexity | 43 | | weight_decay | weight decay 상수 | 0 | 44 | | weight_init_scale | 가중치 초기화 scale(uniform, xavier) | 2.34 | 45 | | weight_init_type | 가중치 초기화 유형: uniform, xavier | xavier | 46 | 47 | ###### references 48 | 뭔가 convention이 있을 것 같아서 찾아봤다. 49 | - https://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/seq-2-seq-hyperparameters.html 50 | - 더 다양한 모델에 해당하는 내용은 [Amazon SageMaker - 개발자 안내서](https://docs.aws.amazon.com/ko_kr/sagemaker/latest/dg/sagemaker-dg.pdf) 51 | -------------------------------------------------------------------------------- /computer_science/machine_learning/kernel.md: -------------------------------------------------------------------------------- 1 | ## Kernel 2 | 3 | > 머신러닝 공부를 하다 보면 필연적으로 kernel이라는 단어를 마주치게 된다. 4 | 아마 SVM(support Vector Machine)에 대한 고찰을 하다 마주칠 가능성이 높고, 5 | 언젠가는 Gaussian Kernel, RBF(Radial Basis Function) Kernel 따위를 마주쳤을지도 모르겠다. 6 | 나 역시 Kernel의 마수에서 자유롭지 못했고, 이 토막글은 무려 작년(2018)부터 제대로 알지 못하면서 넘어가곤 했던 __```kernel이란 무엇인가```__ ~~[추석이란 무엇인가](http://news.khan.co.kr/kh_news/khan_art_view.html?art_id=201809211922005)~~ 숙원사업의 해결 과정이다. 7 | 8 |
9 | 10 | #### 들어가기 전에: Support Vector Machine 11 | Kernel에 대한 이야기를 시작하기 전에, SVM(Support Vector Machine)에 대한 이야기를 하지 않을 수 없다.
12 | 1. SVM은 지도 학습(supervised learning) 모델이다. 13 | 2. SVM은 공간이 있을 때 구분하는 hyperplane으로 정의되는 구분자(classifier)다. 14 | 1. 이 때, 2차원 공간의 hyperplane은 1차원의 직선이다. 15 | 2. 그러나 이러한 선형의 분류자로 data를 구분할 수 없는 경우가 많다. 현실 속 데이터들은 무작위의 분포를 가지고 있기 때문이다. 16 | 17 | 18 | #### Kernel에 대한 일반적인 사실 19 | 1. ```kernel method```라 함은 패턴 분석에 쓰이는 알고리즘의 집합이다. 20 | 1. 각 알고리즘의 이름은 각각의 알고리즘이 사용하는 kernel function의 이름에 따라 달라진다. 21 | 1. kernel function의 종류: linear, nonlinear, polynomial, Gaussian kernel, Radial basis function(RBF), sigmoid etc.
22 | ( 각 function의 예시가 [Kernel Functions-Introduction to SVM Kernel & Examples](https://data-flair.training/blogs/svm-kernel-functions/) 에 잘 정리되어 있다. ) 23 | 2. ```kernel method``` 의 예: kernel perceptron, SVM(support vector machine), Gaussian processes, PCA(Principal Components analysis) 등 24 | 2. ```kernel trick```이라 함은 원본 데이터를 다른 차원의 데이터로 변환하는 것인데, 이 때 다른 차원의 데이터에는 클래스 간의 명백한 구분이 존재한다. 25 | 1. 이 때 explicit mapping을 피하는 것이 핵심인 듯 하다. 이 말을 떠올리게 된다. "Machine Learning is the field of study that gives computers the ability to learn without being explicitly programmed" (Arthur Samuel, 1959) 26 | 2. ```kernel trick```을 다른 말로 설명하자면, 비선형 문제를 선형 분류자를 통해 풀어내는 것이다. 그리고 이 때 기존의 비선형 문제를 선형으로 분류 가능한, (주로) 고차원의 데이터로 변환할 때 사용되는 함수를 ```kernel function```이라고 부르자. 27 | 3. 수학에서 쓰이는 ```kernel``` 이라는 말은 weighted sum 혹은 적분을 할 때의 weighting function을 칭한다. 28 | 4. 유사한 정도를 정의하는 것과 관련이 있다. kernel을 설명할 때 '*defining a notion of similarity* ' 와 비슷한 문구를 사용함을 확인할 수 있다. 29 | 5. SVM과 함께 자주 사용되는 kernel의 예로는 Polynomial, Gaussian, Gaussian RBF, Laplace PBF, Hyperbolic tangent, Sigmoid kernel 이 있다. 30 | 31 | 32 |
33 | 34 | ###### 도움을 받은 곳들 35 | - Wikipedia [Kernel Method](https://en.wikipedia.org/wiki/Kernel_method) 36 | - dataFlair [Kernel Functions-Introduction to SVM Kernel & Examples](https://data-flair.training/blogs/svm-kernel-functions/) 37 | - Medium Post [Kernel Functions](https://towardsdatascience.com/kernel-function-6f1d2be6091) 38 | - [What are kernels in machine learning and SVM and why do we need them?](https://www.quora.com/What-are-kernels-in-machine-learning-and-SVM-and-why-do-we-need-them/answer/Lili-Jiang?srid=oOgT) 39 | - Caltech on Youtube [Lecture 14 - Support Vector Machines](https://youtu.be/eHsErlPJWUU) 40 | - Caltech on Youtube [Lecture 15 - Kernel Methods](https://youtu.be/XUj5JbQihlU) 41 | - 책 (Adaptive Computation and Machine Learning series) Ethem Alpaydin-Introduction to Machine Learning-The MIT Press (2009) 42 | -------------------------------------------------------------------------------- /computer_science/math/mathematical_statistics.md: -------------------------------------------------------------------------------- 1 | 2019-2학기 고급수리통계학에서 다룬 내용들의 목차
2 | 어디까지 알고 어디서부터 모르고 있는지 확인해보기 위한 지표 3 | 4 | ## 1. Probability Theory 5 | 1. Set theory 6 | 2. Basics of Probability theory 7 | 3. Conditional Probability and Independence 8 | 4. Random Variables(R.V.) 9 | 5. Distribution Functions 10 | 6. Density and Mass functions 11 | 12 | ## 2. Transformations and Expectations 13 | 1. Distributions of Functions of a R.V. 14 | 2. Expected Values 15 | 3. Moments and Moment Generating Functions 16 | 4. Differentiation under an Integral Sign 17 | 18 | ## 3. Common Families of Distributions (D.) 19 | 1. Discrete Distributions 20 | - Discrete Uniform D. 21 | - Binomial D. 22 | - Negative Binomial D. 23 | - Poission D. (approximation of Binomial D.) 24 | 2. Continuous Distributions 25 | - - - 26 | 3. Exponential Families 27 | 4. Location and Scale Families 28 | 5. Inequalities and Identities 29 | 30 | ## 4. Multiple Random Variables 31 | ## 5. Properties of a Random Sample 32 | 33 | ## 6. Principles of Data Reduction 34 | 1. The Sufficiency Principle 35 | - Factorization Theorem 36 | - sufficient/ ancillary statistic 37 | 2. The Likelihood Principle 38 | - likelihood function 39 | 3. The Equivariance Principle 40 | 41 | ## 7. Point Estimation 42 | 1. Introduction : point estimators 43 | 2. Methods of Finding Estimators 44 | - Method of Moments 45 | - Maximum Likelihood Estimators 46 | - Bayes Estimators 47 | 3. Methods of Evaluating Estimators 48 | - Mean Squared Error 49 | - Best Unbiased Estimators 50 | 51 | ## 8. Hypothesis Testing 52 | 1. Introduction : null/ alternative hypothesis 53 | 2. Methods of Finding Tests 54 | - Likelihood Ratio Tests 55 | - Bayesian Tests 56 | - Union-Intersection and Intersection-Union Tests 57 | 3. Methods of Evaluating Tests 58 | - Error Probabilities and the Power Function 59 | - Most Powerful Tests 60 | - p-values 61 | 62 | ## 9. Interval Estimation 63 | 1. Introduction: interval estimator, coverage probability, confidence coefficient 64 | 2. Methods of Finding Interval Estimators 65 | - Inverting a test statistic: every confidence set corresponds to a test and vice versa. 66 | - Pivotal Quantities: Pivoting the CDF 67 | 3. Methods of Evaluating Interval Estimators 68 | - Size and Coverage Probability, Test-Related Optimality 69 | 70 | ## 10. Linear Regression 71 | 1. Linear Regression Model 72 | 2. Partitioned regression and partial regression 73 | 3. Goodness-of-fit measures 74 | - R^2, Theil's (R_bar)^2 (adjusted R^2), Information criteria 75 | 4. Unbiasedness 76 | 5. The variance of the LSE and the Gauss-Markov theorem 77 | - - - 78 | 6. Estimating the variance of the least squares estimator 79 | 7. Inference under a normality assumption 80 | - small sample distribution of b, t-test, F-test 81 | -------------------------------------------------------------------------------- /computer_science/algorithm/README.md: -------------------------------------------------------------------------------- 1 | 알고리즘 관련 지식을 정리합니다 2 | 3 | 4 | ###### 관련도서 5 | - 누워서 읽는 알고리즘, 임백준, 한빛미디어 6 | - [알고리즘 도감](http://www.yes24.com/Product/Goods/58290453), 이시다 모리테루/미야자키 쇼이치, 제이펍 7 | 8 | 9 | # 알고리즘 이모저모 10 | - 코딩 이전에 배워야 할, 기본이 되는 지식/ 알고리즘을 잘 이해하고 있다면 어떤 언어를 사용하든 금방 원하는 기능을 구현할 수 있게 된다. 11 | - 상황에 따른 최적의 알고리즘(실행 시간/메모리 소비량 등을 고려)과 데이터 구조를 선택할 수 있는 능력 12 | - Further studies: 효율이 좋은 알고리즘을 찾지 못하는 문제, 알고리즘으로 해결할 수 없는 문제 13 | 14 | # 데이터 구조 15 | 16 | 데이터를 메모리에 저장할 때의 순서나 위치 관계. Index순? 가나다순? 17 | 18 | - [ ] 리스트 19 | - Linked list in C (다음 데이터의 메모리 위치를 가리키는 pointer) —> 이것 python으로 구현해봐야겠다. 20 | - 일반적으로 sparse한 특성, search/ add/ delete 등 기능 구현, circular list/ bidirectional list 등 소개 21 | - [ ] 배열 22 | - Python list에 index 개념을 추가하면, C의 그것과 엇비슷한 설명 가능. 23 | - [ ] 스택 24 | - Last In First Out, 데이터 추가/삭제가 단방향으로만 가능하다. Push-Pop 25 | - 예) 문자열의 괄호 대응 관계, 깊이 우선 탐색 26 | - [ ] 큐 27 | - First In First Out, 데이터 추가/삭제가 단방향으로만 가능하다. Enqueue-Dequeue 28 | - 예) 너비 우선 탐색 29 | - [ ] 해시테이블: 주로 보안 관련 알고리즘에서 많이 쓰이므로 이번 기회에는 pass. 배열 내의 특정 데이터에 빠르게 접근할 수 있다. 30 | - [ ] 힙 31 | - 그래프의 트리 구조 중 하나: 우선순위 큐의 구현. 언제나 complete binary tree이다. 32 | - 추가는 자유롭되 추출할 때는 작은 값부터 꺼낸다; 최솟값을 자주 추출해야 하는 경우에 용이. 자식 노드의 숫자가 반드시 부모의 숫자보다 크다. 33 | - [ ] 이진탐색트리 34 | - 현재 노드의 값은 그 왼쪽 가지의 어떤 값보다 크다. 마찬가지로, 그 오른쪽 가지의 어떤 값보다 작다. 35 | - 위 규칙에 따라 노드를 추가한다. 삭제할 때는 대상 노드를 삭제하고 왼쪽 가지에서 최대 노드를 찾아서 이동한다. 36 | - 트리의 높이/깊이/단계만큼 비교하므로 균형 잡힌 트리의 경우 logN회 비교로 이동 가능하다. 트리가 한 쪽으로 치우친 경우 worst O(n)이 될 수도 있다. 37 | 38 | # Sort 39 | 40 | - [ ] Bubble/Selection/ Insertion/ Merge/ Quick Sort 41 | - [ ] Heap Sort 42 | 43 | # Search 44 | 45 | - [ ] Linear search 46 | - [ ] Binary Search 47 | 48 | # Graph 49 | 50 | 정점(Vertex), 간선(Edge) / 가중치(weight) / 방향(direction) 51 | 52 | Facebook mutual friends/ 지하철 노선도(with 소요 시간/운임 등)/ 네트워크 라우터 접속 관계 53 | 54 | **그래프 탐색** 55 | 56 | - [ ] BFS 57 | - 후보 추가(큐 사용하여 후보 관리) - 제일 먼저 추가한 후보로 이동 - 탐색 마친 것은 visited 처리 후, 도달할 수 있는 후보 추가 - 제일 먼저 추가한 후보로 이동 - 반복 58 | - [ ] DFS 59 | - 후보 추가(스택 사용하여 후보 관리) - 제일 최근에 추가한 후보로 이동 - 탐색 마친 것은 visited 처리 후, 도달할 수 있는 후보 추가 - 제일 최근에 추가한 후보로 이동 - 반복 60 | 61 | **최단 경로 문제: 가중치 그래프, 시작점/종점이 주어진다.** 62 | 63 | - [ ] Bellman-Ford 64 | - 시작점(초기값은 0)에서 간선을 따라가며 다른 정점의 값(초기값은 무한대)을 바꿔나간다. 한 번에 한 정점씩 값을 계산하고 이동한다. 전체 작업이 끝난 시점에는 다른 정점의 값이 바뀌어 있기 때문에 값을 업데이트 하는 전체 작업을 반복 수행한다. 더 변화가 없으면 멈추고 최단 경로를 확인한다. 65 | - [ ] Dijkstra 66 | - 벨만 포드와 비슷하나 다익스트라의 경우 최단 경로를 정해 나가며 그래프를 탐색한다. 현재 경로에서 이동할 수 있는 정점을 후보로 추가하고, 후보 정점의 값을 바꾸고, 가장 작은 값을 가지는 정점으로 이동한다. 67 | - 방향성 그래프의 경우 마이너스 가중치를 포함하는 경우에 올바른 최단 경로를 확인하기 어렵다. 68 | - [ ] A* : 그래프의 최간 경로를 찾는다. 이 때 시작점에서 각 정점까지의 최단 경로(다익스트라) 뿐만 아니라 현시점에서 목표까지의 추정 가중치(heuristic weight: 사전 정보를 가지고 최적의 추적 가중치를 사람이 미리 설정한다.)도 함께 고려한다. 69 | 70 | # Clustering 71 | 72 | - ‘비슷한 것’을 묶는 알고리즘: 두 개의 데이터 사이의 거리를 정의한다. / 몇 개의 묶음으로 묶을 것인가? 73 | - [ ] K-means 알고리즘 74 | 75 | # 기타 알고리즘 76 | 77 | - [ ] 유클리드: 두 수의 최대공약수를 구하는 알고리즘; mod가 0이 될 때까지! 78 | - [ ] 소수 판별법: 79 | - 어떤 수가 주어질 때 그 제곱근까지의 모든 숫자를 차례대로 mod 연산한다. 80 | - 페르마 테스트: ‘어떤 수가 소수일 가능서이 높은지’를 판별. 어떤 소수 p가 주어질 때, p보다 작은 수를 각각 p제곱하여 그 숫자를 mod p한다. 소수일 경우 n^p mod p = n 이 성립한다. 그러나 이 식을 만족하는 합성수가 존재하기 대문에 이를 확률적 소수 판별법이라고 한다. 81 | - [ ] 페이지 랭크 82 | - [ ] 하노이의 탑: **재귀** 83 | -------------------------------------------------------------------------------- /book/addiction_procrastination_and_laziness.md: -------------------------------------------------------------------------------- 1 | # 정말 하고 싶은데 너무 하기 싫어 2 | 3 | > 몸은 '해야 한다'는 말에 반응하지 않는다! 4 | 5 | 2019.12.27 - 2020.01.02 6 | 7 | 네이버 책 [정말 하고 싶은데 **너무 하기 싫어**](https://book.naver.com/bookdb/book_detail.nhn?bid=14457868)
8 | (원제: 중독, 미루기, 게으름 ADDICTION, PROCRASTINATION, AND LAZINESS) 9 | 10 | 로먼 겔페린 지음, 황금진 옮김 11 | 동양북스 12 | 13 | 14 | 이 책을 읽는 내 마음이 딱 그랬다. ```정말 읽고 싶은데 읽기 싫어...```.
15 | 한손에 들어오는 작은 크기의, 그다지 두껍지도 않은, 심지어 제목이 상당히 구미가 당기는 책인데 왜 책장이 넘어가지 않지? 16 | 그 답을 찾을수 있을지 없을지 알기 위해서는 일단 이 책을 읽어야 했다. 17 | 18 | 간단히 정리하면 이 책은 **동기부여**에 대한 책이라고 할 수 있고, 몇 가지 기억에 남는 것을 정리해본다. 19 | 20 | - 행동 21 | - 행동의 시작? 22 | - 어떤 일을 하는데는 일종의 진입 장벽이 있고, 이것을 뛰어넘기 위한 '시동 에너지'가 필요하다. 23 | - 진입 장벽은 곧 시작할 때의 어려움이고, *일의 난이도에 비례하는 노력에 대한 두려움* 이라고도 말하고 있다. 24 | - 행동과 행동의 결과를 구분하자. 25 | - 잠을 자는 것은 행동이고, 건강한 몸은 행동의 결과이다. 26 | - 쿠키런을 그만하는 것은 행동이고, 다른 생산적인 일을 하는 것은 행동의 결과이다. 27 | - 어떤 일을 하는 것은 다른 행동을 멈추는 것이다. 28 | - 따라서 미래 활동의 시작, 행동, 결과 뿐만 아니라 현재의 활동, *현재 활동을 그만둘 때의 결과*도 생각해보자.
29 | : 현재 사용하고 있는 주의력의 양과 쾌락의 양을 측정해보자. 30 | 31 | - 불안감 32 | - 어떤 행동을 하게 만드는 것 중 하나는 결과에 대한 강한 불안감이다. 33 | - 미래에 대한 시나리오를 온전히 상상할 수 없는 상황에서 (과거 데이터 불충분) 위험까지 예상될 때 느끼는 감정 34 | - 일어나지 않은 일에 대하여, 정신은 정보가 없거나 적은 일까지도 무의식적으로 재현하려고 한다. 35 | - 데이터가 불충분하므로, 유사 경험을 대입해보려 하지만 재현의 정확도는 형편없다. 36 | - 심지어는 부정확한 재현에 대한 불안감이 더해질수도... 37 | 38 | - 주의력 39 | - 주어진 주의력을 전부 소진하려는 욕구: 주의력을 전부 활용하지 못하면 불쾌감을 느끼며, 남는 주의력을 쓰려고 한다. 40 | - 정신력이라는건 보통 '주의력을 어디에 쏟을지 제어하는 능력'을 일컫는다. 41 | - 생활에 영향을 미치는 부분은... 42 | - 가지고 있는 주의력을 어떻게 나눠 사용할 것인가? 43 | - 인간은 어디에 주의력을 얼마나 나눠 쓸 지 결정할 수 있다. 주의력을 쏟으면 해당 감각이 생생해진다. 44 | - 노래를 들으면서 공부를 할 때 무슨 노래들이 흘러갔는지 모르는 순간들을 예로 들 수 있겠다. 45 | - 전체 주의력의 양 46 | - 피로도, 소화 상태, 혈당 등의 이유로 변한다. 47 | - 주의력이 줄어드는 순간 (산만해지는 순간) 48 | - 일을 처리하는 과정에서의 방해물. 49 | - 다음에 어떤 과정을 밟아야 하는지, 그 단계로 라는게 맞는지 평가하는 능력
50 | --> if not, 의심/ 두려움/ 불안 --> 즐겁지 않음 51 | 52 | - 쾌락 혹은 불쾌 53 | - 동기부여에의 영향 관점에서 쾌락의 증가 < 불쾌의 감소 : 불쾌를 감소하는 방향으로 움직이는 경우가 더 잦다. 54 | - BUT 조절 방법의 측면에서 쾌락의 증가 > 불쾌의 감소 : 쾌락을 조절할 수 있는 방법이 더 많다. 55 | - 쾌락에 대한 욕구가 충족된 다음에 자신의 주의력을 자유자재로 통제할 수 있다. 56 | - 그러나 행동을 전환하는 것은 부정적 감정만으로는 부족하고, 동기부여가 더 필요하다. 57 | - 자기합리화는 ```쾌락적인 일은 이롭고 불쾌한 일은 이롭지 않다```는 결론을 내리는 것, 결론을 미리 내려놓고 고수하는 것이 중요하겠다. 58 | - 강한 쾌감을 경험한 후에는 더 큰 쾌감을 찾고 싶은게 인지상정 59 | - 따라서 저자는 최대한 중립적 쾌락 상태인 아침 시간을 가장 생산적인 시간으로 꼽는다. 60 | - 아침에 일어나자마자 핸드폰 게임을 하는건 좋은 생각은 아니긴 하다... 61 | - 누군가는 공부를 하기 위해서 일어나서 뉴스나 책도 보지 않고, 바로 연구를 했다고 그랬는데 맞는 말이다.. 62 | 63 | - 변화 64 | - 변화가 필요한 부분이 무엇인지 평소(상황에서 한 발짝 떨어져 있을 때)에 생각할 필요가 있다. 65 | - 상황 속에서는 당장 큰 노력을 쏟기가 어렵다. 66 | - 변화의 방향은 개선을 위한 것이므로 하고 싶은 일/해야 하는 일을 더 유쾌한, 쉬운 일로 만들어야 한다. (일부러 불편하게 만들지 말라는 것!) 67 | - 몸이 말을 듣지 않는다면 상상을 해보는 것도 좋다. 68 | - 이건 개인상담 할 때도 제안받았던 내용이다! 코드가 안 짜질 때 잠시 숨을 돌리면서 파워코딩하는 나를 상상하기...! 잘 하고 있는 나를 상상 69 | - 이 책에서는 좀 더 구체적인 상상을 요구한다. 손가락 끝의 감각이라든지, 꼬고 있는 다리라든지, 잠시 멈추고 눈을 굴리는 순간이라든지 70 | - 일을 순서를 정해서 만만한 단위로 쪼개고, 일을 해내지 못할 것 같은 두려움과 불안감을 줄일 필요가 있다. 71 | 72 | 73 | ###### 책 자체에 대한 이야기 74 | - 책이 한 손에 들어오는 점에서 부담감을 덜기 좋았다. 행동의 시작으로는 굉장히 빨리 이어진다. 75 | - 픽토그램이 굉장히 난해하다고 느꼈다. 방해물로 여겨졌고, 픽토그램이 나올 때마다 주의력이 줄어드는게 느껴지는 기분... 76 | - 글 자체도 잘 읽히는 편은 아니라고 느꼈다. 주석이 엄청나게 많은데, 뒤쪽에 몰아두어서 흐름이 자주 끊기고 불필요한 내용인 경우도 종종 있다. 77 | - 그러나 일상 생활에 적용해볼 거리들이 굉장히 많고 응용하는데 부담이 적다는 점에서 긍정적이다. 78 | - 1\) 하고싶은 일을 하지 못하거나 2) 하고 싶지 않은 일을 그만두지 못하거나의 두 가지 중 하나라도 해당하면 읽어볼만 하다고 생각한다. 79 | -------------------------------------------------------------------------------- /computer_science/machine_learning/svr.md: -------------------------------------------------------------------------------- 1 | # Support Vector Regression 2 | 3 | 4 | 일단 regression은 output space가 continuous한 것을 일컫는다(classification은 discrete output space를 가진다). 5 | linear regression은 output을 input의 선형함수로 표현하는 것을 말한다. 6 | 7 | 또하나 익숙할만한 것이 Support Vector Machine(이하SVM)인데, linear classifier의 일종이다. 8 | 무슨 말이냐면, linear하게 구분지을 수 있는 데이터가 있을 때 decision boundary를 정하고 margin(구분지은 데이터 군과 decision boundary가 떨어져 있는 정도)을 최대화 하는 방법이라는 것! 9 | 10 | 11 | [Kernel](https://github.com/codingbowoo/codingbowoo-resource/blob/master/computer_science/machine_learning/kernel.md) 문서에 간단히 정리했던 바 있다. 12 | 13 | 14 | SVR은 임의의 실수값을 예측할 수 있도록 SVM의 회귀 모형에 epsilon-insensitive loss function을 도입해 회귀문제를 해결할 수 있도록 한다. 15 | input이 고차원의 feature space에 map, output value와 연관 선형함수 찾는다. 16 | 아래 논문을 확인해보자. 17 | 18 | - Parsons, Simon. "Introduction to Machine Learning by Ethem Alpaydin, MIT Press, 0-262-01211-1, 400 pp., $50.00/£ 32.95." The Knowledge Engineering Review 20, no. 4 (2005): 432-433. 19 | 20 | 21 | > 으악 22 | 23 | 24 | 25 | SVM에는 몇가지 매개변수가 있는데, 선형 SVM의 C, RBF 커널 SVM의 C와 gamma가 그것이다. 26 | - linear SVM의 겨우 데이터를 완벽한 선형으로 분리하는 것은 불가능하다 --> 일부 데이터 샘플이 다른 클래스에 있어도 허용하자! (이상치 허용 정도) : **cost C** 27 | - 너무 작은 C(많이 놓쳐도 괜찮아) : underfitting 가능성 28 | - 너무 큰 C(large C 놓치기만 해봐!) : overfitting 가능성 29 | 30 | - RBF 커널 SVM의 경우 gamma : 하나의 데이터 샘플이 영향을 미치는 거리 (결정 경계의 곡률) 31 | - 가우시안 표준편차와 관련: gamma가 크면 작은 표준편차를 가진다 --> 데이터 포인터들이 영향 미치는 거리가 짧아진다. 32 | - gamma가 작으면 underfitting, 너무 크면 overfitting 위험 있다. 33 | 34 | 35 | ## 구현 36 | scikit-learn 패키지에 SVR로 구현되어있다. 37 | SVR에서 가장 중요한 파라미터는 커널함수로, Linear, Polynomial, Gaussian RBF를 모두 적용할 수 있다. 38 | 세 종류를 모두 적용해보고 그 중 가장 우수한 성과를 보이는 모형을 최종 선택해도 되겠다. 39 | 40 | 41 | ```python3 42 | from sklearn.svm import SVR 43 | 44 | """ 45 | # To ignore SVR warning 46 | import warnings 47 | warnings.filterwarnings('ignore', 'Solver terminated early*') 48 | 49 | # Often-used parameter values 50 | std = [1, 25, 50, 75, 100] 51 | C = [1, 10, 33, 55, 78, 100] 52 | eps = [0.05, 0.1, 0.5] 53 | """ 54 | 55 | X, y = (SVR의 경우 training data X, y를 필요로 한다. 각자의 data 가공에 맞게...) 56 | 57 | # Fit regression model 58 | svr_lin = SVR(kernel='linear', C=100, gamma='auto') 59 | svr_lin.fit(X,y) 60 | 61 | y_pred = regressor.predict(y_input) 62 | ``` 63 | 64 | 이 때, 결과가 잘 나오지 않는다면 Feature들을 Scaling 할 필요가 있을 가능성이 있다. ```sklearn```의 Scaler 중 하나를 선택하자. 여기서는 StandardScaler를 사용한다. 65 | ```python3 66 | from sklearn.preprocessing import StandardScaler 67 | 68 | """ 69 | TODO: 70 | 여기에서 X, y를 가공한다. 71 | """ 72 | 73 | scaler_X = StandardScaler() 74 | scaler_Y = StandardScaler() 75 | 76 | X = scaler_X.fit_transform(X) 77 | y = scaler_Y.fit_transform(y) 78 | 79 | """ 80 | TODO: 81 | 여기에 SVR 코드를 적용한다. 82 | """ 83 | 84 | y_pred = scaler_y.inverse_transform(svr_lin.predict(scaler_X.transform(y_input))) 85 | ``` 86 | 87 | 88 | 89 | #### 참고 90 | - Flach, Peter. Machine learning: the art and science of algorithms that make sense of data. Cambridge University Press, 2012. 91 | - Parsons, Simon. "Introduction to Machine Learning by Ethem Alpaydin, MIT Press, 0-262-01211-1, 400 pp., $50.00/£ 32.95." The Knowledge Engineering Review 20, no. 4 (2005): 432-433. 92 | - Goodfellow, Ian, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016. 93 | - [서포트 벡터 머신(SVM)의 사용자로서 꼭 알아야할 것들 - 매개변수 C와 gamma](https://bskyvision.com/163) 94 | - [Support Vector Regression in 6 Steps with Python](https://medium.com/pursuitnotes/support-vector-regression-in-6-steps-with-python-c4569acd062d) 95 | 96 | ###### 넋두리 97 | 아아.. 나는 인공지능 1학년 아니고 인공지능 한 살쯤 되는 것 같다... 98 | -------------------------------------------------------------------------------- /computer_science/machine_learning/gpu.md: -------------------------------------------------------------------------------- 1 | # gpu 2 | 3 | 4 | ## monitoring gpu 5 | 리눅스에서 아래 command를 사용할 수 있다. 6 | ```shell 7 | nvidia-smi 8 | ``` 9 | smi는 사실 NVIDIA System Management Interface의 줄임말이다. 실행하면 다음과 같은 화면을 볼 수 있다. 10 | 11 | +-----------------------------------------------------------------------------+ 12 | | NVIDIA-SMI 411.31 Driver Version: 411.31 | 13 | |-------------------------------+----------------------+----------------------+ 14 | | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | 15 | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | 16 | |===============================+======================+======================| 17 | | 0 GeForce GTX 1070 WDDM | 00000000:01:00.0 On | N/A | 18 | | 0% 63C P2 63W / 151W | 5448MiB / 8192MiB | 67% Default | 19 | +-------------------------------+----------------------+----------------------+ 20 | 21 | +-----------------------------------------------------------------------------+ 22 | | Processes: GPU Memory | 23 | | GPU PID Type Process name Usage | 24 | |=============================================================================| 25 | | 0 1148 C+G Insufficient Permissions N/A | 26 | | 0 7344 C+G C:\Windows\explorer.exe N/A | 27 | | 0 7836 C+G ...osoft.LockApp_cw5n1h2txyewy\LockApp.exe N/A | 28 | | 0 8284 C+G ...5n1h2txyewy\StartMenuExperienceHost.exe N/A | 29 | | 0 9128 C+G ...hell.Experiences.TextInput.InputApp.exe N/A | 30 | | 0 9720 C+G ...10711.0_x64__8wekyb3d8bbwe\Video.UI.exe N/A | 31 | | 0 9944 C+G ...dows.Cortana_cw5n1h2txyewy\SearchUI.exe N/A | 32 | | 0 12636 C+G ...54.85.0_x64__kzf8qxf38zg5c\SkypeApp.exe N/A | 33 | | 0 12716 C+G ....469.0_x64__8wekyb3d8bbwe\YourPhone.exe N/A | 34 | | 0 13740 C+G ...t_cw5n1h2txyewy\ShellExperienceHost.exe N/A | 35 | | 0 49220 C+G ....15002.0_x64__8wekyb3d8bbwe\GameBar.exe N/A | 36 | | 0 117452 C C:\ProgramData\Anaconda3\python.exe N/A | 37 | | 0 121720 C C:\ProgramData\Anaconda3\python.exe N/A | 38 | | 0 137392 C C:\ProgramData\Anaconda3\python.exe N/A | 39 | | 0 154064 C+G ...6)\Google\Chrome\Application\chrome.exe N/A | 40 | | 0 159840 C+G ...oftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe N/A | 41 | +-----------------------------------------------------------------------------+ 42 | 43 | 근데! 나의 개발환경은 윈도우란 말이다! 윈도우 prompt에서는 아무리 ```nvidia-smi```를 입력해도
44 | ``` 'nvidia-smi'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다. ``` 를 마주할 것이다.
45 | 46 | 그러면 어떻게 해야 하냐구? 47 | C:\Program Files\NVIDIA Corporation\NVSMI 경로에 들어가서 ```nvidia-smi.exe``` 하면 된다. 48 | 49 | ```shell 50 | > cd C:\Program Files\NVIDIA Corporation\NVSMI 51 | C:\Program Files\NVIDIA Corporation\NVSMI> nvidia-smi.exe 52 | ``` 53 | 54 | 또, 10초마다 새로운 화면 보여주고 싶으면 아래 명령을 실행한다. 55 | ```shell 56 | nvidia-smi.exe -l 10 57 | ``` 58 | l은 loop의 줄임말이고, 10 대신 *초 단위의 원하는 간격*을 넣어주면 자동으로 반복한다.
59 | 다른 옵션들도 많은데, 60 | 자세한 설명은 [nvidia-smi documentation](http://developer.download.nvidia.com/compute/DCGM/docs/nvidia-smi-367.38.pdf)를 참고.
61 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch5_modern_symmetric_key_ciphers.md: -------------------------------------------------------------------------------- 1 | # Introduction to Modern Symmetric-key Ciphers 2 | 3 | **traditional ciphers: character-oriented**
4 | **modern ciphers: bit-oriented** 5 | 6 | ## Modern Block Ciphers 7 | - encrypts an n-bit block of P/ decrypts an n-bit block of C using a ```k-bit key``` 8 | - designed as a **substitution cipher** since transposition makes the cipher vulnerable to brute-force attacks 9 | - Block Ciphers as Permutation Groups 10 | - key should be long enough to choose every possible mapping from the input to output 11 | - Full Size key Ciphers: n! possible keys with ceil(log_2```n!```) bits 12 | - full-size key **substitution**(not a transposition!) block ciphers 13 | - transforming an n-bit int into a 2^n-bit string with **only a single 1 and ```2^n```-1 0's 14 | - Transposition: the key is ```ceil(log_2 n!)``` bits long 15 | - Substitution: the key is ```ceil(log_2 (2^n)!)``` bits long 16 | - Components of a Modern Block cipher 17 | - transposition units (P-boxes; p for permutation): compression P-boxes, Expansion P-boxes 18 | - substitution units (S-boxes; m\*n substitution unit, m!=n): Linear vs Nonlinear S-boxes 19 | - Exclusive-OR: addition and subtraction operations in the GF(2^n) field 20 | - Circular shift: shifting modulo n 21 | - Swap: special case of the circualr shift operation where ```k=n/2``` (self-invertible) 22 | - Split and Combine 23 | - Product Ciphers: complex cipher combining substitution, permutation and other components discussed in previous sections 24 | - **diffusion**: hide the relationship btwn the C and P (each symbol in C is dependent on some or all symbols in the P) 25 | - **confusion**: hide the relationship btwn the C and the key (if a sisngle bit in the key is changed, most or all bits in the C will also be changed ) 26 |
27 | - Two Classes of Product Ciphers 28 | - Feistel ciphers (e.g. DES): self-invertible(mixer), invertible, and noninvertible. 29 | - non-Feistel ciphers (e.g. AES): only invertible components(key mixer) 30 | - Attacks on Block Ciphers 31 | - Differential Cryptanalysis: chosen-plaintext attacks 32 | - Linear Crytanalysis: known-olaintext attacks 33 | - Linear Approximation 34 | 35 | ## Modern Stream Ciphers 36 | **encryption and decryption are done r bits at a time**
37 | **plaintext bit stream P, ciphertext bit stream C, key bit stream K where p_i, c_i, k_i are ```r```-bit** 38 | - Encryption = c_i = E(k_i, p_i) 39 | - Decryption = p_i = D(k_i, c_i) 40 | 41 |
42 | 43 | - Stream ciphers are faster than block ciphers. 44 | - **how to generate the key stream K matters** 45 | 46 | ### Synchronous Stream Ciphers 47 | - key is independent of the P or C 48 | - the simplest and the most secure : **one-time pad** 49 | - key stream randomly chosen foe each encipherment 50 | - ```p_i``` -> Encryption with random sequence bit generator -> ```c_i```(Insecure channel) -> decryption with secure key-exchange channel -> ```p_i``` 51 | - **feedback shift register (FSR)** 52 | - linear feedback shift register (LFSR) 53 | - c_i = 1 일 때 feedback function의 일부 54 | - key stream seq. is periodic: the maximum period of asn LFSR: ```2^m```-1 55 | - feedback function == characteristic polynomial with coefficients in the GF(2) field 56 | - LFSR with maximum period && even number of cellsand the characteristic polynomial ==> primitive polynomial (irreducible 57 | - nonlinear feedback shift register (NLFSR) 58 | 59 | ### Nonsynchronous Stream Ciphers 60 | **each key in the key stream depends on precious P or C** 61 | -------------------------------------------------------------------------------- /computer_science/python/numpy.md: -------------------------------------------------------------------------------- 1 | # Numpy 2 | 3 | https://docs.scipy.org/doc/numpy/index.html 4 | 5 | 주로 사용하는 데이터 타입이 pandas DataFrame이라 예시도 DataFrame과 함께!
6 | 아래처럼 numpy를 import 했고 모종의(?) 데이터가 든 DataFrame이 있다고 가정하자. 7 | ```python3 8 | import numpy as np 9 | import pandas as pd 10 | 11 | df = pd.DataFrame() 12 | ``` 13 | 14 | # 목차 15 | - [Logical AND](#logical-and) 16 | - [numpy array 0으로 initialize](#np-zeros) 17 | - [Polyfit으로 점들을 이어보자](#polyfit) 18 | - [RuntimeWarning: invalid value encountered in power](#power-warning) 19 | - [조건문에서 True 여부 판단](#np-all) 20 | 21 | * * * 22 | ### Polyfit 23 | x, y 좌표들이 주어졌을 때 Mean Square Error를 최소화하는 ```degree=N```인 다항식을 찾아보자! 24 | ```python3 25 | degree = 2 26 | 27 | x_list, y_list = [a for a in range(1, 11)], [a for a in range(2, 21)] 28 | 29 | p2 = np.poly1d(np.polyfit(x_list, y_list, degree)) 30 | 31 | xs = np.linspace(min(x_list), max(x_list), 1000) 32 | ys = p2(xs) 33 | ``` 34 | 35 | 1. ```np.polyfit()```: MSE를 최소화하는, 입력으로 넣어준 degree에 해당하는 다항식을 찾아서 그 계수(coefficient)를 반환하는 함수다. 36 | 2. ```np.poly1d()```: 계수를 입력으로 받는 다항식 클래스 37 | 1) 다항식을 construct하고, 38 | 2) x값을 넣어서 evaluate하자! (위 예제에서는 xs) 39 | 40 | - [numpy.polyfit](https://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html) 41 | - [numpy.poly1d](https://docs.scipy.org/doc/numpy/reference/generated/numpy.poly1d.html) 42 | 43 | 44 | * * * 45 | ### Logical AND 46 | 조건을 사용해서 DataFrame을 접근하고 싶은데, 조건이 2개 이상일 때가 있다. 그럴땐 logical_and를 사용하자! 47 | 48 | ```python3 49 | np.logical_and([True, False], [False, False]) 50 | # Output: 51 | # array([False, False]) 52 | ``` 53 | ```(최종 조건) = np.logical_and((조건1) , (조건2))``` 와 같이 사용하면 좋다! 54 | - https://docs.scipy.org/doc/numpy/reference/generated/numpy.logical_and.html 55 | 56 | * * * 57 | ### RuntimeWarning: invalid value encountered in power 58 | 코드를 돌렸는데 다짜고짜 에러가 났다! 59 | > C:\ProgramData\Anaconda3\envs\{내 ENV이름}\lib\site-packages\ipykernel_launcher.py:1: **RuntimeWarning: invalid value encountered in power** 60 | """Entry point for launching an IPython kernel. 61 | ```python3 62 | np.power(a, num) 63 | ``` 64 | 을 수행하는데, a가 음수이고 num이 정수가 아닐 경우 발생하는 에러였다. 실제로 계산 결과에 무려 ```j```가 붙는 것을 확인할 수 있었다. 갑자기 분위기 복소수... 경우에 따라 다르겠지만, 다음과 같이 고칠 수 있다. 65 | ```python3 66 | np.sign(a) * np.power(np.abs(a), num) # 부호는 살리고 power 연산은 수행 67 | ``` 68 | - https://stackoverflow.com/questions/45384602/numpy-runtimewarning-invalid-value-encountered-in-power 69 | 70 | * * * 71 | ### np.zeros(shape, dtype=float, order='C') 72 | df.values의 type은 `````` 이다. 어떤 DataFrame과 동일한 shape의, 0으로 initialize된 numpy array가 필요할 때 사용한다. 73 | 74 | ```python3 75 | np.zeros(df.values.shape) 76 | # dtype = data type 77 | # order = 'C' : C-style (row-major) 78 | # 'F' : Fortran-style (column-major) 79 | ``` 80 | - https://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html 81 | 82 | * * * 83 | ### 조건문에서 True 여부 판단시 사용하는 ```np.all``` 84 | ```python3 85 | # 기본형 86 | numpy.all(a, axis=None, out=None, keepdims=) 87 | 88 | # 실제 사용 예시 89 | np.all(df.values == np.zeros(df.values.shape)) 90 | # df.values == np.zeros(df.values.shape) 의 결과는 elementwise한 비교 결과 91 | # e.g. [True, False, ... , True] : 이 결과의 element가 모두 True면 return값이 True 92 | ``` 93 | - https://docs.scipy.org/doc/numpy/reference/generated/numpy.all.html 94 | 95 | * * * 96 | ### 템플릿 97 | ```python3 98 | ``` 99 | 100 | 101 | 102 | ##### 모르는 것을 검색할 때 유용한 키워드 103 | ``` numpy array ... ```, ```elementwise```, ```matrix multiplication``` 104 | 105 | -------------------------------------------------------------------------------- /computer_science/machine_learning/pytorch_dataloader.md: -------------------------------------------------------------------------------- 1 | # TensorDataset and DataLoader 2 | 3 | 4 | Pytorch에서 minibatch사용을 도와주는 친구는 ```DataLoader```이다. 5 | 6 | 일반적으로 가공한 데이터를 DataLoader에 넘길 때는 [Dataset](https://pytorch.org/docs/stable/data.html#torch.utils.data.Dataset) 클래스로 가공해야 한다. 7 | [TensorDataset](https://pytorch.org/docs/stable/data.html#torch.utils.data.TensorDataset)의 인자로 가공한 input, label tensor를 넘겨주면 된다. (이 때 input과 label을 mapping하므로 첫 차원의 값이 같아야 한다. ) 8 | 9 | 10 | TensorDataset은 이렇게 동작한다. tensor를 넣어주면 Dataset을 만들어 주는 것. 11 | ```python3 12 | class TensorDataset(Dataset): 13 | r"""Dataset wrapping tensors. 14 | 15 | Each sample will be retrieved by indexing tensors along the first dimension. 16 | 17 | Arguments: 18 | *tensors (Tensor): tensors that have the same size of the first dimension. 19 | """ 20 | 21 | def __init__(self, *tensors): 22 | assert all(tensors[0].size(0) == tensor.size(0) for tensor in tensors) 23 | self.tensors = tensors 24 | 25 | def __getitem__(self, index): 26 | return tuple(tensor[index] for tensor in self.tensors) 27 | 28 | def __len__(self): 29 | return self.tensors[0].size(0) 30 | ``` 31 | 32 | **Custom dataset**을 쓸 때는 Kaggle kernel [PyTorch Dataset and DataLoader](https://www.kaggle.com/pinocookie/pytorch-dataset-and-dataloader?fbclid=IwAR2dfKfjljmnoJUdMIttrxffZF4kJOyG5kqzverzIVZoySGq3EJOtFNvqcA)를 참고하면 좋을 듯 하다! torch version이 0.4.0 인 것은 주의(본인 현재 v1.3.1 사용중), MNIST dataset으로 설명하고 있다. 33 | 34 | 35 | 36 | ## Dataloader 37 | 38 | Pytorch에서는 흔히 ```torch.utils.data.DataLoader```로 접근할 수 있는 DataLoader를 사용한다. minibatch를 활용하기 좋다. 39 | 주어진 Dataset에 iterable을 제공한다. 40 | 41 | 42 | 파라미터들을 간단히 살펴보자면 43 | 44 | - ```dataset``` (Dataset): 내가 load할 Dataset이다. map-style과 iterable-style 모두를 지원한다. 45 | - ```batch_size``` (int, optional)```: 한 배치에 들어갈 샘플 개수(default: 1). 46 | - ```shuffle``` (bool, optional): True일 경우 각 에폭마다 데이터 순서를 섞는다(default: False). 47 | - time-series data에서는 True로 설정할 일이 없어 보인다. 48 | - ```sampler``` (Sampler, optional): dataset에서 sample을 뽑는 방법이다. 사용하려면 shuffle여부가 False여야만 한다. sampler에 대한 설명은 [여기](https://pytorch.org/docs/master/data.html#torch.utils.data.Sampler)를 참고하자. 49 | - ```batch_sampler``` (Sampler, optional): 위 sampler와 비슷하지만 batch에 해당하는 내용이다. batch단위의 샘플링을 할 때 쓴다. batch_size, shuffle, sampler, drop_last와 공존할 수 없다(mutually exclusive). 50 | - ```num_workers``` (int, optional): 데이터를 불러올 때 몇 개의 subprocess를 사용할 것인가. 0은 메인 프로세스에 불러올 것이라는 뜻이다.(default: 0) 51 | 52 | - ```collate_fn``` (callable, optional): 미니배치를 형성하기 위해 샘플들의 리스트를 병합하는 함수를 넣어준다. map-style dataset에서 미니배치를 불러올 때 사용한다. --> input의 길이가 다양할 경우 batch가 자동생성되지 않고 에러가 나므로 collate_fn을 사용한다. 53 | - [여기](https://pytorch.org/docs/master/data.html#dataloader-collate-fn)를 참고하자. 54 | - ```pin_memory``` (bool, optional) – True로 설정하면 텐서를 return하기 전에 CUDA pinned memory에 복사한다. 데이터가 custom type이거나 collate_fn을 사용했을 경우 documentation의 별도 예시를 보자. 55 | - 간단하게 설명하면 CUDA를 사용하는 GPU의 경우 데이터를 더 빠르게 왔다갔다 하게 해주는 것이다. 56 | - ```drop_last``` (bool, optional): True일 경우 배치 사이즈가 모자란 마지막 배치를 제외한다. (default: False) 57 | - ```timeout``` (numeric, optional): 양수일 경우 workers에서 배치를 가지고 올 때의 timeout value에 해당한다. 0이거나 양수여야 한다. (default: 0) 58 | 59 | - ```worker_init_fn``` (callable, optional): None이 아닐 경우 각 worker subprocess를 시작할 때 호출할 함수를 설정할 수 있다. (default: None) 60 | 61 | 62 | 63 | ###### 참고자료 64 | - [Pytorch documentation torch.utils.data.DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader) 65 | - [Guidelines for assigning num_workers to DataLoader](https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813) 66 | - [Github Issue: How to load huge file of data?](https://github.com/pytorch/text/issues/130#issuecomment-531901039) for ```pytorch/text``` 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /computer_science/python/venv.md: -------------------------------------------------------------------------------- 1 | ### venv, virtualenv, pyenv 너희 도대체 뭐니? 2 | 3 | ##### 사건의 발단 4 | 5 | 6 | ##### stackoverflow가 답을 알려줄거야 7 | 그럼 그렇지, 스택오버플로우에 누군가의 친절한 설명이 있다. 8 | 9 | - [What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?](https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe/41573588) 10 | 11 | - [What is the relationship between virtualenv and pyenv?](https://stackoverflow.com/questions/29950300/what-is-the-relationship-between-virtualenv-and-pyenv) 12 | 13 | 정리해보자면, 14 | 15 | ###### 1. Python standard library 16 | - venv (Python > 3.3) 17 | - ```$ python3 -m venv``` 하면 바로 사용할 수 있다. 3.4이상 버전에는 깔려 있지롱 18 | 19 | ###### 2. PyPI package 20 | - virtualenv 21 | - virtualenvwrapper 22 | - virtualenv의 extension이다. 23 | - 눈에 띄는 기능으로는 여러 virtualenv 디렉토리들을 넘나드는 ```workon``` 명령어가 있는듯. 24 | - pyenv 25 | - Python version들을 혼용해서 사용할 때, 그들을 분리해주는 데에 사용한다. 'multiple python'이 핵심 단어라고 할 수 있을 듯 26 | - pyenv-virtualenv 27 | - ```virtualenv```를 ```pyenv```와 통합하기 위한 플러그인이다. 28 | 29 | - pyenv-virtualenvwrapper 30 | - ```virtualenvwrapper```를 ```pyenv```와 통합하기 위한 플러그인이다. 31 | - pipenv 32 | - ```pip``` + ```virtualenv``` (좀이따 봅시다) 33 | 34 | 35 | 36 | 37 | 참고 링크 38 | - [Python3 documentation - venv](https://docs.python.org/3/library/venv.html) 39 | - [Creating Virtual Environment](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) 40 | - [vitrualenvwrapper on PyPIi](https://pypi.python.org/pypi/virtualenvwrapper) 41 | - [virtualenvwrapper on Bitbucket](https://bitbucket.org/virtualenvwrapper/virtualenvwrapper/overview) 42 | - [pyenv-virtualenvwrapper on github](https://github.com/pyenv/pyenv-virtualenvwrapper) 43 | 44 | 45 | 46 | 47 | * * * 48 | 49 | ### pip ? pipenv ? 50 | 51 | virtualenv 관련하여 이런 저런 검색을 하다가는 ```pip```와 ```pipenv```와 마주하고야 말았다 (...) 52 | 53 | 그동안 수도 없이 많은 54 | 55 | ``` 56 | $pip install --upgrade 57 | $pip install (package 이름) 58 | 59 | ``` 60 | 을 해왔건만, 정작 pip에 대해서는 "패키지 관리자야~" 이상의 궁금증을 가져본 적이 없는 것 같다. 그래서 찾아보았다! 61 | 62 | ##### 1. pip 63 | 우선 이 친구는 64 | - [pip on Github](https://github.com/pypa/pip) 65 | - [pip Quickstart](https://pip.pypa.io/en/stable/quickstart/) 66 | 이 문서들을 참고했다. 67 | 68 | - python.org에서 다운 받은 Python 2.7.9 또는 Python 3.4 이상 버전에는 ```pip``` 가 이미 설치되어 있답니다. 69 | - 물론 upgrade 해주어야 할거에요. 70 | - 혹시 ```virtualenv``` 나 ```pyvenv```로 만든 가상환경에서 작업중이라면 마찬가지로 ```pip```가 이미 설치되어 있을 거예요. 71 | - ** 그래서 ```pip```가 뭐냐면, PyPA [tool recommendations](https://packaging.python.org/guides/tool-recommendations/) 이에요. Python package들 설치하는..! ** 72 | 73 | 74 | 75 | 76 | ##### 2. pipenv 77 | 그런데 세상에나 ```pipenv```라는것도 있다고 하지 않는가...? 78 | 심지어 ** new recommended Python Packaging tool by Python.org ** 라고 동네방네 적혀있다! 79 | 80 | 81 | 얘는 대체 뭐냐면,, 82 | 83 | - 위에 적혀있듯 Python 패키징 툴 84 | - 엄청 간략하게 말하면 ```pip```+```virtualenv``` 85 | - ```requirements.txt``` 파일 관리하기 골치가 아프지 않나요? [골치아픈 예시](https://www.kennethreitz.org/essays/a-better-pip-workflow) 라면서, ```pipenv```는 (basic use cases 에 superior한 ~~적절한 번역 실패~~)```pipfile```과 ```pipfile.lock``` 를 쓴다고 말한다. 86 | - 모든 곳에 Hash 를 사용해 보안 취약점들을 보완해준다고 한다. 87 | - ```$pipenv graph``` 하면 dependency graph 에 대한 88 | - ```.env``` 파일을 로드함으로써 개발 작업 흐름을 원활하게 해준다. ( Streamline development workflow by loading .env files. ) 89 | - [Streamline](https://dictionary.cambridge.org/dictionary/english/streamline) 이 무슨 뜻인지 몰라서 찾아봤고 그래서 원문을 남겨뒀다 홍홍. 90 | 91 | ``` 92 | $ pip install pipenv 93 | ``` 94 | 이렇게 깔 수 있다! 95 | 96 | 참고자료 97 | - [pipenv 공홈](https://docs.pipenv.org/) 98 | - [pipenv on PyPI](https://pypi.python.org/pypi/pipenv) 99 | - [Why pipenv?](https://www.ostechnix.com/pipenv-officially-recommended-python-packaging-tool/) 100 | 101 | 102 | * * * 103 | 이어지는 궁금함은 104 | ### PyPI랑 PyPA가 뭔가요...? 105 | 106 | ~~궁금한게 왜 이렇게 많아~~ ~~검색하다보면 그렇지 뭐~~ 107 | 108 | 좀 쉬었다 쓰기로... 109 | 110 | 111 | -------------------------------------------------------------------------------- /computer_science/cryptography/ch3_symmetric_key_ciphers.md: -------------------------------------------------------------------------------- 1 | # Traditional Symmetric-Key Ciphers 2 | 3 | ## Introduction 4 | - **symmetric-key cipher**: **```Shared secret key```**, ```Encryption/Decryption algorithm```, ```Secure key-exchange channel``` 5 | - Kerckhoff's Principle: Always assume that the adversary know the enc/decryption algorithm -> **```the secrecy of the key```** matters 6 | - Cryptanalysis 7 | - Ciphertext-only attack: brute-force(exhaustive-key-search) attack, statistical attack, pattern attack 8 | - Known-plaintext attack 9 | - Chosen-plaintext attack 10 | - Chosen-ciphertext attack 11 | 12 | ## Substitution Ciphers 13 | **Replaces one symbol with another** 14 | - Monoalphabetic Ciphers: the relationship is always one-to-one 15 | - Additive cipher, Shift cipher, Caesar cipher: ```C = (P+k) mod 26``` (**C**ipher, **P**laintext, **k**ey) 16 | - Multiplicative ciphers: ```C = (P*k) mod 26``` 17 | - plaintext and ciphertext are int in Z_26 18 | - the key is an int in Z_26*(multiplicative inverse가 있는 집합) 19 | - Affine ciphers: ```C = (P*k_1 + k_2) mod 26``` 20 | - ```k_1``` is from Z_26*(multiplicative inverse가 있는 집합) 21 | - ```k_2``` is from Z_26 22 | - Monoalphabetic Substitution Cipher 23 | - ciphers above are vulnerable to brute-force attack; therefore create a mapping between each P and C 24 | - Polyalphabetic Ciphers: relationship between a character in the P to C is one-to-many 25 | - Autokey Cipher: ```C_i = (P_i _ k_i) mod 26 ``` 26 | - hides the single-letter frequency statistics of the P 27 | - ciphers vulnerable to a brute-force attack since the size of the key space is only 25 28 | - Vigenere Cipher: ```C_i = P_i + k_i``` 29 | - depend only on the position of the character in P 30 | - vulnerable to the use Kasiski test(searches for repeated text segments) to find the key length & brute-force 31 | - Hill Cipher : ```C_m = P_1*k_1m + ... + P_i*k_im + ...+ P_m*k_mm``` (```m```: size of the block ) 32 | - plaintext divided into equal-size blocks 33 | - Each clock is encrytped one at a time 34 | - multiplicative inverse for the key matrix needed 35 | - frequency analysis disabled, known-plaintext attack available if the value ```m``` and plaintext/cipher text pairs are known. 36 | - One-Time Pad 37 | - "perfect secrecy can be achieved if each plaintext symbol is encrypted with a key randomly chosen from a key domain" 38 | - key length = plaintext length 39 | - key chosen in complete random 40 | 41 | ## Transposition Ciphers 42 | **changes the location of the symbols/ reorders symbols**
43 | **vulnerable to several ciphertext-only attacks**(e.g. statistical attack(frequency), brute-force attack) 44 | - Keyless Transposition Ciphers 45 | - written into a table 1) column by column and transmitted row by row 2) row by row and transmitted column by column 46 | - Keyed Transposition Ciphers 47 | - permutation is done on the whold plaintxt to create the whole ciphertext 48 | - key used for encryption and decryption (matrices can be used as a representation of the key) 49 | - Combining Two Approaches 50 | - Double transposition cipher(e.g. (Plaintext) -> write row by row -> permute columns -> read col by col -> (Middle-text) -> write row by row -> permute columns -> read column by column -> ciphertext) 51 | 52 | ## Stream and Block Ciphers 53 | **Two categories of the traditional symmetric ciphers: stream ciphers and block ciphers** 54 | - Stream Ciphers: encryption and decryption are done one symbol at a time 55 | - P(plaintext), C(ciphertext), K(key stream) 56 | - key stream might diverse: 1) predetermined 2) depend on P/C/previous key values 57 | - additive ciphers(monoalphabetic), monoalphabetic substitution ciphers, vigenere ciphers(polyalphabetic) 58 | - Block Ciphers: a group of P symbols of size m are encrypted together creating a grounp of ciphertext of the same size 59 | - a single key is used to encrypt the whole block 60 | - Hill ciphers 61 | - Combination: "blocks of plaintext are encrypted individually but using a stream of keys to encrypt the whole message block by block" 62 | 63 | -------------------------------------------------------------------------------- /computer_science/server/iperf.md: -------------------------------------------------------------------------------- 1 | # iperf 2 | 최근 특정 서버의 카프카 전송 속도가 떨어지는 현상이 있었다. 3 | 4 | 네트워크 성능테스트를 했다면서 내역을 보내 왔는데 처음 보는 명령어가 있는 것이다!
5 | 그래서 찾아본 오늘의 프로그램 `iperf` 6 | 7 | 메일 내용으로만 봐서는 시간 및 용량 단위로 속도 측정이 가능한 프로그램인 듯 하다. 8 | 9 | ## 개요 10 | ### iPerf3 11 | 공식 홈페이지는 https://software.es.net/iperf/
12 | 깃허브 레포는 https://github.com/esnet/iperf 다. 신기해! 13 | 14 | - iperf를 통해 IP 네트워크의 최대 달성 대역폭을 측정할 수 있다. 15 | - timing, protocol, buffer 등의 다양한 파라미터를 조절할 수 있고, throughput/bitrate, loss 등을 측정할 수 있다. 16 | - NLANR/DAST를 재설계한 것이며 iperf3이라고도 불린다. 17 | - 엄밀하게는 다른 프로그램에서도 사용할 수 있도록 라이브러리를 완전히 새롭게 구현한거다. 18 | - 기존 iperf에는 빠져 있지만 nettcp나 netperf에서 제공하는 다양한 기능(a zero-copy mode and optional JSON output)도 제공한다. 19 | - 원본 iperf랑은 호환 불가 20 | - CentOS Linux, FreeBSD, and macOS 환경에서 개발했으며, 21 | OpenBSD, NetBSD, Android, Solaris 및 기타 Linux 배포판에서도 작동한다. 22 | - three-clause BSD 라이선스를 따르며 ESnet / Lawrence Berkeley National Laboratory에서 개발했다. 23 | 24 | ### iPerf2 25 | 위 내용을 기껏 찾아놓고 우리 서버의 iPerf 버전을 확인해봤더니 글쎄 `iperf version 2.0.13 (21 Jan 2019) pthreads` 랜다 쳇... 26 | - iPerf2는 https://sourceforge.net/projects/iperf2/ 에서 확인 가능하다. 27 | - 한마디 설명은 `TCP/UDP의 latency를 포함하는 네트워크 성능 측정 도구`다. 28 | - 기본 동작은 반복적으로 **len** bytes의 array를 **time** seconds만큼 전송하는 것 29 | - len의 default는 128 KB for TCP, 8 KB for UDP 30 | - time의 default는 10seconds 31 | - [iPerf user docs](https://iperf.fr/iperf-doc.php) 참고 32 | 33 | ## 용례 34 | ### 버전 확인 35 | ``` 36 | # iperf -v 37 | iperf version 2.0.13 (21 Jan 2019) pthreads 38 | ``` 39 | ### 기본형 40 | ``` 41 | iperf -s [ 옵션 ] # 내가 서버다 42 | iperf -c 호스트 [ 옵션 ] # 내가 클라이언트다, 호스트에 연결해줘라! 43 | ``` 44 | 45 | ### 시간 단위 속도 측정 46 | - `-t n`, `--time n` 옵션: 시간 지정(default 10 seconds) 47 | - `-f M`, `--format M` 옵션: bandwidth 보여주는 포맷 설정. M은 Mbytes/sec (default: 'a', adaptive bits/sec) 48 | ``` 49 | (client에 로그인한 상태)# iperf -c [host ip] -f M -t [숫자(초 단위)] 50 | # iperf -c 10.000.000.000 -f M -t 5 51 | ``` 52 | 53 | ### 용량 단위 속도 측정 54 | - `-n n`, `--num n` 옵션: 일반적으로 iPerf의 동작은 반복적으로 **len** bytes의 array를 **time** seconds만큼 전송하는 것인데, 55 | 이 옵션을 주면 time만큼 전송하는 대신 array of len bytes를 num times만큼 전송한다. (The number of buffers to transmit) 56 | - `-f M`, `--format M` 옵션: bandwidth 보여주는 포맷 설정. M은 Mbytes/sec (default: 'a', adaptive bits/sec) 57 | ``` 58 | (client에 로그인한 상태)$ iperf -c [host ip] -f -M -n [전송 사이즈] 59 | # iperf -c 10.000.000.000 -f -M -n 1500M 60 | ``` 61 | 62 | ## 참고(client 모드 관련 옵션들) 63 | ``` 64 | Client specific: 65 | -c, --client run in client mode, connecting to 66 | -d, --dualtest Do a bidirectional test simultaneously 67 | --ipg set the the interpacket gap (milliseconds) for packets within an isochronous frame 68 | --isochronous :, send traffic in bursts (frames - emulate video traffic) 69 | -n, --num #[kmgKMG] number of bytes to transmit (instead of -t) 70 | -r, --tradeoff Do a bidirectional test individually 71 | -t, --time # time in seconds to transmit for (default 10 secs) 72 | -B, --bind [ | ] bind ip (and optional port) from which to source traffic 73 | -F, --fileinput input the data to be transmitted from a file 74 | -I, --stdin input the data to be transmitted from stdin 75 | -L, --listenport # port to receive bidirectional tests back on 76 | -P, --parallel # number of parallel client threads to run 77 | -R, --reverse reverse the test (client receives, server sends) 78 | -T, --ttl # time-to-live, for multicast (default 1) 79 | -V, --ipv6_domain Set the domain to IPv6 (send packets over IPv6) 80 | -X, --peer-detect perform server version detection and version exchange 81 | -Z, --linux-congestion set TCP congestion control algorithm (Linux only) 82 | ``` 83 | 84 | ## 그 외 물음표 85 | - 근데 카프카는 디폴트 9092 포트 쓰는데 왜 5001(TCP) 포트를 실험하셨지? -> 디폴트 값이 5001이네... 86 | - `-p 9092`로 실험해봐야지! 87 | - iPerf3은 client-side port 지정하는 `--cport n` 옵션도 있네 88 | 89 | - 엥 나는 왜 iperf 실행이 안되지? 90 | - 1. root 계정에서 실행해야 하네 91 | - 2. 아니 그래도 안되네... connect failed: Connection refused 92 | - 카프카 쪽 5001포트가 닫혀있나보다... 9092포트는 실험 가능(근데 해도 되는건가?) 93 | - 3. 근데 `write failed: connection reset by peer`가 뜨네 -> 여기부턴 내일 보자! 94 | --------------------------------------------------------------------------------