我最近读到蹦床是一种消除尾声的方法。我想将我的一个功能转换为利用蹦床的功能,但我很难开始(我来自 OO 世界)。
def buildTree (X:DenseMatrix[Double], Y:DenseVector[Double], minBucket:Int):Node = {
// Get the split variable, split point and data for this data
val (splitVar, splitPoint, leftX, leftY, rightX, rightY) = chooseSplit(X, Y, minBucket);
// If we couldn't find a split, then we have a leaf
if(splitVar == Double.NegativeInfinity){
new Node(Y)
}else{
// Otherwise recursively build the children and create yourself as a vertex
val left = buildTree(leftX, leftY, minBucket))
val right = buildTree(rightX, rightY, minBucket))
new Node(Y, splitVar, splitPoint, left, right)
}
}
具体来说,如果我想在“More()”语句中进行两个不同的递归调用,可以吗?