[SPARK-4494] IDFModel.transform() add support for single vector

I improved `IDFModel.transform` to allow using a single vector.

[[SPARK-4494] IDFModel.transform() add support for single vector - ASF JIRA](https://issues.apache.org/jira/browse/SPARK-4494)
Since this is the same set of checks as for the batch transform(), could they be moved to a helper method to eliminate duplicate code?