daw is a python library that builds random forest models and keeps statistics about the data in the model to enable post-hoc adversarial robustness analysis.
Simple example that trains a DAW forest regressor.
import daw
import numpy as np
# training data
X_train = np.array([[0, 1], [0, 1], [0, 1], [1, 0], [1, 0]])
y_train = np.array([0.5, 0.7, 0.2, 1.1, 0.25])
X_test = np.array([[1, 0]]) # test instance
# train a DAW RF regression model
rf = daw.RandomForestRegressor(
n_estimators=100,
max_depth=3,
k=5, # no. thresholds to consider per attribute
topd=0, # no. random node layers
criterion='absolute_error', # 'absolute_error' or 'squared_error'
random_state=1
).fit(X_train, y_train)
rf.predict(X_test)