Skip to content

[SPARK-16140][MLlib][SparkR][Docs] Group k-means method in generated R doc #13921

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
wants to merge 8 commits into from

Conversation

keypointt
Copy link
Contributor

@keypointt keypointt commented Jun 27, 2016

https://issues.apache.org/jira/browse/SPARK-16140

What changes were proposed in this pull request?

Group the R doc of spark.kmeans, predict(KM), summary(KM), read/write.ml(KM) under Rd spark.kmeans. The example code was updated.

How was this patch tested?

Tested on my local machine

And on my laptop jekyll build is failing to build API docs, so here I can only show you the html I manually generated from Rd files, with no CSS applied, but the doc content should be there.

screenshotkmeans

@SparkQA
Copy link

SparkQA commented Jun 27, 2016

Test build #61294 has finished for PR 13921 at commit 1228483.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr
Copy link
Contributor

mengxr commented Jun 27, 2016

@junyangq Could you help review this PR? Thanks!

@junyangq
Copy link
Contributor

It would be better to group write.ml (KM) into the doc as well. Also please include a full screenshot of the doc page.

#'
#' # save fitted model to input path
#' path <- "path/to/model"
#' write.ml(model, path)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @junyangq , isn't it write.ml (KM) you are talking about?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, can you modify the doc of write.ml method for KM to bring it to the same page as other KM methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry I see what you mean now, you mean bring it to the Usage section of this page, right? I'll try to do it

@keypointt
Copy link
Contributor Author

I just updated the screenshot in PR description

@SparkQA
Copy link

SparkQA commented Jun 27, 2016

Test build #61328 has finished for PR 13921 at commit 6a67a49.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@junyangq
Copy link
Contributor

That looks better now. Two more comments

@keypointt
Copy link
Contributor Author

could you please be more specific on compact? like what should be changed then? I'm not getting it completely

I'm removing the duplicate arguments now

@@ -266,9 +266,9 @@ setMethod("summary", signature(object = "NaiveBayesModel"),
return(list(apriori = apriori, tables = tables))
})

#' Fit a k-means model
#' K-Means Model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K-Means Clustering Model

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I actually meant the description could be more like plain sentences, rather than bullet points.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears as the title, like in Generalized Linear Models.

@mengxr
Copy link
Contributor

mengxr commented Jun 27, 2016

@keypointt For quicker tests, you can run R/create-docs.sh and then check the html doc under R/pkg/html. It would be much faster than jekyll build.

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61331 has finished for PR 13921 at commit 1f4ef90.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61332 has finished for PR 13921 at commit aeface5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@keypointt
Copy link
Contributor Author

@junyangq oh I got it thanks
@mengxr I just realized the jekyll build is just copying over whatever under R/pkg/html/, thanks for the tip

@mengxr
Copy link
Contributor

mengxr commented Jun 28, 2016

I just merged #13927. So please fetch and merge the latest master if you want to push an update to avoid merge conflict (hopefully none).

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61347 has finished for PR 13921 at commit 426c659.

  • This patch fails some tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@keypointt
Copy link
Contributor Author

OK doing it now

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61348 has finished for PR 13921 at commit 70c312f.

  • This patch fails some tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ShowFunctionsCommand(

@mengxr
Copy link
Contributor

mengxr commented Jun 28, 2016

I think the error was because this PR left predict, write.ml, etc documented without title. So this PR has to be combined with SPARK-16144. Basically, let us add some doc to the function declarations under generics.R.

cc: @yinxusen

@keypointt
Copy link
Contributor Author

hi @mengxr I tried to modifiy in generics.R

#' @rdname spark.kmeans
#' @export
setGeneric("spark.kmeans", function(data, formula, ...) { standardGeneric("spark.kmeans") })

tried many different ways but still not working, since I'm not familiar with R docs, maybe here I need your help so that it's not blocking the other tickets.

How to add Sections \title, and \name? I guess it's because both algorithms are trying to define a predict or write.ml

@yinxusen
Copy link
Contributor

yinxusen commented Jun 28, 2016

@keypointt You need to add titles for predict and write.ml. Like the first line below.

#' This is a title for write.ml
#' @rdname write.ml
#' @export
setGeneric("write.ml", function(object, path, ...) { standardGeneric("write.ml") })

@keypointt
Copy link
Contributor Author

oh I see, thanks a lot

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61388 has finished for PR 13921 at commit 6fa1b60.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member

Actually don't do this?

#' This is a title for write.ml
#' @rdname write.ml
#' @export
setGeneric("write.ml", function(object, path, ...) { standardGeneric("write.ml") })

it will create a dummy page with no content for write.ml. And generally we don't put more than @Rdname and @export in generics.R - it is harder to manage from there.

I also was thinking about the discoverability of "write.ml", "predict" and so on in the doc. I think it is better to have full page for "write.ml" and then link to write.ml(KM), write.ml(GLM) etc from there.

@keypointt
Copy link
Contributor Author

I vote for dis-coverability of "write.ml", "predict"

@felixcheung
Copy link
Member

And to elaborate, the reason why it is complaining is because the line in generics.R is the only reference to @Rdname write.ml. To fix, you could either change that to @Rdname spark.kmeans (which doesn't make sense because there are multiple implementation of write.ml for different model), or have an actual @Rdname write.ml block in mllib.R - this also helps to redirect to pages on other mllib models in the event someone is looking for write.ml and doesn't know to look in spark.kmeans for write.ml.

@keypointt
Copy link
Contributor Author

keypointt commented Jun 28, 2016

if we are to have an actual @Rdname write.ml block in mllib.R, then it has to be enforced to all documentation stories under https://issues.apache.org/jira/browse/SPARK-16090, to remove individual write.ml and predict of each model

I just notice that read.ml has its own page, but not write.ml, to make both consistent, more work is needed here. Below is what it is like for current code.

write.ml

screen shot 2016-06-28 at 12 53 00 pm

read.ml

screen shot 2016-06-28 at 12 52 49 pm

@mengxr
Copy link
Contributor

mengxr commented Jun 28, 2016

@keypointt Could you add seealso links to the generic predict and write.ml doc?

@felixcheung I think it is useful to have a page for the generic predict and write.ml. We just need to add some links to them so they do provide some information. Btw, is it necessary to define predict under generics.R? Is it a common practice in R packages?

@keypointt
Copy link
Contributor Author

sure, I tried

#' @seealso \link{predict}, \link{read.ml}, \link{write.ml}

and it's like below for spark.kmeans page, is this what you mean?
screen shot 2016-06-28 at 1 21 25 pm

But if I remove the previously added title in generics.R, then errors still pop up

@SparkQA
Copy link

SparkQA commented Jun 28, 2016

Test build #61410 has finished for PR 13921 at commit 402026c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr
Copy link
Contributor

mengxr commented Jun 29, 2016

The grouping of k-means methods LGTM. So I'm merging this into master and branch-2.0 and leave the remaining issues to SPARK-16144. Thanks!

@asfgit asfgit closed this in 8c9cd0a Jun 29, 2016
asfgit pushed a commit that referenced this pull request Jun 29, 2016
…R doc

https://issues.apache.org/jira/browse/SPARK-16140

## What changes were proposed in this pull request?

Group the R doc of spark.kmeans, predict(KM), summary(KM), read/write.ml(KM) under Rd spark.kmeans. The example code was updated.

## How was this patch tested?

Tested on my local machine

And on my laptop `jekyll build` is failing to build API docs, so here I can only show you the html I manually generated from Rd files, with no CSS applied, but the doc content should be there.

![screenshotkmeans](https://cloud.githubusercontent.com/assets/3925641/16403203/c2c9ca1e-3ca7-11e6-9e29-f2164aee75fc.png)

Author: Xin Ren <iamshrek@126.com>

Closes #13921 from keypointt/SPARK-16140.

(cherry picked from commit 8c9cd0a)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
asfgit pushed a commit that referenced this pull request Jul 11, 2016
## What changes were proposed in this pull request?

From SPARK-16140/PR #13921 - the issue is we left write.ml doc empty:
![image](https://cloud.githubusercontent.com/assets/8969467/16481934/856dd0ea-3e62-11e6-9474-e4d57d1ca001.png)

Here's what I meant as the fix:
![image](https://cloud.githubusercontent.com/assets/8969467/16481943/911f02ec-3e62-11e6-9d68-17363a9f5628.png)

![image](https://cloud.githubusercontent.com/assets/8969467/16481950/9bc057aa-3e62-11e6-8127-54870701c4b1.png)

I didn't realize there was already a JIRA on this. mengxr yanboliang

## How was this patch tested?

check doc generated.

Author: Felix Cheung <felixcheung_m@hotmail.com>

Closes #13993 from felixcheung/rmllibdoc.

(cherry picked from commit 7f38b9d)
Signed-off-by: Shivaram Venkataraman <shivaram@cs.berkeley.edu>
asfgit pushed a commit that referenced this pull request Jul 11, 2016
## What changes were proposed in this pull request?

From SPARK-16140/PR #13921 - the issue is we left write.ml doc empty:
![image](https://cloud.githubusercontent.com/assets/8969467/16481934/856dd0ea-3e62-11e6-9474-e4d57d1ca001.png)

Here's what I meant as the fix:
![image](https://cloud.githubusercontent.com/assets/8969467/16481943/911f02ec-3e62-11e6-9d68-17363a9f5628.png)

![image](https://cloud.githubusercontent.com/assets/8969467/16481950/9bc057aa-3e62-11e6-8127-54870701c4b1.png)

I didn't realize there was already a JIRA on this. mengxr yanboliang

## How was this patch tested?

check doc generated.

Author: Felix Cheung <felixcheung_m@hotmail.com>

Closes #13993 from felixcheung/rmllibdoc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants