def gridsearchCV_strategy(X_tr_data, y_tr_data, list_estimators, list_params):
    "\n    \n    len of list_estimators and list_params should be the same. For any\n    estimator you need a list of parameters to optimize. Eg\n    list_estimators = [RandomForestClassifier(),\n                        LogisticRegression()]\n    list_params = [{'n_estimators': [500,1000],\n    'max_features': [8,10],\n    'max_depth' : [4,6,8],\n    'criterion' :['gini', 'entropy']},'C': [100, 1000], 'solver' : ['lbfgs'],\n                                        'max_iter' : [1000, 2000], 'n_jobs' : [-1]\n                                        }]                    \n    "
    if (len(list_estimators) != len(list_params)):
        raise ValueError('list_estimators and list_params must have the same length')
    class_weights = set_weights(y_tr_data)
    for est in list_estimators:
        est_params = est.get_params()
        if ('class_weight' in est_params):
            est.set_params(class_weight=class_weights)
        if ('n_jobs' in est_params):
            est.set_params(n_jobs=(- 1))
        if ('random_state' in est_params):
            est.set_params(random_state=seed)
    dict_estimators_to_optimize = {}
    for (estimator, parameters) in zip(list_estimators, list_params):
        dict_estimators_to_optimize[estimator] = parameters
    list_optimized_models = [nestedCV(estimator, X_tr_data, y_tr_data, param_grid=parameters) for (estimator, parameters) in dict_estimators_to_optimize.items()]
    return list_optimized_models
len of list_estimators and list_params should be the same. For any
estimator you need a list of parameters to optimize. Eg
list_estimators = [RandomForestClassifier(),
                    LogisticRegression()]
list_params = [{'n_estimators': [500,1000],
'max_features': [8,10],
'max_depth' : [4,6,8],
'criterion' :['gini', 'entropy']},'C': [100, 1000], 'solver' : ['lbfgs'],
                                    'max_iter' : [1000, 2000], 'n_jobs' : [-1]
                                    }]
def gridsearchCV_strategy(X_tr_data, y_tr_data, list_estimators, list_params):
    "\n    \n    len of list_estimators and list_params should be the same. For any\n    estimator you need a list of parameters to optimize. Eg\n    list_estimators = [RandomForestClassifier(),\n                        LogisticRegression()]\n    list_params = [{'n_estimators': [500,1000],\n    'max_features': [8,10],\n    'max_depth' : [4,6,8],\n    'criterion' :['gini', 'entropy']},'C': [100, 1000], 'solver' : ['lbfgs'],\n                                        'max_iter' : [1000, 2000], 'n_jobs' : [-1]\n                                        }]                    \n    "
    if (len(list_estimators) != len(list_params)):
        raise ValueError('list_estimators and list_params must have the same length')
    class_weights = set_weights(y_tr_data)
    for est in list_estimators:
        est_params = est.get_params()
        if ('class_weight' in est_params):
            est.set_params(class_weight=class_weights)
        if ('n_jobs' in est_params):
            est.set_params(n_jobs=(- 1))
        if ('random_state' in est_params):
            est.set_params(random_state=seed)
    dict_estimators_to_optimize = {}
    for (estimator, parameters) in zip(list_estimators, list_params):
        dict_estimators_to_optimize[estimator] = parameters
    list_optimized_models = [nestedCV(estimator, X_tr_data, y_tr_data, param_grid=parameters) for (estimator, parameters) in dict_estimators_to_optimize.items()]
    return list_optimized_models