티스토리 뷰

코드를 짜다보면, 누구도 잘 설명해주지 않는

그리고 조금 하찮고(?) 기본적인 것으로 생각되어서 그냥 넘어갔던 녀석들을 한번에 정리해 보려고 한다.

하찮지만 소중한 것들

 

1. super()

: super()은 다른 class의 method를 상속받을 때 사용 한다.

(Return a proxy object that delegates method calls to a parent or sibling class of type)

출처 : https://docs.python.org/2/library/functions.html#super

class Rectangle:
    def __init__(self, length, width):
        self.length = length
        self.width = width

    def area(self):
        return self.length * self.width

    def perimeter(self):
        return 2 * self.length + 2 * self.width

# Here we declare that the Square class inherits from the Rectangle class
class Square(Rectangle):
    def __init__(self, length):
        super().__init__()

 

2. assert 

assert 는 debugging 코드로써, 조건을 만족시키지 못하면 error를 반환한다

(The assert keyword lets you test if a condition in your code returns True, if not, the program will raise an AssertionError.)

출처 : https://www.w3schools.com/python/ref_keyword_assert.asp

 

x = "hello"

#if condition returns True, then nothing happens:
assert x == "hello"

#if condition returns False, AssertionError is raised: AssertionError
assert x == "goodbye"

여기는 Deep learning 기법들

 teacher forcing

teacher forcing 이란?

1) output -> input으로 사용하는 방법의 문제점을 해결하기 위해 사용

2) ground truth를 통해 output을 평가

 

output -> input 방법의 문제

1) 느린 수렴속도

2) Model의 불안전성

3) 이전의 오류가 해결되지 않고 계속 되물림됨

 

teacher forcing

장점 : 빠름, 결과가 안정됨

단점 : bias가 발생할 수 있음, ground truth가 필요함

728x90
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함