Re: Print Decision Tree Models

2014-10-01 Thread Jimmy
Yeah I'm using 1.0.0 and thanks for taking the time to check! 

Sent from my iPhone

> On Oct 1, 2014, at 8:48 PM, Xiangrui Meng  wrote:
> 
> Which Spark version are you using? It works in 1.1.0 but not in 1.0.0. 
> -Xiangrui
> 
>> On Wed, Oct 1, 2014 at 2:13 PM, Jimmy McErlain  wrote:
>> So I am trying to print the model output from MLlib however I am only 
>> getting things like the following:
>> org.apache.spark.mllib.tree.model.DecisionTreeModel@1120c600
>> 0.17171527904439082
>> 0.8282847209556092
>> 5273125.0
>> 2.5435412E7
>> 
>> from the following code:
>>   val trainErr = labelAndPreds.filter(r => r._1 != r._2).count.toDouble 
>> / cleanedData2.count
>>   val trainSucc = labelAndPreds.filter(r => r._1 == r._2).count.toDouble 
>> / cleanedData2.count
>>   val trainErrCount = labelAndPreds.filter(r => r._1 != 
>> r._2).count.toDouble
>>   val trainSuccCount = labelAndPreds.filter(r => r._1 == 
>> r._2).count.toDouble
>>   
>>   print(model)
>>   println(trainErr)
>>   println(trainSucc)
>>   println(trainErrCount)
>>   println(trainSuccCount)
>> 
>> I have also tried the following:
>>   val model_string = model.toString()
>>   print(model_string)
>> 
>> And I still do not get the model to print but where it resides in memory.
>> 
>> Thanks,
>> J
>> 
>> 
>> 
>> 
>> 
>> 
>> JIMMY MCERLAIN
>> 
>> DATA SCIENTIST (NERD)
>> 
>> . . . . . . . . . . . . . . . . . . 
>> 
>> 
>> IF WE CAN’T DOUBLE YOUR SALES,
>> 
>> ONE OF US IS IN THE WRONG BUSINESS.
>> 
>> 
>> E: ji...@sellpoints.com   
>> 
>> M: 510.303.7751
>> 
>> ᐧ
> 


Re: Print Decision Tree Models

2014-10-01 Thread Xiangrui Meng
Which Spark version are you using? It works in 1.1.0 but not in 1.0.0.
-Xiangrui

On Wed, Oct 1, 2014 at 2:13 PM, Jimmy McErlain  wrote:

> So I am trying to print the model output from MLlib however I am only
> getting things like the following:
>
> org.apache.spark.mllib.tree.model.DecisionTreeModel@1120c600
>
> 0.17171527904439082
> 0.8282847209556092
> 5273125.0
> 2.5435412E7
>
>
> from the following code:
>
>   val trainErr = labelAndPreds.filter(r => r._1 != r._2).count.toDouble / 
> cleanedData2.count
>   val trainSucc = labelAndPreds.filter(r => r._1 == r._2).count.toDouble 
> / cleanedData2.count
>   val trainErrCount = labelAndPreds.filter(r => r._1 != 
> r._2).count.toDouble
>   val trainSuccCount = labelAndPreds.filter(r => r._1 == 
> r._2).count.toDouble
>
>   print(model)
>   println(trainErr)
>   println(trainSucc)
>   println(trainErrCount)
>   println(trainSuccCount)
>
>
> I have also tried the following:
>
>   val model_string = model.toString()
>   print(model_string)
>
>
> And I still do not get the model to print but where it resides in memory.
>
>
> Thanks,
>
> J
>
>
>
>
>
>
>
> *JIMMY MCERLAIN*
>
> DATA SCIENTIST (NERD)
>
> *. . . . . . . . . . . . . . . . . .*
>
>
> *IF WE CAN’T DOUBLE YOUR SALES,*
>
>
>
> *ONE OF US IS IN THE WRONG BUSINESS.*
>
> *E*: ji...@sellpoints.com
>
> *M*: *510.303.7751 <510.303.7751>*
> ᐧ
>


Print Decision Tree Models

2014-10-01 Thread Jimmy McErlain
So I am trying to print the model output from MLlib however I am only
getting things like the following:

org.apache.spark.mllib.tree.model.DecisionTreeModel@1120c600

0.17171527904439082
0.8282847209556092
5273125.0
2.5435412E7


from the following code:

  val trainErr = labelAndPreds.filter(r => r._1 !=
r._2).count.toDouble / cleanedData2.count
  val trainSucc = labelAndPreds.filter(r => r._1 ==
r._2).count.toDouble / cleanedData2.count
  val trainErrCount = labelAndPreds.filter(r => r._1 != r._2).count.toDouble
  val trainSuccCount = labelAndPreds.filter(r => r._1 ==
r._2).count.toDouble

  print(model)
  println(trainErr)
  println(trainSucc)
  println(trainErrCount)
  println(trainSuccCount)


I have also tried the following:

  val model_string = model.toString()
  print(model_string)


And I still do not get the model to print but where it resides in memory.


Thanks,

J







*JIMMY MCERLAIN*

DATA SCIENTIST (NERD)

*. . . . . . . . . . . . . . . . . .*


*IF WE CAN’T DOUBLE YOUR SALES,*



*ONE OF US IS IN THE WRONG BUSINESS.*

*E*: ji...@sellpoints.com

*M*: *510.303.7751*
ᐧ