pipefitter.estimator.DecisionTree

class pipefitter.estimator.DecisionTree(alpha=0, cf_level=0.25, criterion=None, leaf_size=5, max_branches=2, max_depth=6, n_bins=20, prune=False, var_importance=False, target=None, nominals=None, inputs=None)

Bases: pipefitter.base.BaseEstimator

Decision Tree

Parameters:

alpha : float, optional

Specifies the value to use for minimal cost-complexity pruning for regression trees

cf_level : float, optional

Specifies the aggressiveness of tree pruning according to the C4.5 algorithm.

criterion : string, optional

Split criterion. Valid values are ‘variance’, ‘gain’, ‘gain_ratio’, and ‘gini’.

leaf_size : int, optional

Minimum leaf size

max_braches : int, optional

Maximum number of branches

max_depth : int, optional

Maximum depth of trees

n_bins : int, optional

Number of bins to use for numeric variables in the calculation of the decision tree

prune : boolean, optional

Specify True to use a C4.5 pruning method for classification trees or minimal cost-complexity pruning for regression trees

var_importannce : bool, optional

Specifies whether the variable importance information is generated

target : string, optional

The target variable

nominals : string or list of strings, optional

The nominal variables

inputs : string or list of strings, optional

The input variables

Returns:

DecisionTree

Examples

>>> dtree = DecisionTree(target='Origin',
...                      inputs=['MPG_City', 'MPG_Highway', 'Length',
...                              'Weight', 'Type', 'Cylinders'],
...                      nominals = ['Type', 'Cylinders', 'Origin'])
__init__(alpha=0, cf_level=0.25, criterion=None, leaf_size=5, max_branches=2, max_depth=6, n_bins=20, prune=False, var_importance=False, target=None, nominals=None, inputs=None)

Methods

__init__([alpha, cf_level, criterion, ...])
fit(table, \*args, \*\*kwargs) Fit function for decision tree
get_combined_params(\*args, \*\*kwargs) Merge all parameters and verify that they valid
get_filtered_params(\*args, \*\*kwargs) Merge parameters that keys that belong to self
get_param(\*names) Return a copy of the requested parameters
get_params(\*names) Return a copy of the requested parameters
has_param(name) Does the parameter exist?
set_param(\*args, \*\*kwargs) Set one or more parameters
set_params(\*args, \*\*kwargs) Set one or more parameters
transform(table, \*args, \*\*kwargs) Transform function for transformer

Attributes

param_defs
static_params