본문 바로가기

전체 글

파이썬 프로퍼티(Property) 파이썬 속성 값을 숨기기 위해서 사용하는 setter, getter를 파이썬 프로퍼티를 이용하여 간단하게 구현할 수 있다 결론부터 말하자면, getter에는 @property를 붙이고, setter에는 @{속성이름}.setter 를 붙인다. @{속성이름}.deleter를 사용하여 속성을 제거하는데 사용할 수도 있다. class Person: def __init__(self): self.__age = 0 def get_age(self): # getter return self.__age def set_age(self, value): # setter self.__age = value james = Person() james.set_age(20) print(james.get_age()) class Person:.. 더보기
Decision Tree(개념편) 1. Classification Tree 예시 1.1 데이터로 부터 Classification 트리 구성하기 1.1.1 지니 불순도 계산하기 - 열에 대해 최상위 루트 열 판단하기 - 이진 값을 가진 열에 대해 지니 불순도 계산하기 - 수치 값을 가진 열에 대해 지니 불순도 계산하기 2. Regression Tree 예시 2.1 데이터로 부터 Regression 트리 구성하기 (참고 사이트는 아래에 있습니다) 의사 결정 트리(Decision Tree)가 카테고리 분류를 수행하다면 분류 트리(Classification Tree)라 한다. 의사 결정 트리(Decision Tree)가 숫자 값을 예측한다면 회귀 트리(Regeression Tree)라 한다. 1. 분류 트리(Classification Tree).. 더보기
torch_scatter 설치 본인의 경우 python3.8버전에 pytorch는 1.12.1 버전이었고, cuda는 11.6 버전이었다. rusty1s/pytorch_scatter: PyTorch Extension Library of Optimized Scatter Operations (github.com) 에서 Binaries로 설치하기 위해 https://data.pyg.org/whl/ 사이트에서 아래의 설치 파일을 다운 받아 pip로 설치 하였다. 하지만,, 계속 에러가 났다. (이것 때문에 시간을 1시간 30분 낭비하다가...) pytorch를 1.12.0으로 다운그레이드 해주었고(Previous PyTorch Versions | PyTorch), cuda는 11.6 버전 유지. pip install torch==1.12.0.. 더보기
[DOING] Self-Supervised Representation Learning 정리 Self-supervised Learning은 비지도 학습의 하위 분야 (배경) (연구 흐름) - Pretext Task : Unlabeled Dataset을 입력으로 받아서, 사용자가 정의한 문제(Pretext Task)를 네트워크가 학습하게 하여 데이터 자체에 대한 이해도를 높이고자 함. : Pretext Task가 잘 짜여 졌다면, 네트워크가 Input을 효과적으로 Representation 할 수 있을 것으로 가정한다. : Input을 네트워크가 효과적으로 Representation 하였다면, 사용자가 풀고자 하는 문제(Downstream Task)를 Transfer Learning 한다. : 하지만, 이미지가 늘어날 수록 가짓수도 급속히 늘어나는(?) 문제가 존재 - Contrastive Lea.. 더보기
Data Classes 1. 설명 - 파이썬 3.7 부터 도입된 문법이고, 간략화된 데이터 정의를 가능하게 한다. class RegularCard: def __init__(self, rank, suit): self.rank = rank self.suit = suit def __repr__(self): return (f'{self.__class__.__name__}' \ f'(rank={self.rank!r}, suit={self.suit!r})' def __eq__(self, other): if other.__class__ is not self.__class__: return NotImplemented return (self.rank, self.suit) == (other.rank, other.suit) >>> queen_of.. 더보기
Array Roate Clockwise/Anti-Clockwise /* * clockwise rotate * first reverse up to down, then swap the symmetry * 1 2 3 7 8 9 7 4 1 * 4 5 6 => 4 5 6 => 8 5 2 * 7 8 9 1 2 3 9 6 3 */ void rotate(vector &matrix) { reverse(matrix.begin(), matrix.end()); for (int i = 0; i < matrix.size(); ++i) { for (int j = i + 1; j < matrix[i].size(); ++j) swap(matrix[i][j], matrix[j][i]); } } /* * anticlockwise rotate * first reverse left to right, the.. 더보기
Nerf란 1. 개요 - NeRF는 2020년 NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis라는 논문에 의해 소개되었다. - 쉽게 말해 2D 이미지를 3D로 변환해 준다 - 엄밀하게는 여러장의 이미지를 입력 받아, 새로운 시점에서의 물체 이미지를 만들어내는 View Synthesis 모델이다. - n개의 시점에서 불연속적인 2D 이미지를 입력 받아, 이미지가 연속적으로 구성될 수 있도록 임의 시점에서의 새로운 이미지를 만들어 낸다. Nerf는 이미지 데이터에서 직접 학습하지만 CNN 레이어나 Transformer 레이어(적어도 원본은 사용하지 않음)를 사용하지 않는다. Nerf의 이점은 압축이다. 5–10MB에서 Nerf 모델의 가중치.. 더보기
Eight Points algorithm(Normalized) - 과제 해결 Part 1: Normalized 8-Point Algorithm In eight_point_fw, implement the function find_fundamental_matrix. This function takes 2 sets of corresponding key points from the 2 images and computes the fundamental matrix. For stability of the algorithm, we would want to first normalize the points. For this we follow the following steps: Find the centroid of the points (find the mean x and mean y values).. 더보기