👨🏻‍🏫IT 활동/인공지능교육 - NLP

    [NLP] Day 22 - KNN

    KNNhttps://nlp.stanford.edu/IR-book/newslides.html확률 모델을 이용할 것 이다.확률로 Text Classification을 할 것.분류를 추천에도 이용할 수 있다.No-Free-lunch : 데이터에 라벨을 스스로 붙여야한다.그 전에 확률에 대해 짚고 넘어가자.MLE ( Maximum Likelihood Estimation )빈도 추정과 / bayes를 이용한 방법이 있다.이항 분포를 따름log를 취하는 이유는 극한으로 보내는 것이 거의 관례인데, x&y가 정비례하게 증가하기에 사용한다.PAC learning : Probably approximate correction 에러의 범위를 줄이기 위해 시행 횟수를 늘리려고 하는 것이다. e, 와 N에 관계가 있다.MAP ..

    [NLP] Day 21 - 딥러닝 특강

    Deeplearning 특강바로 실습으로 넘어가자!Tensorflow & Keras의 기초에 대해 알아보자.Tensorflow¶In [1]:import tensorflow as tf In [4]:a = tf.constant(3.0) b = tf.constant(4.0) c = tf.constant(5.0) d=a*b+c print(d) Tensor("add_2:0", shape=(), dtype=float32) In [5]:# 노드와 엣지를 이용한 그래프를 그려 Session을 이용하여 출력하는 것. # 그래야 값이 출력됨. sess = tf.Session() sess.run(d) Out[5]:17.0Linear RegressionIn [24]:# 입력 및 모델 정의 W = tf.Variable(tf.r..

    [NLP] Day 20 - Project2

    Project 2비정형 데이터를 이용한 검색엔진가중치와 Similarity를 이용 In [2]:import os def getFileList(base='./', ext='.txt'): fileList = list() for file in os.listdir(base): if file.endswith(ext): # == if file.split('.')[-1] == ext: fileList.append('{0}/{1}'.format(base, file)) return fileList In [3]:# def getNewsRank(): # for file in os.listdir(base): # with open(file,encoding='utf-8') as f: # content = f.read() # re..

    [NLP] Day 18,19 - TF & IDF

    가중치 기법In [173]:collection = [ ("Document1", "This is a sample"), # a 가 중요 ("Document2","This is another sample"), # another 가 중요 ("Document2","This is not sample") # not 이 중요 ] query = "this is a sample" In [161]:# 전역변수 만들기 # in-memory (Hash-key값) # {단어1 : 포스팅위치, 단어2: 포스팅위치, ...} globalLexicon = dict() # [0:문서, 1:문서2, ...] globalDocument = list() # disk ( out memory ) # [0:(단어 idx, 문서 idx, 빈도, 다..

    [NLP] Day 16 - Index

    IndexIn [1]:from konlpy.tag import Kkma from nltk.tokenize import word_tokenize sentence = '오늘 날씨는 어제 날씨보다 안좋은거 같아요' In [2]:print(Kkma().pos(sentence)) [('오늘', 'NNG'), ('날씨', 'NNG'), ('는', 'JX'), ('어제', 'NNG'), ('날씨', 'NNG'), ('보다', 'JKM'), ('안', 'MAG'), ('좋', 'VA'), ('은', 'ETD'), ('거', 'NNB'), ('같', 'VA'), ('아요', 'EFN')] In [3]:for token in word_tokenize(sentence): # == sentence.split(): print(..