Skip to content

Commit

Permalink
fix(nlu): exclude NaN vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
slvnperron committed Jan 22, 2020
1 parent 035b0fe commit fe44ac2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/nlu/src/backend/engine2/training-pipeline.ts
Expand Up @@ -20,6 +20,7 @@ import CRFExtractor2 from './crf-extractor2'
import { extractListEntities, extractPatternEntities, mapE1toE2Entity } from './entity-extractor'
import { Model } from './model-service'
import Utterance, { buildUtteranceBatch, UtteranceToken, UtteranceToStringOptions } from './utterance'
import { isNumber } from 'util'

// TODO make this return artefacts only and move the make model login in E2
export type Trainer = (input: TrainInput, tools: Tools) => Promise<Model>
Expand Down Expand Up @@ -199,6 +200,7 @@ const trainIntentClassifier = async (
}))
)
.value()
.filter(x => x.coordinates.filter(isNaN).length == 0)

if (points.length > 0) {
const svm = new tools.mlToolkit.SVM.Trainer()
Expand Down Expand Up @@ -231,7 +233,7 @@ const trainContextClassifier = async (
coordinates: utt.sentenceEmbedding
}))
)
})
}).filter(x => x.coordinates.filter(isNaN).length == 0)

if (points.length > 0) {
const svm = new tools.mlToolkit.SVM.Trainer()
Expand Down

0 comments on commit fe44ac2

Please sign in to comment.