runtimeerror: found dtype long but expected float
·
Error Note
- 전체 에러 문구 runtimeerror: found dtype long but expected float => 데이터 타입이 맞지 않아 생기는 에러입니다. - 해결 방법 .to() 함수를 사용해 데이터 타입을 변경해주면 됩니다. my_tensor.to(torch.float32)
confusion_matrix: ValueError: not enough values to unpack (expected 4, got 1)
·
Error Note
sklearn의 confusion_matrix 함수를 다음과 같이 사용시 예측 라벨과 정답 라벨이 모두 일치할 때 발생하는 에러입니다. TN, FP, FN, TP = confusion_matrix(target, pred).ravel() 전체 에러 문구는 아래와 같습니다. ValueError: not enough values to unpack (expected 4, got 1) confusion_matrix는 아래처럼 예측 라벨과 정답 라벨이 모두 일치할 때 element 1개의 1차원 행렬을 반환합니다. >>> confusion_matrix([1, 1, 1, 1], [1, 1, 1, 1]).ravel() array([4], dtype=int64) 이런 경우에 반환 값은 1개인데 반환값을 받을 변수로 4개..
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (9969,) + inhomogeneous part.
·
Error Note
- 전체 에러 문구 ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (9969,) + inhomogeneous part. list 를 numpy 로 변환할 때 발생하는 에러입니다. x = [[1, 2], [3, 4, 5]] 처럼 list내에 서로 다른 길이의 리스트들이 존재하면 변환이 불가능하기 때문에 발생하는 에러입니다. - 해결방법 리스트들의 길이를 동일하게 맞춰주면 됩니다!
importerror: cannot import name 'builder' from 'google.protobuf.internal' (/opt/conda/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)
·
Error Note
- 전체 에러 문구 importerror: cannot import name 'builder' from 'google.protobuf.internal' (/opt/conda/lib/python3.10/site-packages/google/protobuf/internal/__init__.py) - 해결 방법 pip install --upgrade protobuf