Does DiCE support this kind of model?
When trying to initialize it in this way :
d = dice_ml.Data(dataframe=train, continuous_features=numeric_cols.tolist(), outcome_name='label')
m = dice_ml.Model(model=opt.bestestimator, backend="sklearn")
Initializing DiCE object
exp = dice_ml.Dice(d, m, method="random")
I get the below error:
Is it because DiCE does not support the skorch wrapper?
Thank you!
Hello!
I have trained an ML pipeline for a pytorch model by using the skorch wrapper like this:
nn = NeuralNetBinaryClassifier(nn_model,criterion=nn.BCELoss(),optimizer=torch.optim.AdamW, max_epochs=10, batch_size=32,verbose=False)
numerical_transformer = Pipeline([ ('scaler', StandardScaler()) ])
label_encoded_transformer = Pipeline([ ('label_encoder', OrdinalEncoder()) ])
one_hot_encoded_transformer = Pipeline([ ('one_hot_encoder', OneHotEncoder()) ])
preprocessor = ColumnTransformer( transformers=[ ('num', numerical_transformer,numeric_columns),
('label',label_encoded_transformer,label_encoded_features),
params = { "Modellr": [0.001, 0.01, 0.1], "Modelbatch_size": (16,64), # Different batch sizes "Modeloptimizer": [AdamW, Adam,SGD], # Different optimizers "preprocessornum__scaler": [StandardScaler(), MinMaxScaler(),RobustScaler()] }
ml_pipeline = Pipeline([("preprocessor", preprocessor), ('float32', FunctionTransformer(func=convert_to_float32)), ("Model", nn)])
optimizer = GridSearchCV(ml_pipeline,param_grid=params,optimization_algorithm='grid_search') opt = optimizer.fit(train,train_labels)
Does DiCE support this kind of model? When trying to initialize it in this way : d = dice_ml.Data(dataframe=train, continuous_features=numeric_cols.tolist(), outcome_name='label')
m = dice_ml.Model(model=opt.bestestimator, backend="sklearn")
Initializing DiCE object
exp = dice_ml.Dice(d, m, method="random")
I get the below error:
Is it because DiCE does not support the skorch wrapper? Thank you!