class sklearn.neural_network.BernoulliRBM(n_components=256, learning_rate=0.1, batch_size=10, n_iter=10, verbose=0, random_state=None) [source]
Bernoulli Restricted Boltzmann Machine (RBM).
A Restricted Boltzmann Machine with binary visible units and binary hidden units. Parameters are estimated using Stochastic Maximum Likelihood (SML), also known as Persistent Contrastive Divergence (PCD) [2].
The time complexity of this implementation is O(d ** 2) assuming d ~ n_features ~ n_components.
Read more in the User Guide.
| Parameters: |
|
|---|---|
| Attributes: |
|
>>> import numpy as np
>>> from sklearn.neural_network import BernoulliRBM
>>> X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
>>> model = BernoulliRBM(n_components=2)
>>> model.fit(X)
BernoulliRBM(batch_size=10, learning_rate=0.1, n_components=2, n_iter=10,
random_state=None, verbose=0)
fit(X[, y]) | Fit the model to the data X. |
fit_transform(X[, y]) | Fit to data, then transform it. |
get_params([deep]) | Get parameters for this estimator. |
gibbs(v) | Perform one Gibbs sampling step. |
partial_fit(X[, y]) | Fit the model to the data X which should contain a partial segment of the data. |
score_samples(X) | Compute the pseudo-likelihood of X. |
set_params(**params) | Set the parameters of this estimator. |
transform(X) | Compute the hidden layer activation probabilities, P(h=1|v=X). |
__init__(n_components=256, learning_rate=0.1, batch_size=10, n_iter=10, verbose=0, random_state=None) [source]
fit(X, y=None) [source]
Fit the model to the data X.
| Parameters: |
|
|---|---|
| Returns: |
|
fit_transform(X, y=None, **fit_params) [source]
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
| Parameters: |
|
|---|---|
| Returns: |
|
get_params(deep=True) [source]
Get parameters for this estimator.
| Parameters: |
|
|---|---|
| Returns: |
|
gibbs(v) [source]
Perform one Gibbs sampling step.
| Parameters: |
|
|---|---|
| Returns: |
|
partial_fit(X, y=None) [source]
Fit the model to the data X which should contain a partial segment of the data.
| Parameters: |
|
|---|---|
| Returns: |
|
score_samples(X) [source]
Compute the pseudo-likelihood of X.
| Parameters: |
|
|---|---|
| Returns: |
|
This method is not deterministic: it computes a quantity called the free energy on X, then on a randomly corrupted version of X, and returns the log of the logistic function of the difference.
set_params(**params) [source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
| Returns: |
|
|---|
transform(X) [source]
Compute the hidden layer activation probabilities, P(h=1|v=X).
| Parameters: |
|
|---|---|
| Returns: |
|
sklearn.neural_network.BernoulliRBM
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.BernoulliRBM.html