"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimpleNN = void 0;
/* eslint-disable @typescript-eslint/unbound-method */
var tfjs_node_1 = require("@tensorflow/tfjs-node");
var SimpleNN = /** @class */ (function () {
    function SimpleNN(parameters, wordEmbeddingsMatrix) {
        this.parameters = parameters;
        this.wordEmbeddingsMatrix = wordEmbeddingsMatrix;
        this._createModel();
    }
    SimpleNN.prototype._createModel = function () {
        this.model = tfjs_node_1.sequential();
        this._addEmbeddingLayer();
        this._addLSTMLayer();
        this._addDenseLayer();
        this._compile();
        this.model.summary();
    };
    SimpleNN.prototype._addEmbeddingLayer = function () {
        this.model.add(tfjs_node_1.layers.embedding({
            inputDim: this.wordEmbeddingsMatrix.shape[0],
            outputDim: this.wordEmbeddingsMatrix.shape[1],
            inputLength: this.parameters.maxSeqLen,
            trainable: this.parameters.trainableEmbeddings,
            weights: [this.wordEmbeddingsMatrix],
        }));
    };
    SimpleNN.prototype._addLSTMLayer = function () {
        this.model.add(tfjs_node_1.layers.lstm({
            units: 128,
            dropout: 0.3,
            recurrentDropout: 0.3,
        }));
    };
    SimpleNN.prototype._addDenseLayer = function () {
        this.model.add(tfjs_node_1.layers.dense({
            units: this.parameters.intentsCount,
            activation: 'softmax',
        }));
    };
    SimpleNN.prototype._compile = function () {
        this.model.compile({
            optimizer: tfjs_node_1.train.adam(this.parameters.learningRate),
            loss: 'sparseCategoricalCrossentropy',
            metrics: ['accuracy'],
        });
    };
    return SimpleNN;
}());
exports.SimpleNN = SimpleNN;
//# sourceMappingURL=simple-nn.js.map