BernoulliRBM
API and practical guide for BernoulliRBM in @kanaries/ml, including when to use it in JavaScript and TypeScript ML workflows.
NeuralNetwork.BernoulliRBM
constructor(
nComponents: number = 256,
learningRate: number = 0.1,
batchSize: number = 10,
nIter: number = 10
)A Restricted Boltzmann Machine with binary visible units and hidden units. The model is trained with contrastive divergence.
Methods
fit(X: number[][]): voidpartialFit(X: number[][]): voidtransform(X: number[][]): number[][]fitTransform(X: number[][]): number[][]gibbs(V: number[][]): number[][]
Example
const rbm = new BernoulliRBM({ nComponents: 2, nIter: 20 });
rbm.fit(data);
const h = rbm.transform(data);Practical guide: BernoulliRBM in JavaScript and TypeScript
BernoulliRBM learns latent binary representations that can improve downstream supervised model quality.
When to use BernoulliRBM
- You work with binary-valued or binarized feature inputs.
- Feature learning can improve separability for a later classifier.
- You need compact latent features in a JavaScript pipeline.
Implementation workflow
- Prepare binary feature matrix and configure hidden-unit size.
- Fit RBM and generate transformed latent representations.
- Train downstream models on latent features and compare lift.
JavaScript deployment notes
- Prefer feature scaling for distance-based and gradient-based algorithms to improve stability.
- In browser apps, run heavy training in Web Workers to keep UI interactions smooth.
- Keep a simple baseline from the same module as a fallback model for comparison.
Search intents this page targets
BernoulliRBM JavaScriptBernoulliRBM TypeScriptBernoulliRBM browser machine learning@kanaries/ml BernoulliRBM
FAQ
What problem does BernoulliRBM solve in JavaScript machine learning projects?
BernoulliRBM helps teams implement production-ready ML workflows in browser and Node.js environments with a familiar scikit-learn-style API.
When should I choose BernoulliRBM instead of other NeuralNetwork algorithms?
Use BernoulliRBM when it best matches your data shape, labeling strategy, and runtime constraints. Benchmark against at least one alternative in the same module before finalizing defaults.
Can I run BernoulliRBM in both browser and Node.js with @kanaries/ml?
Yes. @kanaries/ml is designed for JavaScript and TypeScript runtimes across browser applications, server-side Node.js services, and edge-friendly workflows.