You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by jluan <ja...@gmail.com> on 2016/02/11 02:56:40 UTC
[MLLIB] Best way to extract RandomForest decision splits
I've trained a RandomForest classifier where I can print my model's decisions
using model.toDebugString
However I was wondering if there's a way to extract tree programmatically by
traversing the nodes or in some other way such that I can write my own
decision file rather than just a debug string.
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/MLLIB-Best-way-to-extract-RandomForest-decision-splits-tp26201.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org
RE: [MLLIB] Best way to extract RandomForest decision splits
Posted by Mohammed Guller <mo...@glassbeam.com>.
Yes, a model saved with the save method can be read back only by the load method in the RandomForestModel object.
Unfortunately, I don’t know any better mechanism for what you are trying to do. There was a discussion on this topic a few days ago, so if you search the mailing list archives, you may be able to find other alternatives.
Mohammed
Author: Big Data Analytics with Spark<http://www.amazon.com/Big-Data-Analytics-Spark-Practitioners/dp/1484209656/>
From: Jay Luan [mailto:jayluan7@gmail.com]
Sent: Wednesday, February 10, 2016 7:27 PM
To: Mohammed Guller
Cc: user@spark.apache.org
Subject: RE: [MLLIB] Best way to extract RandomForest decision splits
Thanks for the reply, I'd like to export the decision splits for each tree out to an external file which is read elsewhere not using spark. As far as I know, saving a model to a path will save a bunch of binary files which can be loaded back into spark. Is this correct?
On Feb 10, 2016 7:21 PM, "Mohammed Guller" <mo...@glassbeam.com>> wrote:
Why not use the save method from the RandomForestModel class to save a model at a specified path?
Mohammed
Author: Big Data Analytics with Spark
-----Original Message-----
From: jluan [mailto:jayluan7@gmail.com<ma...@gmail.com>]
Sent: Wednesday, February 10, 2016 5:57 PM
To: user@spark.apache.org<ma...@spark.apache.org>
Subject: [MLLIB] Best way to extract RandomForest decision splits
I've trained a RandomForest classifier where I can print my model's decisions
using model.toDebugString
However I was wondering if there's a way to extract tree programmatically by
traversing the nodes or in some other way such that I can write my own
decision file rather than just a debug string.
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/MLLIB-Best-way-to-extract-RandomForest-decision-splits-tp26201.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org<ma...@spark.apache.org>
For additional commands, e-mail: user-help@spark.apache.org<ma...@spark.apache.org>
RE: [MLLIB] Best way to extract RandomForest decision splits
Posted by Jay Luan <ja...@gmail.com>.
Thanks for the reply, I'd like to export the decision splits for each tree
out to an external file which is read elsewhere not using spark. As far as
I know, saving a model to a path will save a bunch of binary files which
can be loaded back into spark. Is this correct?
On Feb 10, 2016 7:21 PM, "Mohammed Guller" <mo...@glassbeam.com> wrote:
> Why not use the save method from the RandomForestModel class to save a
> model at a specified path?
>
>
>
> Mohammed
>
> Author: Big Data Analytics with Spark
>
>
>
>
>
> -----Original Message-----
> From: jluan [mailto:jayluan7@gmail.com]
> Sent: Wednesday, February 10, 2016 5:57 PM
> To: user@spark.apache.org
> Subject: [MLLIB] Best way to extract RandomForest decision splits
>
>
>
> I've trained a RandomForest classifier where I can print my model's
> decisions
>
> using model.toDebugString
>
>
>
> However I was wondering if there's a way to extract tree programmatically
> by
>
> traversing the nodes or in some other way such that I can write my own
>
> decision file rather than just a debug string.
>
>
>
>
>
>
>
> --
>
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/MLLIB-Best-way-to-extract-RandomForest-decision-splits-tp26201.html
>
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
>
> For additional commands, e-mail: user-help@spark.apache.org
>
>
>
RE: [MLLIB] Best way to extract RandomForest decision splits
Posted by Mohammed Guller <mo...@glassbeam.com>.
Why not use the save method from the RandomForestModel class to save a model at a specified path?
Mohammed
Author: Big Data Analytics with Spark
-----Original Message-----
From: jluan [mailto:jayluan7@gmail.com]
Sent: Wednesday, February 10, 2016 5:57 PM
To: user@spark.apache.org
Subject: [MLLIB] Best way to extract RandomForest decision splits
I've trained a RandomForest classifier where I can print my model's decisions
using model.toDebugString
However I was wondering if there's a way to extract tree programmatically by
traversing the nodes or in some other way such that I can write my own
decision file rather than just a debug string.
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/MLLIB-Best-way-to-extract-RandomForest-decision-splits-tp26201.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org<ma...@spark.apache.org>
For additional commands, e-mail: user-help@spark.apache.org<ma...@spark.apache.org>