[OODP] 7. Objects and Classes

POSTECH OODP Lecture at 24SS

Abstraction and Classes

Class specification은 두 부분으로 나누어진다.

이러한 class type의 변수를 object(혹은 instance)라고 부른다.

Member Access Control

C++ struct가 class와 다른 것은 오직 구조체의 default access control이 public이라는 것 뿐이다. class에서는 private이 default이다.

이처럼 public interface(Abstraction)과

Questions?

Q1.
A1.

Q2.
A2.

[OODP] 6. Memory Models and Namespaces

POSTECH OODP Lecture at 24SS

Memory Model

Separate Compilation

C++은 실행시키기 위해 compiler와 linker 두 단계를 거친다. 함수는 여러 파일에 나뉘어서(선언부, 정의부) 작성될 수 있는데, 그중 한 파일만 수정할 수 있다. 이런 경우 나눠진 여러 파일들 전체를 컴파일하지 않고, 수정된 몇몇 파일만 컴파일 한 후, 다른 파일들의 이전 컴파일 결과들과 link하면 빠르게 실행시킬 수 있다.

  • main.cpp : 함수가 실행되는 곳이다. 필요한 함수들을 호출한다.
  • func.h : 함수들이 선언되는 곳이다. 여러 파일에서 사용되는 function prototypes과 inline functions, structure declarations, class declarations, template declarations 그리고 symbolic constants가 존재한다. 이러한 정보들은 컴파일러에게 어떻게 함수를 다루고, 변수를 생성할지 알려줄 뿐, 실제로 생성하지는 않는다.
  • func.cpp : 함수들이 정의되는 곳이다. func.h에서 선언된 함수들을 실제로 구현한다.

[DL] 2. Optimization for Training Deep Models

Deep Learning을 정리하겠다.

딥러닝에서의 최적화 문제는 모델의 파라미터를 조정하여 cost function, J(θ)를 최소화하는 것을 말한다. 본 챕터에서는 학습을 위해 쓰이는 최적화가 pure 최적화와 얼마나 다른지, 무슨 난제들이 있는지, 어떤 최적화 전략들이 실제로 쓰이고 있는지 알아보겠다.

[AI] 1. Regression

[Deep Learning]을 정리하겠다.

Regression

Regression is 1) predicting the target y given a D-dimensional vector x 2) or estimating the relationship between x and y 3) or finding a function from x = (x1, x2, …, xp) to y

Linear Regression

Find the relationship(function) between two variables by fitting a linear equation to observed data

linear-regression

우리의 목표는 모든 x에 대해 실제값 y와 유사한 estimated y 또는 predicted y를 도출하는 것이다.

[OODP] 5. Functions(2)

POSTECH OODP Lecture at 24SS

Reference Variable

포인터를 대체하기 위해서 만들어진 개념이다. 이미 정의된 변수에 대해서 alias처럼 동작한다.

int rats = 101;
int &rodents = rat;     // rodent is a reference

위와 같이 & 연산자를 사용해 선언할 경우, 메모리를 가리키는 연산자가 아니라 rats라는 변수의 별명(alias)가 rodents라는 뜻이다.

Comparison with pointers

ref_variable == (*pointer_variable)

reference variable을 선언하면서 반드시 초기화가 함께해야 한다. reference는 const pointer와 유사해서, 선언한 이후 값을 변경할 수 없다.

[swaps.cpp]: [reference]:

[OODP] 5. Functions(2)

POSTECH OODP Lecture at 24SS

Functions and Structures

function의 매개변수로 structure 역시 올 수 있다. 그러나 크기가 큰 structure의 경우, 모든 값을 복사(call by value)하는 것은 낭비가 될 것이다. 그래서 구조체를 활용하는 함수는 대체로 element copy보다는 reference copy를 포인터를 사용해 작성된다.

[fun_ptr.cpp]:

[DL] 2. Regularization for Deep Learning

Deep Learning을 정리하겠다.

머신러닝에서 중요한 문제는 어떻게 훈련 데이터 뿐만 아니라, 실제 데이터(new input)에 대해서도 잘 동작하도록 할 것인가다. training error가 다소 발생하더라도 test error를 잡는 것이 regularization의 전략이다.

Regularization : any modification we make to a learning algorithm that is intended to reduce its generalization error but not its training error

Pagination