Re: Writing collection to file error

2014-11-24 Thread Akhil Das
esident > > > > Markit > > > > Green Boulevard > > B-9A, Tower C > > 3rd Floor, Sector - 62, > > Noida 201301, India > > +91 120 611 8274 Office > > > > *From:* Akhil Das [mailto:ak...@sigmoidanalytics.com] > *Sent:* Monday, November 24,

RE: Writing collection to file error

2014-11-24 Thread Saurabh Agrawal
Boulevard B-9A, Tower C 3rd Floor, Sector - 62, Noida 201301, India +91 120 611 8274 Office From: Akhil Das [mailto:ak...@sigmoidanalytics.com] Sent: Monday, November 24, 2014 5:55 PM To: Saurabh Agrawal Cc: user@spark.apache.org Subject: Re: Writing collection to file error Hi Saurabh, Here your

Re: Writing collection to file error

2014-11-24 Thread Akhil Das
Hi Saurabh, Here your ratesAndPreds is a RDD of type [((int, int), (Double, Double))] not an Array. Now, if you want to save it on disk, then you can simply call the saveAsTextFile and provide the location. So change your last line from this: ratesAndPreds.foreach(pw.println) to this ratesAnd

Writing collection to file error

2014-11-24 Thread Saurabh Agrawal
import org.apache.spark.mllib.recommendation.ALS import org.apache.spark.mllib.recommendation.Rating // Load and parse the data val data = sc.textFile("/path/CFReady.txt") val ratings = data.map(_.split('\t') match { case Array(user, item, rate) => Rating(user.toInt, item.toInt, rate.toDouble)