decisiontree

package
v0.0.0-...-7d47eef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package decisiontree contains utilities to handle decision trees.

Index

Constants

View Source
const DefaultNodeFilename = "nodes"

DefaultNodeFilename is the default filename to store nodes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forest

type Forest struct {
	Trees []*Tree
}

Forest is a collection of trees.

func LoadForest

func LoadForest(basePath string, numShards int, format string, numTrees int) (*Forest, error)

LoadForest loads a forest from disk.

func (*Forest) NumLeafs

func (f *Forest) NumLeafs() int

NumLeafs is the number of leafs in the forest.

func (*Forest) NumNonLeafs

func (f *Forest) NumNonLeafs() int

NumNonLeafs is the number of non-leaf nodes in the forest.

type Node

type Node struct {
	RawNode       *pb.Node
	PositiveChild *Node
	NegativeChild *Node
}

Node is a tree node.

func (*Node) IsLeaf

func (n *Node) IsLeaf() bool

IsLeaf tests if a node is a leaf.

func (*Node) NumLeafs

func (n *Node) NumLeafs() int

NumLeafs is the number of leafs in a sub-tree.

func (*Node) NumNonLeafs

func (n *Node) NumNonLeafs() int

NumNonLeafs is the number of non-leaf nodes in a sub-tree.

type Tree

type Tree struct {
	// Root node of the tree. nil if the tree is empty.
	Root *Node
}

Tree is a decision tree.

Directories

Path Synopsis
io
Package io contains utilities to load/save decision trees
Package io contains utilities to load/save decision trees
blobsequence
Package blobsequence implement node reading from blob sequence files.
Package blobsequence implement node reading from blob sequence files.
canonical
Package canonical registers the "canonical" ways to read tree nodes.
Package canonical registers the "canonical" ways to read tree nodes.
Package proto includes all proto definitions used in the golang package in one large package.
Package proto includes all proto definitions used in the golang package in one large package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL