[ 
https://issues.apache.org/jira/browse/SPARK-1229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975315#comment-13975315
 ] 

Aliaksei Litouka commented on SPARK-1229:
-----------------------------------------

Well... I'm new to Spark so please correct me if I'm wrong. _predict_ methods 
declared in ClassificationModel and in KMeansModel accept an RDD\[Vector\] or a 
single Vector (not an array!). Each item of the RDD\[Vector\] contains a single 
observation for which we want to calculate a prediction, and each item of the 
Vector contains a single feature of an observation.

If we need to take a sample of an RDD and feed this sample to any of the train 
methods, we can use the _sample_ method instead of _takeSample_ . Actually, 
_takeSample_ calls _sample_ internally. However, these methods accept different 
parameters. If this is a problem, then I think it's possible to implement 
another version of the _sample_ method:

{code}
def sample(withReplacement: Boolean, num: Int, seed: Int): RDD[T]
{code}

Let me know if it makes sense.

> train on array (in addition to RDD)
> -----------------------------------
>
>                 Key: SPARK-1229
>                 URL: https://issues.apache.org/jira/browse/SPARK-1229
>             Project: Spark
>          Issue Type: Story
>          Components: MLlib
>            Reporter: Arshak Navruzyan
>
> since predict method accepts either RDD or Array for consistency so should 
> train.  (particularly since RDD.takeSample() returns Array)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to