Machine Learning

    [ML] 분류 모델 성능 평가 지표 - Confusion Matrix (accuracy, precision, recall, f1 score, ROC-AUC curve)

    Classification & Clustering 의 성능 평가 지표 Linear모델에 대해서는 MSE, R-square 등으로 모델의 성능을 평가할 수 있다. 그렇다면 분류 모델 또는 클러스터링에서의 성능 평가 방법은 어떠할까? 사실 분류 모델과 클러스터링은 평가 방법이 다르다. 이 둘의 차이는 라벨(정답)의 유무인데, 클러스터링은 라벨이 없는 상태에서 클러스터의 응집도 등으로 평가를 진행한다. 하지만 이또한 정확도가 높지 않기 때문에 전문 지식을 가지고 있는 도메인 전문가의 휴리스틱한 평가 방식을 취한다. Classification의 성능 평가 지표 - Confusion Matrix 이진 분류(양성, 음성)을 다루는 task라고 했을 때 모델의 정확도가 100%이면 아래와 같이 양성으로 예측된 영역을..

    [Pytorch] 모델 구조 확인, parameter확인

    모델 구조(architecture) 확인하기 model = models.resnet50(pretrained = True) print(model) 모델 파라미터(parameter) 확인하기 - parameters() for name, param in model.named_parameters(): count+=1 if count==1: print(param.size()) print(name) torch.Size([64]) conv1.1.weight 모델 파라미터(parameter) 확인하기 - children() for child in model.children(): count += 1 if count == 2: print(child) children()에서 name변수를 이용하면 현재 parameter(l..

    [pytorch] tensor 초기화 및 속성

    텐서(Tensors) 텐서는 배열 및 행렬과 비슷한 특수 데이터구조로, Pytorch에서는 텐서를 사용하여 모델 입출력과 파라미터 값을 인코딩해서 사용한다. Tensor는 numpy의 ndarray와 비슷하며 다른점이 있다면 GPU 기반에서 동작한다는 점이 다르다. 텐서의 initialization(초기화) 텐서를 초기화 하는 방법은 3가지 정도가 있다. 1. 직접 초기화 (데이터 타입은 자동 할당) data = [[1,2],[3,4]] x_data = torch.tensor(data) print(x_data,type(x_data)) ---------output---------- tensor([[1, 2], [3, 4]]) 2. ndarray에서 초기화 ( tensor-ndarray bridge) 아래 ..

    [Pytorch] model.train(), model.eval() 의미

    https://stackoverflow.com/questions/60018578/what-does-model-eval-do-in-pytorch/60018731#60018731 What does model.eval() do in pytorch? I am using this code, and saw model.eval() in some cases. I understand it is supposed to allow me to "evaluate my model", but I don't understand when I should and shouldn't use it, or how... stackoverflow.com nn.Module에는 train time과 evaluate time에 수행하는 다른 작업을 sw..

    [cs231n] 내가보려고만든 cs231n 강의자료모음집

    https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=jhjyj5414&logNo=221486622593 딥러닝 스터디 자료 모음 딥러닝 스터디 자료 모음 Deep Learning Bookmarks View the Project on GitHub bbongcol/deep-lear... blog.naver.com http://cs231n.stanford.edu/2016/syllabus Stanford University CS231n: Convolutional Neural Networks for Visual Recognition cs231n.stanford.edu CS231n 강의 youtube playlist https://www.yout..

    [Pytorch] torch.manual_seed()

    random seed 란 ? numpy 에서도 사용했던 random seed 5개의 난수를 생성 한다고 하면 우리는 np.random.rand(5)로 난수를 생성한다. 연달아서 np.random.rand(5)를 실행한다면 아래처럼, 생성할때마다 매번 서로 다른 5개의 숫자를 생성할 것이다. random seed를 고정한다는 말은 동일한 셋트의 난수를 생성할 수 있게 하는 것이다. seed() 괄호 안에 들어가는 숫자는 무슨 의미일까? seed value 숫자 자체는 중요하지 않고 서로 다른 시드를 사용하면 서로 다른 난수를 생성한다는 점만 알면 된다. pytorch random seed deep learning에서 random num을 사용하는 경우가 많다. (초기화를 할 때 주로 씀) random nu..