Classes | |
class | DecisionTree |
Basic DecisionTree that the random forest is based on. More... | |
class | RFBase |
Base class for random forest classifier. More... | |
class | RFBreiman |
Train a random forest using DecisionTrees on bootstrap samples using splits on random attributes and random values on those attributes. More... | |
class | RFRandomInputSubset |
Train a random forest using DecisionTrees on bootstrap samples where each sample has a random subset of dimensions but the split point is performed using a minimum entropy criteria. More... | |
Functions | |
def | binary_greater_than |
def | binary_less_than |
def | create_binary_tests |
def | evaluate_classifier |
Evaluate classifier by dividing dataset into training and test set. | |
def | load_pickle |
def | min_entropy_split |
Find the split that produces subsets with the minimum combined entropy return splitting attribute & splitting point for that attribute. | |
def | mode_exhaustive |
Helper functions. | |
def | print_separator |
def | random_subset |
def | random_subset_split |
splitter in decision tree | |
def | save_pickle |
def | split_random_subset |
def | totally_random_split |
Variables | |
bad = False | |
tuple | data = ds.Dataset(train, resp) |
tuple | dataset = Dataset(inputs, outputs) |
tuple | dt = DecisionTree(data) |
dictionary | extra_args = {'number_of_learners': (i+1)*10} |
tuple | inputs = np.float32(iris_array[:, 0:4]) |
tuple | iris_array = np.matrix(np.loadtxt('iris.data', dtype='|S30', delimiter=',')) |
tuple | new_dt = DecisionTree() |
list | outputs = iris_array[:, 4] |
tuple | packed = dt.pack_tree() |
tuple | pred_new = new_dt.predict(test) |
tuple | pred_old = dt.predict(test) |
list | preds = [] |
tuple | resp = np.mat(np.round(np.random.rand(1, 20))) |
tuple | test = np.mat(np.random.rand(4, 1)) |
test_iris = False | |
test_new_design = True | |
test_number_trees = False | |
test_packing = False | |
test_pca = False | |
test_pickle = False | |
tuple | train = np.mat(np.random.rand(4, 20)) |
list | tree_types = [RFBreiman, RFRandomInputSubset] |
def ml_lib.random_forest.binary_greater_than | ( | attribute, | |
threshold, | |||
input_vec | |||
) |
Definition at line 96 of file random_forest.py.
def ml_lib.random_forest.binary_less_than | ( | attribute, | |
threshold, | |||
input_vec | |||
) |
Definition at line 93 of file random_forest.py.
def ml_lib.random_forest.create_binary_tests | ( | attribute, | |
threshold | |||
) |
Definition at line 99 of file random_forest.py.
def ml_lib.random_forest.evaluate_classifier | ( | building_func, | |
data, | |||
times = 10.0 , |
|||
percentage = None , |
|||
extra_args = {} , |
|||
test_pca = False |
|||
) |
Evaluate classifier by dividing dataset into training and test set.
building_func | Function that will build classifier given data and args in extra_args. |
data | Dataset to use for evaluation/training. |
times | The number of bootstrap samples to take. |
percentage | The percentage of data to use for training. |
extra_args | Extra arguments to pass to building_func. |
Definition at line 278 of file random_forest.py.
def ml_lib.random_forest.load_pickle | ( | filename | ) |
Definition at line 394 of file random_forest.py.
def ml_lib.random_forest.min_entropy_split | ( | dataset | ) |
Find the split that produces subsets with the minimum combined entropy return splitting attribute & splitting point for that attribute.
dataset |
Definition at line 142 of file random_forest.py.
def ml_lib.random_forest.mode_exhaustive | ( | set | ) |
def ml_lib.random_forest.print_separator | ( | times = 2 | ) |
Definition at line 420 of file random_forest.py.
def ml_lib.random_forest.random_subset | ( | subset_size, | |
total_size | |||
) |
Definition at line 164 of file random_forest.py.
def ml_lib.random_forest.random_subset_split | ( | num_subset, | |
dataset | |||
) |
splitter in decision tree
Definition at line 185 of file random_forest.py.
def ml_lib.random_forest.save_pickle | ( | pickle, | |
filename | |||
) |
Definition at line 390 of file random_forest.py.
def ml_lib.random_forest.split_random_subset | ( | subset_size, | |
total_size | |||
) |
Definition at line 173 of file random_forest.py.
def ml_lib.random_forest.totally_random_split | ( | dataset | ) |
Definition at line 193 of file random_forest.py.
Definition at line 457 of file random_forest.py.
tuple ml_lib::random_forest::data = ds.Dataset(train, resp) |
Definition at line 451 of file random_forest.py.
tuple ml_lib::random_forest::dataset = Dataset(inputs, outputs) |
Definition at line 405 of file random_forest.py.
tuple ml_lib::random_forest::dt = DecisionTree(data) |
Definition at line 452 of file random_forest.py.
dictionary ml_lib::random_forest::extra_args = {'number_of_learners': (i+1)*10} |
Definition at line 439 of file random_forest.py.
tuple ml_lib::random_forest::inputs = np.float32(iris_array[:, 0:4]) |
Definition at line 403 of file random_forest.py.
tuple ml_lib::random_forest::iris_array = np.matrix(np.loadtxt('iris.data', dtype='|S30', delimiter=',')) |
Definition at line 402 of file random_forest.py.
tuple ml_lib::random_forest::new_dt = DecisionTree() |
Definition at line 455 of file random_forest.py.
Definition at line 404 of file random_forest.py.
tuple ml_lib::random_forest::packed = dt.pack_tree() |
Definition at line 453 of file random_forest.py.
Definition at line 464 of file random_forest.py.
Definition at line 462 of file random_forest.py.
Definition at line 499 of file random_forest.py.
tuple ml_lib::random_forest::resp = np.mat(np.round(np.random.rand(1, 20))) |
Definition at line 450 of file random_forest.py.
tuple ml_lib::random_forest::test = np.mat(np.random.rand(4, 1)) |
Definition at line 460 of file random_forest.py.
Definition at line 382 of file random_forest.py.
Definition at line 387 of file random_forest.py.
Definition at line 384 of file random_forest.py.
Definition at line 386 of file random_forest.py.
Definition at line 385 of file random_forest.py.
Definition at line 383 of file random_forest.py.
tuple ml_lib::random_forest::train = np.mat(np.random.rand(4, 20)) |
Definition at line 449 of file random_forest.py.
Definition at line 431 of file random_forest.py.