Refactor python to scala functions (#788)
Refactor python to scala functions (#788)

* refactor python to scala functions

* fix style

* fix style

* fix test

* fix test

intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL