[Pytorch] torch 유용한 함수 정리하기
·
분석 Python/Pytorch
유용한 함수들을 발견하게 되면 정리해보기 개인적으로 중요하다고 생각하는 것에 ★ 표시 import torch import numpy as np Function 1 — torch.tensor t1 = torch.tensor([[21,39],[31,30],[23,43],[11,46],[26,46],[31,25],[21,38],[22,39],[22,19],[18, 14]]) t1 t2 = torch.tensor([]) t2 t2.size() Function 2 — torch.from_numpy a1 = np.array([[1,2,3],[4,5,6]]) a1.dtype t1 = torch.from_numpy(a1) t1.dtype Hight_Weight = np.array([[161,67],[154,76],[1..
[Python] 결측치 시각화 missingno 사용하기
·
분석 Python/Visualization
결측치에 대해서 시각적으로 보고 싶을 때 missingno가 쓸만한 것 같다. 해당 패키지를 자주 쓸것 같아서 간단하게 함수화를 해봤다. 보통 Train , Test를 나누니 그것을 기준으로 그려보는 것을 해봤다. import missingno as msno import matplotlib.pyplot as plt def msno_vis_train_test(train , test , graph_type = "bar" , fig_kws = {"figsize" : (20,5)}) : fig , ax = plt.subplots(1,2,figsize=fig_kws.get("figsize", (20,5)) ) axes = ax.flatten() if graph_type == "bar" : msno.bar(trai..
[ Python ] 파이썬 함수 argument 정보 가져오기
·
분석 Python/구현 및 자료
파이썬 내부에서 argument를 어떤 것을 넣는지 다 가져오고 싶을 때가 있다. 그래서 이러한 문제를 inspect 함수로 해결하는 것을 알 수 있었다. import inspect def a(a=5,b=5) : frame = inspect.currentframe() args, _, _, values = inspect.getargvalues(frame) del values["frame"] print(args , values) a(5,2) import inspect class Argument(object) : def __init__(self,name) : self.name= "go" def test(self, a=5,b=5, **kwargs) : frame = inspect.currentframe() ar..

AI 도구

AI 도구 사이드 패널

아래 AI 서비스 중 하나를 선택하여 블로그를 보면서 동시에 사용해보세요.

API 키를 입력하세요API 키를 저장하려면 저장 버튼을 클릭하세요API 키가 저장되었습니다
API 키를 입력하세요API 키를 저장하려면 저장 버튼을 클릭하세요API 키가 저장되었습니다
API 키를 입력하세요API 키를 저장하려면 저장 버튼을 클릭하세요API 키가 저장되었습니다
URL과 모델을 입력하세요설정을 저장하려면 저장 버튼을 클릭하세요설정이 저장되었습니다