Documentation
Classes
BernoulliRBM

BernoulliRBM

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.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new BernoulliRBM(opts?: object): BernoulliRBM;

Parameters

NameTypeDescription
opts?object-
opts.batch_size?numberNumber of examples per minibatch. Default Value 10
opts.learning_rate?numberThe learning rate for weight updates. It is highly recommended to tune this hyper-parameter. Reasonable values are in the 10**[0., -3.] range. Default Value 0.1
opts.n_components?numberNumber of binary hidden units. Default Value 256
opts.n_iter?numberNumber of iterations/sweeps over the training dataset to perform during training. Default Value 10
opts.random_state?numberDetermines random number generation for:
opts.verbose?numberThe verbosity level. The default, zero, means silent mode. Range of values is [0, inf]. Default Value 0

Returns

BernoulliRBM

Defined in: generated/neural_network/BernoulliRBM.ts:27 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/neural_network/BernoulliRBM.ts:25 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/neural_network/BernoulliRBM.ts:24 (opens in a new tab)

_py

PythonBridge

Defined in: generated/neural_network/BernoulliRBM.ts:23 (opens in a new tab)

id

string

Defined in: generated/neural_network/BernoulliRBM.ts:20 (opens in a new tab)

opts

any

Defined in: generated/neural_network/BernoulliRBM.ts:21 (opens in a new tab)

Accessors

components_

Weight matrix, where n\_features is the number of visible units and n\_components is the number of hidden units.

Signature

components_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/neural_network/BernoulliRBM.ts:499 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/neural_network/BernoulliRBM.ts:574 (opens in a new tab)

h_samples_

Hidden Activation sampled from the model distribution, where batch\_size is the number of examples per minibatch and n\_components is the number of hidden units.

Signature

h_samples_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/neural_network/BernoulliRBM.ts:524 (opens in a new tab)

intercept_hidden_

Biases of the hidden units.

Signature

intercept_hidden_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/neural_network/BernoulliRBM.ts:449 (opens in a new tab)

intercept_visible_

Biases of the visible units.

Signature

intercept_visible_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/neural_network/BernoulliRBM.ts:474 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/neural_network/BernoulliRBM.ts:549 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/neural_network/BernoulliRBM.ts:72 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/neural_network/BernoulliRBM.ts:76 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/neural_network/BernoulliRBM.ts:131 (opens in a new tab)

fit()

Fit the model to the data X.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeTraining data.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any>

Defined in: generated/neural_network/BernoulliRBM.ts:148 (opens in a new tab)

fit_transform()

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit\_params and returns a transformed version of X.

Signature

fit_transform(opts: object): Promise<any[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Input samples.
opts.fit_params?anyAdditional fit parameters.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any[]>

Defined in: generated/neural_network/BernoulliRBM.ts:190 (opens in a new tab)

get_feature_names_out()

Get output feature names for transformation.

The feature names out will prefixed by the lowercased class name. For example, if the transformer outputs 3 features, then the feature names out are: \["class\_name0", "class\_name1", "class\_name2"\].

Signature

get_feature_names_out(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.input_features?anyOnly used to validate feature names with the names seen in fit.

Returns

Promise<any>

Defined in: generated/neural_network/BernoulliRBM.ts:239 (opens in a new tab)

gibbs()

Perform one Gibbs sampling step.

Signature

gibbs(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
opts.v?ArrayLike[]Values of the visible layer to start from.

Returns

Promise<ArrayLike[]>

Defined in: generated/neural_network/BernoulliRBM.ts:275 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/neural_network/BernoulliRBM.ts:85 (opens in a new tab)

partial_fit()

Fit the model to the partial segment of the data X.

Signature

partial_fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Training data.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any>

Defined in: generated/neural_network/BernoulliRBM.ts:308 (opens in a new tab)

score_samples()

Compute the pseudo-likelihood of X.

Signature

score_samples(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeValues of the visible layer. Must be all-boolean (not checked).

Returns

Promise<ArrayLike>

Defined in: generated/neural_network/BernoulliRBM.ts:348 (opens in a new tab)

set_output()

Set output container.

See Introducing the set_output API for an example on how to use the API.

Signature

set_output(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.transform?"default" | "pandas"Configure output of transform and fit\_transform.

Returns

Promise<any>

Defined in: generated/neural_network/BernoulliRBM.ts:383 (opens in a new tab)

transform()

Compute the hidden layer activation probabilities, P(h=1|v=X).

Signature

transform(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data to be transformed.

Returns

Promise<ArrayLike[]>

Defined in: generated/neural_network/BernoulliRBM.ts:416 (opens in a new tab)