コード例 #1
0
func (t *Tree) ToString() []byte {
	sb := util.StringBuilder{}
	sb.Int(len(t.nodes))
	sb.Write("\n")
	for i, node := range t.nodes {
		sb.Int(i)
		sb.Write("\t")
		sb.Int(node.left)
		sb.Write("\t")
		sb.Int(node.right)
		sb.Write("\t")
		sb.Int(node.depth)
		sb.Write("\t")
		sb.WriteBytes(node.prediction.ToString())
		sb.Write("\t")
		sb.Int(node.sample_count)
		sb.Write("\t")
		sb.Int64(node.feature_split.Id)
		sb.Write("\t")
		sb.Float(node.feature_split.Value)
		sb.Write("\n")
	}
	return sb.Bytes()
}