From 234f54ef5d336ec361085971ed1bf1d480e55802 Mon Sep 17 00:00:00 2001 From: art Date: Fri, 8 Nov 2019 13:20:38 -0600 Subject: [PATCH] analysis.py v 1.1.11.000 --- data analysis/analysis/analysis.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/data analysis/analysis/analysis.py b/data analysis/analysis/analysis.py index ea13a981..ad2e772f 100644 --- a/data analysis/analysis/analysis.py +++ b/data analysis/analysis/analysis.py @@ -7,10 +7,13 @@ # current benchmark of optimization: 1.33 times faster # setup: -__version__ = "1.1.10.000" +__version__ = "1.1.11.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 1.1.11.000: + - added RandomForestClassifier and RandomForestRegressor + - note: untested 1.1.10.000: - added numba.jit to remaining functions 1.1.9.002: @@ -551,6 +554,18 @@ class SVM: return r_2, _mse, _rms +def RandomForestClassifier(data, labels, n_estimators="warn", criterion="gini", max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features="auto", max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, oob_score=False, n_jobs=None, random_state=None, verbose=0, warm_start=False, class_weight=None): + + kernel = sklearn.ensemble.RandomForestClassifier(n_estimators = n_estimators, criterion = criterion, max_depth = max_depth, min_samples_split = min_samples_split, min_samples_leaf = min_samples_leaf, min_weight_fraction_leaf = min_weight_fraction_leaf, max_leaf_nodes = max_leaf_nodes, min_impurity_decrease = min_impurity_decrease, bootstrap = bootstrap, oob_score = oob_score, n_jobs = n_jobs, random_state = random_state, verbose = verbose, warm_start = warm_start, class_weight = class_weight) + kernel.fit(data, labels) + return kernel + +def RandomForestRegressor(inputs, outputs, n_estimators="warn", criterion="mse", max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features="auto", max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, oob_score=False, n_jobs=None, random_state=None, verbose=0, warm_start=False): + + kernel = sklearn.ensemble.RandomForestRegressor(n_estimators = n_estimators, criterion = criterion, max_depth = max_depth, min_samples_split = min_samples_split, min_weight_fraction_leaf = min_weight_fraction_leaf, max_features = max_features, max_leaf_nodes = max_leaf_nodes, min_impurity_decrease = min_impurity_decrease, min_impurity_split = min_impurity_split, bootstrap = bootstrap, oob_score = oob_score, n_jobs = n_jobs, random_state = random_state, verbose = verbose, warm_start = warm_start) + kernel.fit(inputs, outputs) + return kernel + class Regression: # Titan Robotics Team 2022: CUDA-based Regressions Module