분류 전체보기 (158) 썸네일형 리스트형 c++ heap memory space heap 공간을 잘 쓰지 않으면 memory leak이나 memory fragmentation에 직면할 것이다. stack 대신에 heap memory를 쓰는 이유는 1. life cycle 2. large size 3. dynamic runtime 때문이다 life cycle 측면에서 보면, stack 공간은 함수가 종료하면 사라진다. 따라서 pointer를 활용해서 heap 공간에 계속 남아 있는 것을 쓰는 게 좋다 large size는 stack 공간은 size에 한계가 있다. 따라서 large size를 사용하기 위헤 heap 공간을 쓴다. dynamic runtime이다. stack 공간에 있는 내용은 compile시에 결정된다. heap을 사용하면 runtime에 지정되는 것을 사용할 수 있다.. c++ stack 공간, class, struct, 타입별 메모리 사이즈 공부한 거 정리 1 2 3 4 5 6 7 8 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 51 52 53 54 55 56 57 58 59 60 61 62 #include #include #include struct ST { int a; int b; }; struct ST2 { int a; // 4 int b; // 4 short c; // 2 // 메모리 padding 때문에 크기가 12로 나온다 }; class Cat { public: void printCat(); private: int age; float weight; //.. c++ assembly 기록 compiler explorer 홈페이지에서 자신의 컴파일러에 맞게 코드를 assembly로 변환할 수 있다. https://godbolt.org/ Compiler Explorer godbolt.org 그리고 else if보다 switch가 빠르다. 나누기 보다 곱하기가 5배 더 빠름. 그러나 -O2 명령어로 최적화를 하면 else if나 switch가 똑같다.(최적화) 어셈블리코드가 짧다고 더 빠른 코드는 아님 하지만 benchmark를 돌려서 확인하는게 제일 좋다! c++ extern static 기록 정리 extern은 외부에서 함수나 변수를 가져올 떄 정의하는 것이다. main.cpp에서 extern int i; foo.cpp 에서 i=10을 정의했다면 링크 할때 main.cpp의 i를 foo.cpp에서 가져온다. static은 해당 파일(foo.cpp)에서만 쓰이는 거다 foo.cpp에서 static을 사용한다면 foo.cpp에서만 효력이 유효하다. 마지막으로 extern "C" 는 함수 앞에 붙이는 것인데 c++에서는 function overloading 때문에 name mangling이 되는데 extern "C"를 하면 name mangling을 없애주어서 C 스타일로 바꿔준다. c++ preprocessor 공부기록 ifdef, replace https://www.youtube.com/watch?v=GUgX9eV_Bu0&list=PLDV-cCQnUlIY4TMoRsrW0oqjCLTSm1nAf&index=4 참조하였음 ABCD가 정의되어있으므로 ifdef ABCD가 참이므로 std::cout 2==2가 되므로 std::cout 공부기록 - Optimal Bayesian Rule 공부한 것을 기록할 겸 남겨 놓는다. Bayesian Classifier가 오류 확률을 최소화 해 준다는 것이다. 당연한 것 같지만, 사소하게 넘겨서는 안 되는 내용이다. 파이썬 Gradient Boosting 바닥부터 구현하기 기말고사 공부 할 겸 Gradient Boosting을 바닥부터 구현해 보았다. 나는 이해하지 못하면 암기를 못하는 편이다... 찝찝함을 없애기 위해 한번 파이썬으로 Gradient Boosting을 구현해 보았다. 하악... 코드 >> 1 2 3 4 5 6 7 8 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 9.. Bias Variance Decomposition and XGBOOST와 RANDOMFOREST 주의사항 nvidia 실험 Bias Variance Decomposition을 이해한 후 XGBoost의 튜닝, 랜덤포레스트 튜닝에 대해서 생각해 보자. https://developer.nvidia.com/blog/bias-variance-decompositions-using-xgboost/ Bias Variance Decompositions using XGBoost | NVIDIA Developer Blog This blog dives into a theoretical machine learning concept called the bias variance decomposition. This decomposition is a method which examines the expected generalizatio.. 이전 1 ··· 13 14 15 16 17 18 19 20 다음