iforestgo

package module
v0.0.0-...-afacde2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const EulersConstant = 0.5772156649

Variables

View Source
var ErrSubSamplingSizeToolarge = errors.New("the requested sub-sampling size exceeds the total number of samples in the input data")

Functions

func PathLength

func PathLength[V Value](x []V, t *Tree[V]) float64

Types

type Forest

type Forest[V Value] struct {
	Trees           []*Tree[V]
	SubSamplingSize int

	InputDimesion int
	// contains filtered or unexported fields
}

func Deserialize

func Deserialize[V Value](b *bytes.Buffer) (Forest[V], error)

func NewForest

func NewForest[V Value](X [][]V, nTrees int, subSamplingSize int, seed int64) (*Forest[V], error)

func (*Forest[V]) CalculateAnomalyScore

func (f *Forest[V]) CalculateAnomalyScore(x []V) float64

func (*Forest[V]) Serialize

func (f *Forest[V]) Serialize() (*bytes.Buffer, error)

type Node

type Node[V Value] struct {
	Size         int
	SplitPoint   V
	SplitAttrIdx int
	Height       int
	NodeLeft     *Node[V]
	NodeRight    *Node[V]
	External     bool
}

type Tree

type Tree[V Value] struct {
	Root        *Node[V]
	HeightLimit int
}

func NewTree

func NewTree[V Value](X *[][]V, sampleIdxs []int, r *rand.Rand) *Tree[V]

type Value

type Value interface {
	float32 | float64
}

Jump to

Keyboard shortcuts

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