[Numpy,Matplotlib] 3.시각화matplotlib.pyplot as plt
https://rfriend.tistory.com/408 에 seaborn와 plot 그래프들에 대한 예제가 많이 있음 참조만 할것 In [1]: import numpy as np import matplotlib.pyplot as plt %matplotlib inline In [2]: data = np.random.randn(50).cumsum() data Out[2]: array([-1.70416886, -2.20382106, -2.70563343, -4.28915986, -3.9987641 , -4.24362761, -5.27902219, -8.15694697, -7.9827752 , -7.80333919, -5.88645842, -3.6525847 , -5.13716405, -5.36678818, ..
2021. 6. 18.
[Numpy,Matplotlib] 2.Numpy는 차원을 늘리고 줄일수 있다
In [7]: import numpy as np arr=np.array([[1,2,3],[1,2,3]]) arr.shape Out[7]: (2, 3) In [8]: arr=np.expand_dims(arr,-1) #내부값은 유지하고 차원 수를 늘리고 싶을대 arr #-1을 하면 차원수와 값의 위치가 변경된다 Out[8]: array([[[1], [2], [3]], [[1], [2], [3]]]) In [9]: arr.shape Out[9]: (2, 3, 1) In [10]: #0으로 채워진 np.array zeros = np.zeros([3,3]) zeros Out[10]: array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]) In [11]: zeros=np.zeros..
2021. 6. 18.
[Numpy,Matplotlib] 1. 배열다루기+시각화의 기초
In [2]: import tensorflow as tf In [3]: tf.__version__ Out[3]: '2.4.1' In [4]: import sys print(sys.version) 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] In [5]: import torch In [6]: torch.rand(10) Out[6]: tensor([0.3455, 0.7188, 0.9561, 0.4839, 0.4847, 0.4576, 0.0298, 0.0426, 0.0475, 0.4781]) In [7]: import numpy as np In [8]: arr = np.array(5) arr.shape Out[8]: () ..
2021. 6. 18.
[Tensorflow] 1. Tensorflow의 기본 Tensor
In [1]: import numpy as np import tensorflow as tf In [2]: # Tensor 생성 [1,2,3] Out[2]: [1, 2, 3] In [3]: [[1,2,3],[4,5,6]] Out[3]: [[1, 2, 3], [4, 5, 6]] In [4]: arr= np.array([1,2,3]) arr.shape Out[4]: (3,) In [5]: arr=np.array([[1,2,3],[4,5,6]]) arr.shape Out[5]: (2, 3) In [6]: #list와 tensor는 다르다 #list1=[1,2,3] tf.constant([1,2,3]) #tf.constant(list1) Out[6]: In [9]: #Array를 tesnfor로 변경 array=..
2021. 6. 17.