title: Spark mllib : how to convert string categorical features into int for Rating to accept
body: <p>I want to build a recommendation application using spark mllib and the ALS algorithm in collaborative filtering technique. My data set has the user and product features in string form like :</p>
  
  <pre><code>[{"user":"StringName1", "product":"StringProduct1", "rating":1},
   {"user":"StringName2", "product":"StringProduct2", "rating":2},
   {"user":"StringName1", "product":"StringProduct2", "rating":3},..]
  </code></pre>
  
  <p>But the <a href="https://spark.apache.org/docs/1.4.0/api/java/org/apache/spark/mllib/recommendation/Rating.html" rel="nofollow">Rating</a> method seems to accept only int values for both user and product features. Does that mean I will have to build a separate dictionary to map each string to an int? My dataset will have duplicate entries for both user and product.Is there a built-in solution for this in the mllib library itself?</p>
  
  <p>Thanks and any help appreciated!</p>
  
  <p>Edit: No, this is not a duplicate as the answer in that question doesn't seem to fit my scenario. <code>spark.ml.recommendation.ALS.Rating</code> library doesn't seem to support String values for <code>user</code> or <code>item</code>. I need this support.</p>