-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[DOCS][ML][SPARK-11964] Add in Pipeline Import/Export Documentation #10179
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 all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
603b080
[DOCUMENTATION]Fixed Missing Type Import in Documentation
bllchmbrs 8fa67bf
Corrected SqlContext Import
bllchmbrs 0c391d9
[SPARK-11964]pipeline persistence=>ml-guide
bllchmbrs a6809bd
improved formatting, description
bllchmbrs dca6688
merge old commits
bllchmbrs eb3f99c
re-organization of docs + feedback
bllchmbrs 889437c
merge upstream
bllchmbrs bde19ad
feedback from @benFradet
bllchmbrs e1f27eb
update to the formatting
bllchmbrs 4a3b513
updated formatting, better location
bllchmbrs 8f4c922
merged upstream
bllchmbrs ad715ba
small changes for @jkbradley
bllchmbrs 66f692f
small change to revert
bllchmbrs 2d0d87c
small revert
bllchmbrs da91fb2
small revert
bllchmbrs c596edf
small revert again
bllchmbrs 9c7ad99
small changes, little by little!
bllchmbrs 86c9658
merge upstream
bllchmbrs 06f8c2a
revert end of page
bllchmbrs 10ccc22
removed 470 and 471
bllchmbrs 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
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 |
---|---|---|
|
@@ -192,6 +192,10 @@ Parameters belong to specific instances of `Estimator`s and `Transformer`s. | |
For example, if we have two `LogisticRegression` instances `lr1` and `lr2`, then we can build a `ParamMap` with both `maxIter` parameters specified: `ParamMap(lr1.maxIter -> 10, lr2.maxIter -> 20)`. | ||
This is useful if there are two algorithms with the `maxIter` parameter in a `Pipeline`. | ||
|
||
## Saving and Loading Pipelines | ||
|
||
Often times it is worth it to save a model or a pipeline to disk for later use. In Spark 1.6, a model import/export functionality was added to the Pipeline API. Most basic transformers are supported as well as some of the more basic ML models. Please refer to the algorithm's API documentation to see if saving and loading is supported. | ||
|
||
# Code examples | ||
|
||
This section gives code examples illustrating the functionality discussed above. | ||
|
@@ -455,6 +459,15 @@ val pipeline = new Pipeline() | |
// Fit the pipeline to training documents. | ||
val model = pipeline.fit(training) | ||
|
||
// now we can optionally save the fitted pipeline to disk | ||
model.save("/tmp/spark-logistic-regression-model") | ||
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. One more thought: It'd be cool to also demonstrate saving and loading "pipeline" (the unfit pipeline) above. |
||
|
||
// we can also save this unfit pipeline to disk | ||
pipeline.save("/tmp/unfit-lr-model") | ||
|
||
// and load it back in during production | ||
val sameModel = Pipeline.load("/tmp/spark-logistic-regression-model") | ||
|
||
// Prepare test documents, which are unlabeled (id, text) tuples. | ||
val test = sqlContext.createDataFrame(Seq( | ||
(4L, "spark i j k"), | ||
|
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.
Could you comment here telling users to refer to the algorithms' API documentation to see if the algorithm support save/load?