Skip to content

[SPARK-6083] [MLLib] [DOC] Make Python API example consistent in NaiveBayes#4834

Closed
MechCoder wants to merge 2 commits into
apache:masterfrom
MechCoder:spark-6083
Closed

[SPARK-6083] [MLLib] [DOC] Make Python API example consistent in NaiveBayes#4834
MechCoder wants to merge 2 commits into
apache:masterfrom
MechCoder:spark-6083

Conversation

@MechCoder

Copy link
Copy Markdown
Contributor

No description provided.

@SparkQA

SparkQA commented Feb 28, 2015

Copy link
Copy Markdown

Test build #28130 has started for PR 4834 at commit 0c5fe03.

  • This patch merges cleanly.

@MechCoder

Copy link
Copy Markdown
Contributor Author

cc: @mengxr Would you be able to verify this?

@MechCoder

Copy link
Copy Markdown
Contributor Author

Hmm. I get an a accuracy of zero for the given example. Not sure where I'm going wrong though :(

@SparkQA

SparkQA commented Feb 28, 2015

Copy link
Copy Markdown

Test build #28130 has finished for PR 4834 at commit 0c5fe03.

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

@AmplabJenkins

Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28130/
Test PASSed.

@MechCoder

Copy link
Copy Markdown
Contributor Author

I changed the randomSplit seed and it works better. It should look good now.

@SparkQA

SparkQA commented Mar 1, 2015

Copy link
Copy Markdown

Test build #28139 has started for PR 4834 at commit 65bbbe9.

  • This patch merges cleanly.

@SparkQA

SparkQA commented Mar 1, 2015

Copy link
Copy Markdown

Test build #28139 has finished for PR 4834 at commit 65bbbe9.

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

@AmplabJenkins

Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28139/
Test PASSed.

@mengxr

mengxr commented Mar 1, 2015

Copy link
Copy Markdown
Contributor

@MechCoder Thanks for the update! We only have 6 lines in sample_naive_bayes_data.txt. That's why some random seed would give bad splits.

@MechCoder

Copy link
Copy Markdown
Contributor Author

Great. Do you have any more comments?

Comment thread docs/mllib-naive-bayes.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can define a parse function to make the code more readable. Btw, we use 4 space indentation in Python, following PEP8.

def parseLine(line):
    parts = line.split(',')
    label = float(parts[0])
    features = Vector.dense([float(x) for x in parts[1].split(' ')])
    return LabeledPoint(label, features)

data = sc.textFile('data/mllib/sample_naive_bayes_data.txt').map(parseLine)

@MechCoder

Copy link
Copy Markdown
Contributor Author

@mengxr fixed !

@SparkQA

SparkQA commented Mar 1, 2015

Copy link
Copy Markdown

Test build #28152 has started for PR 4834 at commit 1cdd7b5.

  • This patch merges cleanly.

@mengxr

mengxr commented Mar 1, 2015

Copy link
Copy Markdown
Contributor

LGTM.

@SparkQA

SparkQA commented Mar 1, 2015

Copy link
Copy Markdown

Test build #28152 has finished for PR 4834 at commit 1cdd7b5.

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

@AmplabJenkins

Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28152/
Test PASSed.

asfgit pushed a commit that referenced this pull request Mar 2, 2015
…eBayes

Author: MechCoder <manojkumarsivaraj334@gmail.com>

Closes #4834 from MechCoder/spark-6083 and squashes the following commits:

1cdd7b5 [MechCoder] Add parse function
65bbbe9 [MechCoder] [SPARK-6083] Make Python API example consistent in NaiveBayes

(cherry picked from commit 3f00bb3)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
@asfgit asfgit closed this in 3f00bb3 Mar 2, 2015
@mengxr

mengxr commented Mar 2, 2015

Copy link
Copy Markdown
Contributor

Merged into master and branch-1.3. Thanks!

@MechCoder MechCoder deleted the spark-6083 branch March 2, 2015 02:54
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.

4 participants