Yes, you're definitely right. The set() pattern sounds good to me. I had
forgotten about our Java users. :-)


On Fri, Jul 5, 2013 at 3:24 PM, Matei Zaharia <notifications@github.com>wrote:

> In mllib/src/main/scala/spark/ml/recommendation/ALS.scala:
>
> > + * information about the ratings matrix to determine the "out-links" of each user (which blocks of
> > + * products it will contribute to) and "in-link" information for each product (which of the feature
> > + * vectors it receives from each user block it will depend on). This allows us to send only an
> > + * array of feature vectors between each user block and product block, and have the product block
> > + * find the users' ratings and update the products based on these messages.
> > + */
> > +class ALS private (var numBlocks: Int, var rank: Int, var iterations: Int, var lambda: Double)
> > +  extends Serializable
> > +{
> > +  def this() = this(-1, 10, 10, 0.01)
> > +
> > +  /**
> > +   * Set the number of blocks to parallelize the computation into; pass -1 for an auto-configured
> > +   * number of blocks. Default: -1.
> > +   */
> > +  def setBlocks(numBlocks: Int): ALS = {
>
> In Scala, I think the right way might be to add a factory method with
> default arguments as well, on the singleton object (KMeans.apply). That
> will allow us to have a case class-like pattern. For Java, the chained
> set() naming pattern is used in both Avro and Protobuf, so I think we
> should go with that.
>
> By the way, unfortunately I think it's impossible to add default arguments
> to the constructor and still call an argument-less version from Java.
> Otherwise that would've been the nicest.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mesos/spark/pull/678/files#r5050897>
> .
>