본문 바로가기

Computer Technology 기록부30

머신러닝을 위한 sklearn 라이브러리 기능 이용 In [1]: import numpy as np import matplotlib.pyplot as plt r = np.random.RandomState(10) x = 10 * r.rand(100) y = 2 * x - 3 * r.rand(100) plt.scatter(x,y) Out[1]: In [6]: x #array st. (1,100) x.shape Out[6]: array([7.71320643, 0.20751949, 6.33648235, 7.48803883, 4.98507012, 2.24796646, 1.98062865, 7.60530712, 1.69110837, 0.88339814, 6.85359818, 9.53393346, 0.03948266, 5.12192263, 8.12620962, 6.1.. 2022. 7. 5.
DecisionTreeClassifier 이용한 Data classification DecisionTreeClassifier 이용한 Data classification¶ In [4]: from sklearn.datasets import load_iris iris = load_iris() print(dir(iris)) # dir()는 객체가 어떤 변수와 메서드를 가지고 있는지 나열함 ['DESCR', 'data', 'data_module', 'feature_names', 'filename', 'frame', 'target', 'target_names'] In [5]: iris_data = iris.data print(iris_data.shape) #shape는 배열의 형상정보.. 2022. 7. 5.
LSTM 모델을 이용한 인공지능 작사가 구축 작사가 인공지능 만들기¶ Step 1. 필요 모듈 임포트 및 데이터 가져오기¶ In [1]: import os, re import numpy as np import tensorflow as tf import glob import os from sklearn.model_selection import train_test_split txt_file_path = os.getenv('HOME')+'/aiffel/lyricist/data/lyrics/*' txt_list = glob.glob(txt_file_path) raw_corpus = [] # 여러개의 txt 파일을 모두 읽어서 raw_corpus 에 담습니다. for txt_file in txt_list: with open(txt_file, "r") as .. 2022. 7. 5.
MNIST Dataset 이용한 CNN 모델 구축 MNIST Dataset 이용한 CNN 모델 구축¶ In [2]: # from IPython.core.display import display, HTML # display(HTML("")) # ! pip install tqdm # from tqdm import tqdm_notebook In [2]: import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib.pyplot as plt import os print(tf.__version__) # Tensorflow의 버전을 출력 mnist = keras.datasets.mnist # MNIST 데이터를 로드. 다운로드하지 않았다면 다운로드까지 자동으로 진행됩.. 2022. 7. 5.
Basic of C programming Term - Preprocessor instruction : same with import ~~ in Python - scope : sector of statements for Definition - Variable declaration : int a; (declare the type of each variables) - assignment : a = 10 (assignment data in variable) - call or invoke : printf(~~~) - compiler - translate source code to object code - linker - linking every object files and library code to make exe file - Library code.. 2022. 6. 14.
Introduction of C - Why we should learn C Why we have to learn C? 1. We can learn computer memory architecture by learning and using C. 2. Almost every computer science languages are based on C. So studying C will help to encourage your other language ability. Basic architecture of Computer CPU(Central processing unit) Memory(RAM) All data will be lost when we turn off our PC - For speed Graphics Card GPU - main computer in graphics car.. 2022. 2. 28.
Regularization과 Normalization 모델의 성능을 높이고, 오버피팅을 방지하는 Regularization과 Nomalizaton을 알아보자 Regularization : 정칙화 오버피팅을 해결하기 위한 방법 L1, L2 Regularization, Dropout, Batch normalization 등이 있음 모델이 train set의 정답을 맞히지 못하도록 오버피팅을 방해(train loss가 증가) 하는 역할 train loss는 약간 증가하지만 결과적으로, validation loss나 최종적인 test loss를 감소시키려는 목적 Normalization : 정규화 데이터의 형태를 좀 더 의미 있게, 혹은 트레이닝에 적합하게 전처리하는 과정 데이터를 z-score로 바꾸거나 minmax scaler를 사용하여 0과 1사이의 값으로 .. 2022. 2. 11.
딥러닝 레이어 이해하기 Embedding Layer, Recurrent layer 자연어 처리 분야에 잘 이용되는 embedding, recurrent layer에 대해 알아보자 단어의 희소 표현(Sparse Representation) 벡터의 특정 차원에 단어 혹은 의미를 직접 매핑하는 방식 예) 사과: [ 0, 0 ] , 바나나: [ 1, 1 ] , 배: [ 0, 1 ] 일떄, 첫 번째 요소는 모양(0:둥글다, 1:길쭉하다)을 나타냄 두 번째 모양은 색상(0:빨강, 1:노랑)을 나타냄 배는 모양 기준으로는 사과와 가깝고, 색상 기준으로는 바나나와 가깝다는 것을 표현할 수 있음 단어의 분산 표현(Distributed Representation) 분포 가설(distribution hypothesis)? : 유사한 맥락에서 나타나는 단어는 그 의미도 비슷하다 맥락? - 좌우에 출현하는 .. 2022. 2. 9.
딥러닝 레이어 이해하기 linear, Convolution 딥러닝 모델 속 각 레이어(Linear, Convolution)의 동작 방식을 이해하고, 텐서플로우로 정의해보자 데이터 이미지 데이터 표기법 - Channel, Width, Height의 이니셜로 (C, W, H), (W, H, C)와 같이 표기 Layer? 하나의 물체가 여러 개의 논리적인 객체들로 구성되어 있는 경우, 이러한 각각의 객체를 layer라 칭함 Linear layer? (Fully Connected Layer, Feedforward Neural Network, Multilayer Perceptrons, Dense Layer... 등 다양한 이름으로 불림) 역할 - 선형 변환을 이용해 데이터를 특정 차원으로 변환 저차원화 : 데이터 집약 고차원화 : 데이터 더 풍부하게 표현 변환 코드(Te.. 2022. 2. 8.