I modified the BernoulliRBM class of scikit-learn to use groups of softmax visible units. In the process, I added an extra Numpy array visible_config as a class attribute which is initialized in the constructor as follows using:
self.visible_config = np.cumsum(np.concatenate((np.asarray([0]),
visible_config), axis=0))
where visible_config is a Numpy array passed as an input to the constructor. The code runs without errors when I directly use the fit() function to train the model. However, when I use the GridSearchCV structure, I get the following error
Cannot clone object SoftmaxRBM(batch_size=100, learning_rate=0.01, n_components=100, n_iter=100,
random_state=0, verbose=True, visible_config=[ 0 21 42 63]), as the constructor does not seem to set parameter visible_config
This seems to be a problem in the equality check between the instance of the class and its copy created by sklearn.base.clone because visible_config does not get copied correctly. I'm not sure how to fix this. It says in the documentation that sklearn.base.clone uses a deepcopy(), so shouldn't visible_config also get copied? Can someone please explain what I can try here? Thanks!