@@ -1474,7 +1474,7 @@ print.summary.KSTest <- function(x, ...) {
14741474# ' df <- createDataFrame(longley)
14751475# '
14761476# ' # fit a Decision Tree Regression Model
1477- # ' model <- spark.decisionTree(data, Employed~., "regression", maxDepth= 5, maxBins= 16)
1477+ # ' model <- spark.decisionTree(data, Employed~., type = "regression", maxDepth = 5, maxBins = 16)
14781478# '
14791479# ' # get the summary of the model
14801480# ' summary(model)
@@ -1579,7 +1579,7 @@ setMethod("summary", signature(object = "DecisionTreeRegressionModel"),
15791579 features <- callJMethod(jobj , " features" )
15801580 depth <- callJMethod(jobj , " depth" )
15811581 numNodes <- callJMethod(jobj , " numNodes" )
1582- ans <- list (features = features , depth = depth , numNodes = numNodes )
1582+ ans <- list (features = features , depth = depth , numNodes = numNodes , jobj = jobj )
15831583 class(ans ) <- " summary.DecisionTreeRegressionModel"
15841584 ans
15851585 })
@@ -1594,15 +1594,17 @@ setMethod("summary", signature(object = "DecisionTreeRegressionModel"),
15941594# ' @export
15951595# ' @note summary(DecisionTreeRegressionModel) since 2.1.0
15961596setMethod ("summary ", signature(object = "DecisionTreeClassificationModel"),
1597- function (object , ... ) {
1598- jobj <- object @ jobj
1599- features <- callJMethod(jobj , " features" )
1600- depth <- callJMethod(jobj , " depth" )
1601- numNodes <- callJMethod(jobj , " numNodes" )
1602- ans <- list (features = features , depth = depth , numNodes = numNodes )
1603- class(ans ) <- " summary.DecisionTreeClassificationModel"
1604- ans
1605- })
1597+ function (object , ... ) {
1598+ jobj <- object @ jobj
1599+ features <- callJMethod(jobj , " features" )
1600+ depth <- callJMethod(jobj , " depth" )
1601+ numNodes <- callJMethod(jobj , " numNodes" )
1602+ numClasses <- callJMethod(jobj , " numClasses" )
1603+ ans <- list (features = features , depth = depth ,
1604+ numNodes = numNodes , numClasses = numClasses , jobj = jobj )
1605+ class(ans ) <- " summary.DecisionTreeClassificationModel"
1606+ ans
1607+ })
16061608
16071609# Prints the summary of Decision Tree Regression Model
16081610
@@ -1611,11 +1613,11 @@ function(object, ...) {
16111613# ' @export
16121614# ' @note print.summary.DecisionTreeRegressionModel since 2.1.0
16131615print.summary.DecisionTreeRegressionModel <- function (x , ... ) {
1614- jobj <- x @ jobj
1615- summaryStr <- callJMethod(jobj , " summary" )
1616- cat(summaryStr , " \n " )
1617- invisible (x )
1618- }
1616+ jobj <- x $ jobj
1617+ summaryStr <- callJMethod(jobj , " summary" )
1618+ cat(summaryStr , " \n " )
1619+ invisible (x )
1620+ }
16191621
16201622# Prints the summary of Decision Tree Classification Model
16211623
@@ -1624,7 +1626,7 @@ print.summary.DecisionTreeRegressionModel <- function(x, ...) {
16241626# ' @export
16251627# ' @note print.summary.DecisionTreeClassificationModel since 2.1.0
16261628print.summary.DecisionTreeClassificationModel <- function (x , ... ) {
1627- jobj <- x @ jobj
1629+ jobj <- x $ jobj
16281630 summaryStr <- callJMethod(jobj , " summary" )
16291631 cat(summaryStr , " \n " )
16301632 invisible (x )
0 commit comments