How to convert this to a dictionary?
params = "{'cat_features':[X.columns.get_loc(i) for i in cat_vars],
'num_boost_round':100, 'eta':.01, 'reg_lambda':1.8, 'verbose':False,
'loss_function':'MultiClass','early_stopping_rounds':5}"
without the first part [X.columns.get_loc(i) for i in cat_vars] I can run ast.literal_eval(), but that doesn't work if there is python code in the string. Any idea how to solve this?
evalfunction instead, if you are sure thatX.columns.get_loc(i)has no dependencies on external data source; otherwise the use ofevalwould introduce security risks.