{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/11855","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/11855/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/11855/comments","events_url":"https://api.github.com/repos/apache/spark/issues/11855/events","html_url":"https://github.com/apache/spark/pull/11855","id":142237526,"number":11855,"title":"[SPARK-12183][ML][MLLIB] Remove mllib tree implementation, and wrap spark.ml one","user":{"login":"jkbradley","id":5084283,"avatar_url":"https://avatars.githubusercontent.com/u/5084283?v=3","gravatar_id":"","url":"https://api.github.com/users/jkbradley","html_url":"https://github.com/jkbradley","followers_url":"https://api.github.com/users/jkbradley/followers","following_url":"https://api.github.com/users/jkbradley/following{/other_user}","gists_url":"https://api.github.com/users/jkbradley/gists{/gist_id}","starred_url":"https://api.github.com/users/jkbradley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkbradley/subscriptions","organizations_url":"https://api.github.com/users/jkbradley/orgs","repos_url":"https://api.github.com/users/jkbradley/repos","events_url":"https://api.github.com/users/jkbradley/events{/privacy}","received_events_url":"https://api.github.com/users/jkbradley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-21T02:18:13Z","updated_at":"2016-03-21T15:36:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/11855","html_url":"https://github.com/apache/spark/pull/11855","diff_url":"https://github.com/apache/spark/pull/11855.diff","patch_url":"https://github.com/apache/spark/pull/11855.patch"},"body":"Primary change:\r\n* Removed spark.mllib.tree.DecisionTree implementation of tree and forest learning.\r\n* spark.mllib now calls the spark.ml implementation.\r\n* Moved unit tests (of tree learning internals) from spark.mllib to spark.ml as needed.\r\n\r\nml.tree.DecisionTreeModel\r\n* Added toOld and made ```private[spark]```, implemented for Classifier and Regressor in subclasses.  These methods now use OldInformationGainStats.invalidInformationGainStats for LeafNodes in order to mimic the spark.mllib implementation.\r\n\r\nml.tree.Node\r\n* Added ```private[tree] def deepCopy```, used by unit tests\r\n\r\nCopied developer comments from spark.mllib implementation to spark.ml one.\r\n\r\nMoving unit tests\r\n* Tree learning internals were tested by spark.mllib.tree.DecisionTreeSuite, or spark.mllib.tree.RandomForestSuite.\r\n* Those tests were all moved to spark.ml.tree.impl.RandomForestSuite.  The order in the file + the test names are the same, so you should be able to compare them by opening them in 2 windows side-by-side.\r\n* I made minimal changes to each test to allow it to run.  Each test makes the same checks as before, except for a few removed assertions which were checking irrelevant values.\r\n* No new unit tests were added.\r\n* mllib.tree.DecisionTreeSuite: I removed some checks of splits and bins which were not relevant to the unit tests they were in.  Those same split calculations were already being tested in other unit tests, for each dataset type.\r\n\r\n**Changes of behavior** (to be noted in SPARK-13448 once this PR is merged)\r\n* spark.ml.tree.impl.RandomForest: Rather than throwing an error when maxMemoryInMB is set to too small a value (to split any node), we now allow 1 node to be split, even if its memory requirements exceed maxMemoryInMB.  This involved removing the maxMemoryPerNode check in RandomForest.run, as well as modifying selectNodesToSplit().  Once this PR is merged, I will note the change of behavior on SPARK-13448.\r\n* spark.mllib.tree.DecisionTree: When a tree only has one node (root = leaf node), the \"stats\" field will now be empty, rather than being set to InformationGainStats.invalidInformationGainStats.  This does not remove information from the tree, and it will save a bit of storage.\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/199343599","html_url":"https://github.com/apache/spark/pull/11855#issuecomment-199343599","issue_url":"https://api.github.com/repos/apache/spark/issues/11855","id":199343599,"user":{"login":"sethah","id":7275795,"avatar_url":"https://avatars.githubusercontent.com/u/7275795?v=3","gravatar_id":"","url":"https://api.github.com/users/sethah","html_url":"https://github.com/sethah","followers_url":"https://api.github.com/users/sethah/followers","following_url":"https://api.github.com/users/sethah/following{/other_user}","gists_url":"https://api.github.com/users/sethah/gists{/gist_id}","starred_url":"https://api.github.com/users/sethah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethah/subscriptions","organizations_url":"https://api.github.com/users/sethah/orgs","repos_url":"https://api.github.com/users/sethah/repos","events_url":"https://api.github.com/users/sethah/events{/privacy}","received_events_url":"https://api.github.com/users/sethah/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T15:36:01Z","updated_at":"2016-03-21T15:36:01Z","body":"This is not related to your changes, but I noticed that the return type in the comment [here](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala#L814) is incorrect. This seems like a reasonable PR to fix it in."}}