Processing math: 100%

분류 전체보기 29

lecture15 1교시 Transformer 기초

Transformer Seq2seq보다 성능, 속도 높아 관심 (Seq2seq은 RNN 사용해 순차적처리, 병렬처리 어려워 시간 오래걸림) self attention machanism만을 사용해 문장 인코딩, 번역 수행, 병렬처리 가능 Attention Q 번역 대상 단어의 hidden state , K 비교할 모든 단어들의 벡터, V Self attention은 순차없이 자신을 포함한 모든 단어와의 관계를 한번에 연산 Multi head attention 여러관점의 여러 attention을 병렬로 사용, 여러시각 주목(모호함 해소) Positional encoding Self attention을 사용하는 Transformer는 순차적이지 않기 때문에 어순을 파악 못하는 문제 발생 단어 벡터에 위치정보 ..

lecture11 1교시 RNN 기초2

Long short-term memory (LSTM) 중요정보가 희석되는 RNN 한계 극복 중요한 정보 선택 다음 state에 전달 (cell 정보저장, gate 정보 선택) forget gate: 불필요 정보 삭제 input gate: 새 input에서 중요정보 추출 candidate values: input 변형, 과거 state에 맞춤 new cell state: forget gate, input gate로 정보 갱신 output gate: cell state 추출 정보 양 정함 hidden state: cell state, output gate 에 의해 결정된 정보

lecture10 2교시 RNN 언어 모델링

다음 character 예측 import tensorflow as tf import numpy as np from tensorflow.contrib import rnn sentence = ("if you want to build a ship, don't drum up people together to " "collect wood and don't assign them tasks and work, but rather " "teach them to long for the endless immensity of the sea.") # 딕셔너리 생성 char_set = list(set(sentence)) char_dic = {w: i for i, w in enumerate(char_set)} print(char_..

lecture10 0교시 youtube 영상 크롤링

from pytube import YouTube import os import json def cln_txt(txt): return txt.replace('-', '').replace(' ', '_').replace('/', '~').replace('(', '').replace(')', '').replace('|','').replace('\\', '') def download_data(url, v_type='video/mp4', res=['1080p', '720p']): crawl_result = {'url': url} # url 딕셔너리 생성 yt = YouTube(url) # 영상정보 저장 streams = yt.streams # 스트림 crawl_result['title'] = yt.title # ..

lecture10 1교시 RNN 기초

RNN (Recurrent neural network) Sequential data(시계열 데이터) 등 연속적인 input 처리 위한 모델 input과 과거 데이터 조합, 생성, 갱신 hidden state로 weight mapping을 매번 새로운 input을 추가하여 수행 (누적) 모든 시점의 데이터를 포함한 마지막 데이터로 예측 수행 ht=f(xt|ht1)=tanh(Wxt+Uht1) (W, U hidden state로 맵핑하여 추가)

lecture09 1교시 word2vec 2

word2vec CBOW SG모델 한계 각 단어별로 모든 단어 입력 필요, 데이터 량 막대함 모든 단어의 확률값 연산 필요, 학습 layer 연산 부하 큼 Hierachical softmax 연산 부하를 줄이기위해 tree 구조 도입 트리 구조로 정리된 단어에 binary code(주소) 부여 트리 엣지에 확률값 부여, 최대화 되도록 학습 Negative sampling 정답이 아닌 모든 단어를 연산하면 부하큼 오답 단어(negative samples)가 일부만 포함되어도 학습을 반복하여 정답 추출 가능 오답 단어에 대한 연산 줄어듬 오답 단어는 5~15개 추천 오답 단어 추출은 출현 빈도가 높으면 더 많이 뽑히게 Sub sampling 빈도수에 기반하여 특정 단어 제외(관사 전치사 등) $P(w_i)=..

lecture09 0교시 파이썬 기초 연습문제

스택을 활용해서 문자열을 반전해보세요. def reverse_with_stack(input) s = Stack() … print(reverse_with_stack(“AI School”)) loohcS IA class Stack(object): def __init__(self): self.items = [] def isEmpty(self): return not bool(self.items) #bool 리스트 null일때 true def push(self, value): self.items.append(value) def size(self): return len(self.items) def __repr__(self): #프린트시 리스트안의 데이터 표시 return '{}'.format(self.items) ..

lecture08 2교시 word2vec 기초실습

from gensim.models.keyedvectors import KeyedVectors # 구글 뉴스 pretrained rate 로드, analogy task 실행 model = KeyedVectors.load_word2vec_format("./data/GoogleNews-vectors-negative300.bin.gz", binary=True, limit=30000) score, predictions = model.evaluate_word_analogies('./data/analogy_task.txt') print(model['apple']) # model.similarity 벡터 거리 계산 print("similarity between apple and fruit: {}".format(mode..

카테고리 없음 2021.03.30