RF.go is an implementation of Random Forest in GoLang

RF.go

  • RF.go is an implementation of Random Forest in GoLang.

      Random forest (or random forests) is an ensemble classifier that consists of many
       decision trees and outputs the class that is the mode of the classes output by 
       individual trees. http://en.wikipedia.org/wiki/Random_forest
    
  • RF.go can train trees in parallel mode with assigning go-routine to each decision tree, which can utilize multiple-core CPU efficiently.

  • On the famous dataset MNIST, RF.go can get 2.8% error rate with configuration of 100 trees

  • RF.go supports both Classification and Regression. The examples can be found in the repository.

  • RF.go supports dumpping and loading the forest data structure between RAM and disk, in a JSON format file

Installation

  1. Install Go
  2. $ go get github.com/fxsjy/RF.go/RF This will put the binary in $GOROOT/bin
Owner
Sun Junyi
sjy.eth
Sun Junyi
Similar Resources

Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation

stack Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation Purpose Provide a fast, thread safe, and generic Golang Stack API with minim

May 3, 2022

Optimal implementation of ordered maps for Golang - ie maps that remember the order in which keys were inserted.

Goland Ordered Maps Same as regular maps, but also remembers the order in which keys were inserted, akin to Python's collections.OrderedDicts. It offe

Jan 3, 2023

Sliding window counters Redis rate limiting implementation for Golang

Sliding window counters Redis rate limiting implementation for Golang (Based on the Figma API rate limit algorithm)

Dec 21, 2022

A pure Golang implementation of Rockchip rknand vendor storage interface.

go-rkvendorstorage A pure Golang implementation of Rockchip rknand vendor storage interface. Usage package main import ( "fmt" "github.com/jamesits

Nov 8, 2022

Golang 1.18+ Generics implementation of Set methods

Golang Generics: Set A golang 1.18+ implementation of Set using Go generics Installation $ go get -u github.com/chrispappas/golang-generics-set Quick

Oct 26, 2022

go implementation of timsort

timsort timsort is a Go implementation of Tim Peters's mergesort sorting algorithm. For many input types it is 2-3 times faster than Go's built-in sor

Nov 7, 2022

Implementation of do255e and do255s in Go

Go Implementation of do255e and do255s This is a plain Go implementation of do255e and do255s. It is considered secure; all relevant functions should

Aug 15, 2022

Go implementation of the Heaven's Gate technique

Go implementation of the Heaven's Gate technique

gopherheaven is a Go implementation of the classic Heaven's Gate technique originally published by roy g biv on VX Heaven in 2009. gopherheaven can be used as an evasion technique to directly call 64-bit code from a 32-bit process.

Dec 20, 2022

An idiomatic Go implementation of Leaky bucket.

lbucket lbucket is an idiomatic Go leaky bucket implementation. The library make use of plain old Go stdlib; in other words, there are no third-party

Apr 17, 2022
Comments
  • very nice library, but please reorganize the examples

    very nice library, but please reorganize the examples

    i really like your code, works nice, readable, does exactly, what i was looking for, etc, but:

    if i just try(naively):

    go get "github.com/fxsjy/RF.go"

    it's pulling in the whole 47mb mnist database, among other goodies there too ...

  • forest.Predicate does not return a value

    forest.Predicate does not return a value

    I'm following the iris example and built a similar forest for malware detection. My inputs is a vector of ints and the target a string.

    However when I use forest.Predicate(inputs) I don't get any output (empty string).. Is it something intended?

    Here is a snippet of my code :

            // split train and test data
    	Logger.Debug("splitting data in training and testing")
    	train_input := [][]interface{}{}
    	test_input := [][]interface{}{}
    
    	train_target := []string{}
    	test_target := []string{}
    
    	for i := 0; i < len(inputs); i++ {
    		input := inputs[i]
    		target := targets[i]
    
    		test := rand.Float64()
    		if test > TRAIN_TEST_PERCENT {
    			test_input = append(test_input, input)
    			test_target = append(test_target, target)
    		} else {
    			train_input = append(train_input, input)
    			train_target = append(train_target, target)
    		}
    	}
    	Logger.Debugf("Got %d training and %d testing samples over %d samples", len(train_input), len(test_input), len(inputs))
    
    	// create classifier
    	Logger.Debug("training the forest")
    	forest := RF.DefaultForest(train_input, train_target, 100) //100 trees
    	RF.DumpForest(forest, filepath.Join("data", "model.ml"))
    
    	// get stats for the classifier
    	Logger.Debug("gathering stats")
    	err_count := 0.0
    	for i := 0; i < len(test_input); i++ {
    		output := forest.Predicate(test_input[i])
    		expect := test_target[i]
    		Logger.Tracef("Out: %s | Expected: %s", output, expect)
    		if output != expect {
    			err_count += 1
    		}
    	}
    	Logger.Infof("success rate: %f", 1.0-err_count/float64(len(test_input)))
    
  • Clarify package license.

    Clarify package license.

    Hi, we want to use your awesome library in production, but we need to know exactly what license it is under. There is no LICENSE file or license header in source files. Could you please clarify it? Thanks!

Related tags
Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image.

Daypaper Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image. Installation You will need an Access T

May 23, 2022
✔️ Get random data for your app from a third-party source.

Random Data Securely produced random data for application testing. FAQ What would i use this data for? You can use this information to test your apps

Jul 5, 2022
Encriptator using random generated numbers

public-private-key-encrypter Encriptator using random generated numbers The input file must be in one file called 'data.txt' The execution will genera

Oct 15, 2021
Just some random matchers
Just some random matchers

The package provides a matcher interface to match a given value of any types.

Nov 3, 2022
generate random data like name, email, uuid, address, images and etc.

gg-rand generate random data like name, email, uuid, address, images and etc. build and install: make run: gg-rand $ gg-rand SillyName : Knavesa

Nov 16, 2022
Generate some random data

fake-data-generator-api generate some random data installing and using

Dec 2, 2022
Generates a random alphanumeric string of a given length.

randstring randstring.Create () is fast and has minimal memory allocation. It returns a random alphanumeric string of a given length. Install go get g

Jan 7, 2022
GoApiRandom - Api to get random numbers

GoApiRandom - Api to get random numbers

Jan 18, 2022
Generates random text based on trigrams generated from input text
Generates random text based on trigrams generated from input text

Trigrams Generates random text based on trigrams generated from input text Contents Building Running Using Implementation notes NGram size Maximum wor

Feb 9, 2022
Print random bytes from a secure source to stdout.

Print random bytes from a secure source to stdout.

Feb 11, 2022