Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tuhlbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
User expired
tuhlbox
Commits
58780227
Commit
58780227
authored
3 years ago
by
Benjamin Murauer
Browse files
Options
Downloads
Patches
Plain Diff
clearified doc2vec algorithm parameter
parent
b0a9b116
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tuhlbox/doc2vec.py
+12
-4
12 additions, 4 deletions
tuhlbox/doc2vec.py
with
12 additions
and
4 deletions
tuhlbox/doc2vec.py
+
12
−
4
View file @
58780227
...
...
@@ -46,7 +46,7 @@ class Doc2VecTransformer(TransformerMixin, BaseEstimator):
alpha
:
float
=
0.025
,
min_alpha
:
float
=
0.00025
,
min_count
:
int
=
2
,
distributed_memory
:
int
=
1
,
algorithm
:
str
=
"
dm
"
,
workers
:
int
=
1
,
):
"""
...
...
@@ -59,24 +59,32 @@ class Doc2VecTransformer(TransformerMixin, BaseEstimator):
alpha: alpha of the gensim model
min_alpha: min_alpha of the gensim model
min_count: min number of occurrences for each word
distributed_memory
: whether to use distributed memory
model or not
algorithm
: whether to use distributed memory
(
"
dm
"
) or distributed bag of words (
"
dbow
"
)
workers: number of threads
"""
valid_algorithms
=
{
"
dm
"
:
1
,
"
dbow
"
:
0
,
}
if
algorithm
not
in
valid_algorithms
:
raise
Exception
(
"
invalid algorithm: {} - valid algorithms are: {}
"
.
format
(
algorithm
,
valid_algorithms
.
keys
()))
self
.
learning_rate
=
learning_rate
self
.
epochs
=
epochs
self
.
vector_size
=
vector_size
self
.
alpha
=
alpha
self
.
min_alpha
=
min_alpha
self
.
min_count
=
min_count
self
.
distributed_memory
=
distributed_memory
self
.
workers
=
workers
self
.
algorithm
=
algorithm
self
.
model
=
Doc2Vec
(
vector_size
=
vector_size
,
alpha
=
alpha
,
min_alpha
=
min_alpha
,
min_count
=
min_count
,
dm
=
distributed_memory
,
dm
=
valid_algorithms
[
algorithm
]
,
workers
=
workers
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment