Decision tree and Random forest CART implementation in Nim


Decision tree with nim

Nim package for decision trees and random forest

How to install

nimble install decisiontree

Package features

  • Inspired by Scikit-learn api
  • Random forest can train and predict in parallel
  • Actually you feed the X matrix of size [n x m] as seq[seq[float]] RowMajor and the y array of size [n] as seq[float]

Decision Tree

import DecisionTree

let dt = DecisionTree.new_classification_tree(max_depth=10),y_train)
let yhat = dt.predict(X_test)

Random forest

import DecisionTree

let rf = DecisionTree.new_random_forest_classifier(n_trees=100, num_threads=4) #parallel training too!, y_train)
let yhat = rf.predict(X_test)
Need help? Read Nimble
No tagged versions available
License: GPL-3.0

Project website Hosted docs