본문 바로가기

2019년 혁신성장 청년인재 집중양성(빅데이터)/PYTHON 라이브러리

sklearn Doc2Vec 라이브러리 parameter

1
2
3
4
5
>>> from gensim.test.utils import common_texts
>>> from gensim.sklearn_api import D2VTransformer
>>>
>>> model = D2VTransformer(min_count=1, size=5)
>>> docvecs = model.fit_transform(common_texts)  # represent `common_texts` as vectors
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs
파라미터

 

https://radimrehurek.com/gensim/sklearn_api/d2vmodel.html

 

gensim: topic modelling for humans

Efficient topic modelling in Python

radimrehurek.com

 

 

 Scikit learn wrapper fScikit learn interface for Doc2Vec.or paragraph2vec modelz

 

파라미터(Parameters)

 

  • dm_mean (int {1,0}, optional) – If 0, use the sum of the context word vectors. If 1, use the mean. Only applies when dm_concat=0.

차원 평균  : 1 또는 0을 선택할 수 있음. 0의 경우 단어 벡터의 합을 이용함, 1의 경우 평균을 이용함. dm_concat 파라미터가 0일때만 적용가능 함.

 

  • dm (int {1,0}, optional) – Defines the training algorithm. If dm=1 - distributed memory (PV-DM) is used. Otherwise, distributed bag of words (PV-DBOW) is employed.

차원 : 알고리즘을 정의함. 1이라면, 분산 메모리가 적용되며, 0일 경우 분산 Bow가 적용됨 

  • dbow_words (int {1,0}, optional) – If set to 1 - trains word-vectors (in skip-gram fashion) simultaneous with DBOW doc-vector training, If 0, only trains doc-vectors (faster).

dbow_word : 1이라면, 스킵 그램에서의 단어 벡터를 DBOW의 문서 벡터와 동시에 학습함. 0일 경우 문서 벡터만을 학습하며, 더 빠르다.

 

  • dm_concat (int {1,0}, optional) – If 1, use concatenation of context vectors rather than sum/average. Note concatenation results in a much-larger model, as the input is no longer the size of one (sampled or arithmetically combined) word vector, but the size of the tag(s) and all words in the context strung together.

차원 연결 : 1이라면, 문서 벡터로서 합이나 평균을 사용하는 것이 아닌 연속 연결로 사용함. concatenation을 사용하면 훨씬 큰 모델이 만들어지며, 그 결과 인풋은 하나의 단어 벡터 사이즈가 아니게 된다.

 

  • dm_tag_count (int, optional) – Expected constant number of document tags per document, when using dm_concat mode.

차원 태그 수 : dm_concat 옵션을 사용할 때 사용되며, 문사당 사용되는 태그 수를 정의한다.

 

  • docvecs (Doc2VecKeyedVectors) – A mapping from a string or int tag to its vector representation. Either this or docvecs_mapfile MUST be supplied

독벡 :?

 

  • docvecs_mapfile (str, optional) – Path to a file containing the docvecs mapping. If docvecs is None, this file will be used to create it.

독벡 맵파일 : 독벡의 모델을 가지고 있는 파일의 경로, 없다면 만들어진다.

  • comment (str, optional) – A model descriptive comment, used for logging and debugging purposes.

코멘트 : 로깅과 디버깅 목적으로 사용되는 모델 설명

  • trim_rule (function ((str, int, int) -> int), optional) – Vocabulary trimming rule that accepts (word, count, min_count). Specifies whether certain words should remain in the vocabulary (gensim.utils.RULE_KEEP), be trimmed away (gensim.utils.RULE_DISCARD), or handled using the default (gensim.utils.RULE_DEFAULT). If None, then gensim.utils.keep_vocab_item() will be used.

트림 룰 : 일종의 불용어를  제거 시켜주는 규칙

 

size (int, optional) – Dimensionality of the feature vectors.

 

사이즈 : 벡터의 차원

  • alpha (float, optional) – The initial learning rate.

알파 : 초기 학습률 값

  • window (int, optional) – The maximum distance between the current and predicted word within a sentence.

창 : 하나의 벡터를 만드는 데 몇 개의 백터까지 반영 되는지 결정 

  • min_count (int, optional) – Ignores all words with total frequency lower than this.

최소 빈도수 : 일정 빈도수 이하 무시

  • max_vocab_size (int, optional) – Limits the RAM during vocabulary building; if there are more unique words than this, then prune the infrequent ones. Every 10 million word types need about 1GB of RAM. Set to None for no limit.

최대 단어장 사이즈 : 단어장이 만들어지는 동안 램을 제한. 제한을 넘어가면, 빈도수가 적은 것을 버림. 

  • sample (float, optional) – The threshold for configuring which higher-frequency words are randomly downsampled, useful range is (0, 1e-5).

샘플 : 빈도수가 많은 단어는 다운 셈플링 됨. 

  • seed (int, optional) – Seed for the random number generator. Initial vectors for each word are seeded with a hash of the concatenation of word + str(seed). Note that for a fully deterministically-reproducible run, you must also limit the model to a single worker thread (`workers=1`), to eliminate ordering jitter from OS thread scheduling. In Python 3, reproducibility between interpreter launches also requires use of the PYTHONHASHSEED environment variable to control hash randomization.

시드 : 임의숫자 발생기. 시드를 생성함으로써, 반복할 수 있게 됨. 

  • workers (int, optional) – Use this many worker threads to train the model. Will yield a speedup when training with multicore machines.

워커 : 병렬 처리 하여 빠르게 함.

  • min_alpha (float, optional) – Learning rate will linearly drop to min_alpha as training progresses.

최소 알파 값 : 학습 하는 동안, 최소 알파값까지 학습함.

  • hs (int {1,0}, optional) – If 1, hierarchical softmax will be used for model training. If set to 0, and negative is non-zero, negative sampling will be used.

계급 소프트맥스 : 1이면, 계급소프트 맥스가 사용됨. 0이면, 부정 샘플링이 사용됨

  • negative (int, optional) – If > 0, negative sampling will be used, the int for negative specifies how many “noise words” should be drawn (usually between 5-20). If set to 0, no negative sampling is used.

부정 : 0보다 크면, 부정 샘플링이 사용됨. 이 숫자는, 노이즈 워드? 의 수?에 대해 특정함.

  • cbow_mean (int, optional) – Same as dm_mean, unused.

cbow 평균 : 사용되지 않음

  • hashfxn (function (object -> int), optional) – A hashing function. Used to create an initial random reproducible vector by hashing the random seed.

해쉬퐁션 : 해쉬 기능, 랜덤 시드를 사용함으로써, 재사용 가능한 임의 벡터를 만들어 냄

  • iter (int, optional) – Number of epochs to iterate through the corpus.

반복 : 몇 번 반복 할 것인지를 결정

  • sorted_vocab (bool, optional) – Whether the vocabulary should be sorted internally.

정렬 : 내부적으로 정렬되는 것을 지정함

  • batch_words (int, optional) – Number of words to be handled by each job.

배치 문자 : 얼마나 많은 문자가 하나의 작업에서 수행될지 결정함.