GithubHelp home page GithubHelp logo

tensorflow-nlp-tutorial-review's Introduction

Word to Vector(Word2Vec)

  1. 거대한 텍스트 코퍼스를 가져옵니다.
  2. 한 번에 한 단어씩 이동하면서 슬라이딩 창으로 텍스트를 살펴봅니다.각 단계에는 중심 단어와 문맥 단어(창 크기 이내 다른 단어)가 있습니다.
  3. 중심 단어의 경우, 문맥 단어의 확률을 계산합니다.
  4. 이러한 확률을 높이려면 벡터를 조정합니다.

image

# Leaky ReLU 함수

np.maximum(a*x, x) 에서 a = 0.1 ~ 1.0

image

소프트 맥스(SOFTMAX)

  • Softmax(소프트맥스)는 입력받은 값을 출력으로 0~1사이의 값으로 모두 정규화
  • 출력 값들의 총합은 항상 1이 되는 특성을 가진 함수
  • 분류하고 싶은 클래수의 수 만큼 출력으로 구성
  • 가장 큰 출력 값을 부여받은 클래스가 확률이 가장 높은 것으로 이용

image (https://miro.medium.com/v2/resize:fit:1400/0*J8gIAZofl6MlfLUK.jpeg)

자카드 유사도 (Jaccard Similarity)

자카드 유사도(Jaccard Similarity)는 두 집합 간의 유사도를 측정하는 방법 중 하나입니다. 이는 두 집합의 교집합 크기를 합집합 크기로 나누어 계산합니다. 수식으로 표현하면 다음과 같습니다.

$$ J(A, B) = \frac{|A \cap B|}{|A \cup B|} $$

여기서,

  • ( A )와 ( B )는 비교하고자 하는 두 집합입니다.
  • ( |A \cap B| )는 두 집합의 교집합의 크기입니다.
  • ( |A \cup B| )는 두 집합의 합집합의 크기입니다.

image

예제

두 집합 ( A )와 ( B )가 다음과 같다고 가정해봅시다:

  • ( A = {1, 2, 3} )
  • ( B = {2, 3, 4, 5} )

이 경우, 교집합과 합집합은 다음과 같이 계산됩니다:

  • ( A \cap B = {2, 3} )
  • ( A \cup B = {1, 2, 3, 4, 5} )

따라서 자카드 유사도는 다음과 같습니다: $$ J(A, B) = \frac{|A \cap B|}{|A \cup B|} = \frac{2}{5} = 0.4 $$

자카드 유사도는 0에서 1 사이의 값을 가지며, 1은 두 집합이 동일함을 의미하고 0은 두 집합이 공통 요소가 없음을 의미합니다.

TF-IDF

TF-IDF Example In order to fully understand how TF-IDF works, I will give you a concrete example. Let's assume that we have a collection of four documents as follows:

𝑑 1 d 1 ​ : "The sky is blue.

𝑑 2 d 2 ​ : "The sun is bright today."

𝑑 3 d 3 ​ : "The sun in the sky is bright."

𝑑 4 d 4 ​ : "We can see the shining sun, the bright sun."

Task: Determine the tf-idf scores for each term in each document.

Step1: Filter out the stopwords. After removing the stopwords, we have

𝑑 1 d 1 ​ : "sky blue

𝑑 2 d 2 ​ : "sun bright today"

𝑑 3 d 3 ​ : "sun sky bright"

𝑑 4 d 4 ​ : "can see shining sun bright sun"

Step2: Compute TF, therefore, we find document-word matrix and then normalize the rows to sum to 1.

image

image

tensorflow-nlp-tutorial-review's People

Contributors

jkm2000korea avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.