-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11940][PYSPARK][ML] Python API for ml.clustering.LDA PR2 #12723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c0367f4
[SPARK-11940][PYSPARK] Python API for ml.clustering.LDA
zjffdu 417de17
address comments
zjffdu 66f265f
code style fix
zjffdu 09d5ca7
address comments
zjffdu 4f9bdaa
added type converter and used set instead of paramMap directly
jkbradley 0d12924
remaining PR cleanups, plus fixing use of :py:attr:
jkbradley 4f807e8
Added persistence to LDA in Python
jkbradley 46979e8
Added keepLastCheckpoint Param to python LDA. Added Experimental, in…
jkbradley f37c1c1
added save/load to doc test in Python LDA
jkbradley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added persistence to LDA in Python
- Loading branch information
commit 4f807e82cf4366ea83557aa6060b14245c7f5764
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -529,7 +529,7 @@ def estimatedDocConcentration(self): | |
| return self._call_java("estimatedDocConcentration") | ||
|
|
||
|
|
||
| class DistributedLDAModel(LDAModel): | ||
| class DistributedLDAModel(LDAModel, JavaMLReadable, JavaMLWritable): | ||
| """ | ||
| Distributed model fitted by :py:class:`LDA`. | ||
| This type of model is currently only produced by Expectation-Maximization (EM). | ||
|
|
@@ -542,6 +542,12 @@ class DistributedLDAModel(LDAModel): | |
|
|
||
| @since("2.0.0") | ||
| def toLocal(self): | ||
| """ | ||
| Convert this distributed model to a local representation. This discards info about the | ||
| training dataset. | ||
|
|
||
| WARNING: This involves collecting a large :py:func:`topicsMatrix` to the driver. | ||
| """ | ||
| return LocalLDAModel(self._call_java("toLocal")) | ||
|
|
||
| @since("2.0.0") | ||
|
|
@@ -584,7 +590,7 @@ def getCheckpointFiles(self): | |
| return self._call_java("getCheckpointFiles") | ||
|
|
||
|
|
||
| class LocalLDAModel(LDAModel): | ||
| class LocalLDAModel(LDAModel, JavaMLReadable, JavaMLWritable): | ||
| """ | ||
| Local (non-distributed) model fitted by :py:class:`LDA`. | ||
| This model stores the inferred topics only; it does not store info about the training dataset. | ||
|
|
@@ -594,7 +600,8 @@ class LocalLDAModel(LDAModel): | |
| pass | ||
|
|
||
|
|
||
| class LDA(JavaEstimator, HasFeaturesCol, HasMaxIter, HasSeed, HasCheckpointInterval): | ||
| class LDA(JavaEstimator, HasFeaturesCol, HasMaxIter, HasSeed, HasCheckpointInterval, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @inherit_doc |
||
| JavaMLReadable, JavaMLWritable): | ||
| """ | ||
| Latent Dirichlet Allocation (LDA), a topic model designed for text documents. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
@@ -768,7 +775,7 @@ def setLearningOffset(self, value): | |
|
|
||
| >>> algo = LDA().setLearningOffset(100) | ||
| >>> algo.getLearningOffset() | ||
| 100 | ||
| 100.0 | ||
| """ | ||
| return self._set(learningOffset=value) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. note:: Experimental