Table of Contents

Introduction

Here, in this notebook I will use the model interpretation module dalex for the regression problem of house price prediction.

Load the libraries

Load the libraries

Useful Functions

Parameters

Load the Data

Modelling Xgboost

Model evaluation using xgboost

Model Evaluation using dtreeviz

ShadowXGBDTree(self, 
booster:xgboost.core.Booster,
tree_index:int,
x_data,
y_data,
feature_names:List[str]=None,
target_name:str=None,
class_names:(typing.List[str],typing.Mapping[int, str])=None)

dtreeviz

dtreeviz(tree_model,
x_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,

y_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,
feature_names:List[str]=None,
target_name:str=None,
class_names:(typing.Mapping[numbers.Number, str], typing.List[str])=None,
tree_index:int=None,
precision:int=2,
orientation:('TD', 'LR')='TD',
instance_orientation:('TD', 'LR')='LR',
show_root_edge_labels:bool=True,
show_node_labels:bool=False,
show_just_path:bool=False,
fancy:bool=True,
histtype:('bar', 'barstacked', 'strip')='barstacked',
highlight_path:List[int]=[],
X:numpy.ndarray=None,
max_X_features_LR:int=10,
max_X_features_TD:int=20,
label_fontsize:int=12,
ticks_fontsize:int=8,
fontname:str='Arial',
colors:dict=None,
scale=1.0) -> dtreeviz.trees.DTreeViz

viz_leaf_samples

viz_leaf_samples(tree_model,
x_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,
feature_names:List[str]=None,
tree_index:int=None,
figsize:tuple=(10, 5),
display_type:str='plot',
colors:dict=None,
fontsize:int=14,
fontname:str='Arial',
grid:bool=False,
bins:int=10,
min_samples:int=0,
max_samples:int=None)

describe_node_sample

describe_node_sample(tree_model,
node_id:int,
x_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,
feature_names:List[str]=None,
tree_index:int=None)

explain_prediction_path

explain_prediction_path(tree_model,
x:numpy.ndarray,
x_data=None,
y_data=None,
explanation_type:('plain_english', 'sklearn_default')='plain_english',
feature_names:List[str]=None,
target_name:str=None,
class_names:(typing.Mapping[numbers.Number, str],
typing.List[str])=None,
tree_index:int=None)

viz_leaf_target

viz_leaf_target(tree_model,
x_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,
y_data:(<class 'pandas.core.frame.DataFrame'>, <class 'numpy.ndarray'>)=None,
feature_names:List[str]=None,
target_name:str=None,
tree_index:int=None,
show_leaf_labels:bool=True,
colors:dict=None,
markersize:int=50,
label_fontsize:int=14,
fontname:str='Arial',
precision:int=1,
figsize:tuple=None,
grid:bool=False,
prediction_line_width:int=2)

Time Taken