Custom Python Model runned with no description

Boris
Level 2
Custom Python Model runned with no description

How can I explore a Custom ML model runned on Dataiku succesfully but with no description at the end ? 

I have tried to deploy the model and import it in a python recipe to understand the configuration (best fit model, parameters,...) but I have a Dataiku object in the recipe, and I don't know the functions for dataiku object.

Here is the Gridsearch/ML model:

from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import RobustScaler
from sklearn.model_selection import GridSearchCV



# Pipeline definition with preprocessing ( Robustscaler)

randomF = {}

randomF['pipeline'] = Pipeline([
    ('scaler', RobustScaler()),
    ('rf', RandomForestClassifier())
])


randomF['hyperparameters'] = {}

randomF['hyperparameters']['rf__n_estimators'] = [50, 100, 150, 200]
randomF['hyperparameters']['rf__criterion']  =  ['gini', 'entropy']
randomF['hyperparameters']['rf__min_samples_split']  = [2 , 5]
randomF['hyperparameters']['rf__max_depth'] =  [20, 5, 10]
randomF['hyperparameters']['rf__min_samples_leaf'] =  [2,3]
randomF['hyperparameters']['rf__bootstrap'] = [True, False]
randomF['hyperparameters']['rf__class_weight']  =  [None, 'balanced', 'balanced_subsample']


randomF['gridsearch'] = GridSearchCV(randomF['pipeline'], 
                                    randomF['hyperparameters'],
                                    scoring = "neg_log_loss",
                                    cv = 5,
                                    n_jobs = -1,
                                    refit = True,
                                    fit_params=None,
                                    iid=True,
                                    verbose=0,
                                    pre_dispatch='2*n_jobs'
                                    )
clf = randomF['gridsearch']
0 Kudos
2 Replies
Boris
Level 2
Author

I finally got the way using the dir commande in a python recipe, the attribute '._clf' give access to the trained model and all the sklearn characteristics. 

 

tgb417

@Boris ,

That sounds wonderful.  Would you be willing to share an updated code snip-it showing how you solved this issue?

 

--Tom