Forecast for RBM in scikit

I would like to use RBM in scikit. I can define and train RBM, like many other classifiers.

from sklearn.neural_network import BernoulliRBM
clf = BernoulliRBM(random_state=0, verbose=True)
clf.fit(X_train, y_train)

But I can not find a function that makes me a prediction. I am looking for an equivalent for one of the following in scikit.

y_score = clf.decision_function(X_test)
y_score = clf.predict(X_test)

None of the features are present in BernoulliRBM.

+5
source share
1 answer

BernoulliRBM is an uncontrolled method, so you won’t be able to use clf.fit(X_train, y_train)it rather clf.fit(X_train). It is mainly used to extract nonlinear features that can be passed to the classifier. It will look like this:

logistic = linear_model.LogisticRegression()
rbm = BernoulliRBM(random_state=0, verbose=True)

classifier = Pipeline(steps=[('rbm', rbm), ('logistic', logistic)])

, , rbm, LogisticRegression. .

+9

All Articles