Github user jkbradley commented on the pull request:
https://github.com/apache/spark/pull/4087#issuecomment-77037995
@leahmcguire Thanks for the update! I've added some inline comments, plus
a few larger items below.
#### Java compatibility
The "NaiveBayesModels" type is not Java-friendly since Java doesn't
recognize Scala enumerations. E.g., try writing this in a java example:
```
NaiveBayes nb2 = new NaiveBayes();
nb2.setModelType(/*Nothing really works here*/);
```
The Java doc will also show the setModelType argument as a generic "Object."
I'd recommend something like this instead:
```
class NaiveBayesModelType
object NaiveBayesModelType {
def multinomial = Multinomial // Java uses these
def bernoulli = Bernoulli
def fromString(modelType: String): NaiveBayesModelType = ???
object Multinomial extends NaiveBayesModelType { // Scala uses these
override def toString: String = "Multinomial"
}
object Bernoulli extends NaiveBayesModelType {
override def toString: String = "Bernoulli"
}
}
```
#### Save/load
Since this won't make it into the 1.3 branch, we'll need to update the
save/load methods to handle a new model format, where loading the old model
format sets the model type to the default Multinomial. If you have questions
about how to do this, please let me know. If you'd prefer not to do it, then I
could push a PR to your branch with the update to save/load after you've done
the other updates.
* Part of the update will involve a new test to make sure save/load works
across versions.
#### other
Also, I noticed this branch is from your spark/master branch. If you keep
adding patches, it may work better to create a new branch for each PR
(especially if you multitask across PRs).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]