@microsoft/bf-dispatcher
Advanced tools
Comparing version 4.11.0-beta.20200919.b7fef29 to 4.11.0-beta.20200921.2320a67
@@ -33,21 +33,13 @@ /** | ||
static processUnknownLabelsInUtteranceLabelsMapUsingLabelSet(utteranceLabels: { | ||
"utteranceLabelsMap": { | ||
[id: string]: string[]; | ||
}; | ||
"utteranceLabelsMap": Map<string, Set<string>>; | ||
"utteranceLabelDuplicateMap": Map<string, Set<string>>; | ||
}, labelSet: Set<string>): { | ||
"utteranceLabelsMap": { | ||
[id: string]: string[]; | ||
}; | ||
"utteranceLabelsMap": Map<string, Set<string>>; | ||
"utteranceLabelDuplicateMap": Map<string, Set<string>>; | ||
}; | ||
static processUnknownLabelsInUtteranceLabelsMap(utteranceLabels: { | ||
"utteranceLabelsMap": { | ||
[id: string]: string[]; | ||
}; | ||
"utteranceLabelsMap": Map<string, Set<string>>; | ||
"utteranceLabelDuplicateMap": Map<string, Set<string>>; | ||
}): { | ||
"utteranceLabelsMap": { | ||
[id: string]: string[]; | ||
}; | ||
"utteranceLabelsMap": Map<string, Set<string>>; | ||
"utteranceLabelDuplicateMap": Map<string, Set<string>>; | ||
@@ -54,0 +46,0 @@ }; |
@@ -14,14 +14,21 @@ "use strict"; | ||
if (utteranceLabelsMap) { | ||
for (const utteranceKey in utteranceLabelsMap) { | ||
for (const utteranceKey of utteranceLabelsMap.keys()) { | ||
if (utteranceKey) { | ||
const concreteLabels = utteranceLabelsMap[utteranceKey].filter((label) => !DictionaryMapUtility.UnknownLabelSet.has(label.toUpperCase()) && labelSet.has(label)); | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
if (!hasConcreteLabel) { | ||
utteranceLabelsMap[utteranceKey].length = 0; // ---- NOTE ---- truncate the array! | ||
utteranceLabelsMap[utteranceKey].push(DictionaryMapUtility.UnknownLabel); | ||
continue; | ||
try { | ||
const utteranceLabelSet = utteranceLabelsMap.get(utteranceKey); | ||
const concreteLabels = [...utteranceLabelSet].filter((label) => !DictionaryMapUtility.UnknownLabelSet.has(label.toUpperCase()) && labelSet.has(label)); | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
utteranceLabelSet.clear(); // ---- NOTE ---- clear the set! | ||
if (hasConcreteLabel) { | ||
for (const label of concreteLabels) { | ||
utteranceLabelSet.add(label); | ||
} | ||
} | ||
else { | ||
utteranceLabelSet.add(DictionaryMapUtility.UnknownLabel); | ||
} | ||
} | ||
utteranceLabelsMap[utteranceKey].length = 0; // ---- NOTE ---- truncate the array! | ||
for (const label of concreteLabels) { | ||
utteranceLabelsMap[utteranceKey].push(label); | ||
catch (error) { | ||
Utility_1.Utility.debuggingLog(`Utility.processUnknownLabelsInUtteranceLabelsMapUsingLabelSet(), utteranceKey=${utteranceKey}, utteranceLabelsMap=${Utility_1.Utility.jsonStringify(utteranceLabelsMap)}`); | ||
throw error; | ||
} | ||
@@ -36,5 +43,5 @@ } | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
labelsSet.clear(); // ---- NOTE ---- clear the set! | ||
// eslint-disable-next-line max-depth | ||
if (hasConcreteLabel) { | ||
labelsSet.clear(); // ---- NOTE ---- truncate the array! | ||
// eslint-disable-next-line max-depth | ||
@@ -46,3 +53,2 @@ for (const label of concreteLabels) { | ||
else { | ||
labelsSet.clear(); // ---- NOTE ---- truncate the array! | ||
labelsSet.add(DictionaryMapUtility.UnknownLabel); | ||
@@ -58,14 +64,21 @@ } | ||
if (utteranceLabelsMap) { | ||
for (const utteranceKey in utteranceLabelsMap) { | ||
for (const utteranceKey of utteranceLabelsMap.keys()) { | ||
if (utteranceKey) { | ||
const concreteLabels = utteranceLabelsMap[utteranceKey].filter((label) => !DictionaryMapUtility.UnknownLabelSet.has(label.toUpperCase())); | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
if (!hasConcreteLabel) { | ||
utteranceLabelsMap[utteranceKey].length = 0; // ---- NOTE ---- truncate the array! | ||
utteranceLabelsMap[utteranceKey].push(DictionaryMapUtility.UnknownLabel); | ||
continue; | ||
try { | ||
const utteranceLabelSet = utteranceLabelsMap.get(utteranceKey); | ||
const concreteLabels = [...utteranceLabelSet].filter((label) => !DictionaryMapUtility.UnknownLabelSet.has(label.toUpperCase())); | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
utteranceLabelSet.clear(); // ---- NOTE ---- clear the set! | ||
if (hasConcreteLabel) { | ||
for (const label of concreteLabels) { | ||
utteranceLabelSet.add(label); | ||
} | ||
} | ||
else { | ||
utteranceLabelSet.add(DictionaryMapUtility.UnknownLabel); | ||
} | ||
} | ||
utteranceLabelsMap[utteranceKey].length = 0; // ---- NOTE ---- truncate the array! | ||
for (const label of concreteLabels) { | ||
utteranceLabelsMap[utteranceKey].push(label); | ||
catch (error) { | ||
Utility_1.Utility.debuggingLog(`Utility.processUnknownLabelsInUtteranceLabelsMap(), utteranceKey=${utteranceKey}, utteranceLabelsMap=${Utility_1.Utility.jsonStringify(utteranceLabelsMap)}`); | ||
throw error; | ||
} | ||
@@ -80,5 +93,5 @@ } | ||
const hasConcreteLabel = concreteLabels.length > 0; | ||
labelsSet.clear(); // ---- NOTE ---- clear the set! | ||
// eslint-disable-next-line max-depth | ||
if (hasConcreteLabel) { | ||
labelsSet.clear(); // ---- NOTE ---- truncate the array! | ||
// eslint-disable-next-line max-depth | ||
@@ -90,3 +103,2 @@ for (const label of concreteLabels) { | ||
else { | ||
labelsSet.clear(); // ---- NOTE ---- truncate the array! | ||
labelsSet.add(DictionaryMapUtility.UnknownLabel); | ||
@@ -100,3 +112,3 @@ } | ||
const stringIdGenericSetDictionary = {}; | ||
for (const key in stringKeyGenericSetMap) { | ||
for (const key of stringKeyGenericSetMap.keys()) { | ||
if (key) { | ||
@@ -111,3 +123,3 @@ const value = stringKeyGenericSetMap.get(key); | ||
const stringIdGenericValueDictionary = {}; | ||
for (const key in stringKeyGenericValueMap) { | ||
for (const key of stringKeyGenericValueMap.keys()) { | ||
if (key) { | ||
@@ -122,3 +134,3 @@ const value = stringKeyGenericValueMap.get(key); | ||
const numberIdGenericSetDictionary = {}; | ||
for (const key in numberKeyGenericSetMap) { | ||
for (const key of numberKeyGenericSetMap.keys()) { | ||
if (key) { | ||
@@ -135,3 +147,3 @@ // ---- key is already a number, tslint is mistaken that it's a string | ||
const numberIdGenericValueDictionary = {}; | ||
for (const key in numberKeyGenericValueMap) { | ||
for (const key of numberKeyGenericValueMap.keys()) { | ||
if (key) { | ||
@@ -148,3 +160,3 @@ // ---- key is already a number, tslint is mistaken that it's a string | ||
const stringIdGenericSetDictionary = {}; | ||
for (const key in stringKeyGenericSetMap) { | ||
for (const key of stringKeyGenericSetMap.keys()) { | ||
if (key) { | ||
@@ -159,3 +171,3 @@ const value = stringKeyGenericSetMap.get(key); | ||
const stringIdGenericValueDictionary = {}; | ||
for (const key in stringKeyGenericValueMap) { | ||
for (const key of stringKeyGenericValueMap.keys()) { | ||
if (key) { | ||
@@ -170,3 +182,3 @@ const value = stringKeyGenericValueMap.get(key); | ||
const numberIdGenericSetDictionary = {}; | ||
for (const key in numberKeyGenericSetMap) { | ||
for (const key of numberKeyGenericSetMap.keys()) { | ||
if (key) { | ||
@@ -183,3 +195,3 @@ // ---- key is already a number, tslint is mistaken that it's a string | ||
const numberIdGenericValueDictionary = {}; | ||
for (const key in numberKeyGenericValueMap) { | ||
for (const key of numberKeyGenericValueMap.keys()) { | ||
if (key) { | ||
@@ -358,3 +370,3 @@ // ---- key is already a number, tslint is mistaken that it's a string | ||
const stringSet = new Set(inputStringArray); | ||
let stringArray = Array.from(stringSet.values()); | ||
let stringArray = [...stringSet]; | ||
stringArray = Utility_1.Utility.sortStringArray(stringArray); | ||
@@ -371,3 +383,3 @@ const stringMap = DictionaryMapUtility.buildStringIdNumberValueDictionaryFromUniqueStringArray(stringArray); | ||
} | ||
let stringArray = Array.from(stringSet.values()); | ||
let stringArray = [...stringSet]; | ||
stringArray = Utility_1.Utility.sortStringArray(stringArray); | ||
@@ -475,3 +487,3 @@ const stringMap = DictionaryMapUtility.buildStringIdNumberValueDictionaryFromUniqueStringArray(stringArray); | ||
const stringSet = new Set(inputStringArray); | ||
let stringArray = Array.from(stringSet.values()); | ||
let stringArray = [...stringSet]; | ||
stringArray = Utility_1.Utility.sortStringArray(stringArray); | ||
@@ -488,3 +500,3 @@ const stringMap = DictionaryMapUtility.buildStringKeyNumberValueMapFromUniqueStringArray(stringArray); | ||
} | ||
let stringArray = Array.from(stringSet.values()); | ||
let stringArray = [...stringSet]; | ||
stringArray = Utility_1.Utility.sortStringArray(stringArray); | ||
@@ -516,28 +528,28 @@ const stringMap = DictionaryMapUtility.buildStringKeyNumberValueMapFromUniqueStringArray(stringArray); | ||
} | ||
for (const key in stringKeyNumberValueMap) { | ||
for (const key of stringKeyNumberValueMap.keys()) { | ||
if (key) { | ||
// ---- side effect is to remove TSLint warning for | ||
// ---- "in" statements must be filtered with an if statement. | ||
const keyId = stringKeyNumberValueMap.get(key); | ||
if (keyId) { | ||
if ((keyId < 0) || (keyId > stringArray.length)) { | ||
if (throwIfNotLegal) { | ||
throw new Error("(keyId < 0) || (keyId > stringArray.length)"); | ||
} | ||
return false; | ||
// ==== NOTE-keyId-can-be-0 ==== // ---- side effect is to remove TSLint warning for | ||
// ==== NOTE-keyId-can-be-0 ==== // ---- "in" statements must be filtered with an if statement. | ||
// ==== NOTE-keyId-can-be-0 ==== if (keyId) { | ||
if ((keyId < 0) || (keyId > stringArray.length)) { | ||
if (throwIfNotLegal) { | ||
throw new Error("(keyId < 0) || (keyId > stringArray.length)"); | ||
} | ||
const keyRetrieved = stringArray[keyId]; | ||
if (key !== keyRetrieved) { | ||
if (throwIfNotLegal) { | ||
throw new Error("key !== keyRetrieved"); | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
else { | ||
const keyRetrieved = stringArray[keyId]; | ||
if (key !== keyRetrieved) { | ||
if (throwIfNotLegal) { | ||
throw new Error("keyId is undefined in stringKeyNumberValueMap"); | ||
throw new Error("key !== keyRetrieved"); | ||
} | ||
return false; | ||
} | ||
// ==== NOTE-keyId-can-be-0 ==== } else { | ||
// ==== NOTE-keyId-can-be-0 ==== if (throwIfNotLegal) { | ||
// tslint:disable-next-line: max-line-length | ||
// ==== NOTE-keyId-can-be-0 ==== throw new Error("keyId is undefined in stringKeyNumberValueMap"); | ||
// ==== NOTE-keyId-can-be-0 ==== } | ||
// ==== NOTE-keyId-can-be-0 ==== return false; | ||
// ==== NOTE-keyId-can-be-0 ==== } | ||
} | ||
@@ -943,3 +955,3 @@ } | ||
} | ||
for (const key in stringKeyNumberValueMapFirst) { | ||
for (const key of stringKeyNumberValueMapFirst.keys()) { | ||
if (key) { | ||
@@ -965,3 +977,3 @@ if (stringKeyNumberValueMapSecond.has(key)) { | ||
} | ||
for (const key in stringKeyNumberValueMapSecond) { | ||
for (const key of stringKeyNumberValueMapSecond.keys()) { | ||
if (key) { | ||
@@ -1110,48 +1122,48 @@ if (stringKeyNumberValueMapFirst.has(key)) { | ||
static getAnyKeyGenericSetMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getGenericKeyGenericSetMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getNumberKeyGenericSetMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getStringKeyGenericSetMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getAnyKeyGenericValueMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getGenericKeyGenericValueMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getNumberKeyGenericValueMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getStringKeyGenericValueMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getAnyKeyGenericArrayMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getGenericKeyGenericArrayMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getNumberKeyGenericArrayMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getStringKeyGenericArrayMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getAnyKeyGenericArraysMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getGenericKeyGenericArraysMapLength(map) { | ||
return (Object.keys(map).length); | ||
return map.size; | ||
} | ||
static getNumberKeyGenericArraysMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
static getStringKeyGenericArraysMapLength(map) { | ||
return [...map].length; | ||
return map.size; | ||
} | ||
@@ -1158,0 +1170,0 @@ static newTMapAnyKeyGenericSet() { |
@@ -116,9 +116,5 @@ /** | ||
getFeaturizerLabels(): string[]; | ||
getFeaturizerLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getFeaturizerLabelMap(): Map<string, number>; | ||
getFeaturizerFeatures(): string[]; | ||
getFeaturizerFeatureMap(): { | ||
[id: string]: number; | ||
}; | ||
getFeaturizerFeatureMap(): Map<string, number>; | ||
collectUtteranceIndexSetSeedingIntentTrainingSet(seedingUtteranceIndexIntentMapCoveringAllIntentEntityLabels: Map<string, Set<number>>, candidateUtteranceIndexSet: Set<number>, limitInitialNumberOfInstancesPerCategory?: number): { | ||
@@ -125,0 +121,0 @@ "seedingUtteranceIndexIntentMapCoveringAllIntentEntityLabels": Map<string, Set<number>>; |
@@ -10,10 +10,4 @@ import { BinaryConfusionMatrix } from "../mathematics/confusion_matrix/BinaryConfusionMatrix"; | ||
"stringArray": string[]; | ||
"stringMap": { | ||
[id: string]: number; | ||
}; | ||
}, utteranceLabelsMapGroundTruth: { | ||
[id: string]: string[]; | ||
}, utteranceLabelScoresMapPrediction: { | ||
[id: string]: ScoreIntent[]; | ||
}, length: number): Map<string, Array<{ | ||
"stringMap": Map<string, number>; | ||
}, utteranceLabelsMapGroundTruth: Map<string, Set<string>>, utteranceLabelScoresMapPrediction: Map<string, ScoreIntent[]>, length: number): Map<string, Array<{ | ||
"score": number; | ||
@@ -25,10 +19,4 @@ "index": number; | ||
"stringArray": string[]; | ||
"stringMap": { | ||
[id: string]: number; | ||
}; | ||
}, utteranceEntityLabelsMapGroundTruth: { | ||
[id: string]: Label[]; | ||
}, utteranceEntityLabelScoresMapPrediction: { | ||
[id: string]: ScoreEntity[]; | ||
}, length: number): Map<string, Array<{ | ||
"stringMap": Map<string, number>; | ||
}, utteranceEntityLabelsMapGroundTruth: Map<string, Label[]>, utteranceEntityLabelScoresMapPrediction: Map<string, ScoreEntity[]>, length: number): Map<string, Array<{ | ||
"score": number; | ||
@@ -40,50 +28,21 @@ "index": number; | ||
"stringArray": string[]; | ||
"stringMap": { | ||
[id: string]: number; | ||
}; | ||
}, utteranceLabelsMapGroundTruth: { | ||
[id: string]: string[]; | ||
}, utteranceLabelScoresMapPrediction: { | ||
[id: string]: ScoreIntent[]; | ||
}): Map<string, ScoreIntentUtterancePrediction[]>; | ||
"stringMap": Map<string, number>; | ||
}, utteranceLabelsMapGroundTruth: Map<string, Set<string>>, utteranceLabelScoresMapPrediction: Map<string, ScoreIntent[]>): Map<string, ScoreIntentUtterancePrediction[]>; | ||
static evaluateIntentUtterancePredictionScoresLabelOriented(labelArrayAndMap: { | ||
"stringArray": string[]; | ||
"stringMap": { | ||
[id: string]: number; | ||
}; | ||
}, utteranceLabelsMapGroundTruth: { | ||
[id: string]: string[]; | ||
}, utteranceLabelScoresMapPrediction: { | ||
[id: string]: ScoreIntent[]; | ||
}): Map<string, ScoreIntentUtterancePrediction[]>; | ||
"stringMap": Map<string, number>; | ||
}, utteranceLabelsMapGroundTruth: Map<string, Set<string>>, utteranceLabelScoresMapPrediction: Map<string, ScoreIntent[]>): Map<string, ScoreIntentUtterancePrediction[]>; | ||
static evaluateEntityUtterancePredictionScores(labelArrayAndMap: { | ||
"stringArray": string[]; | ||
"stringMap": { | ||
[id: string]: number; | ||
}; | ||
}, utteranceEntityLabelsMapGroundTruth: { | ||
[id: string]: Label[]; | ||
}, utteranceEntityLabelScoresMapPrediction: { | ||
[id: string]: ScoreEntity[]; | ||
}): Map<string, ScoreEntityUtterancePrediction[]>; | ||
static getJsonIntentsEntitiesUtterances(jsonObjectArray: any, hierarchicalLabel: string, utteranceLabelsMap: { | ||
[id: string]: string[]; | ||
}, utteranceLabelDuplicateMap: Map<string, Set<string>>, utteranceEntityLabelsMap: { | ||
[id: string]: Label[]; | ||
}, utteranceEntityLabelDuplicateMap: Map<string, Label[]>): boolean; | ||
static getJsonIntentEntityScoresUtterances(jsonObjectArray: any, utteranceLabelScoresMap: { | ||
[id: string]: ScoreIntent[]; | ||
}, utteranceEntityLabelScoresMap: { | ||
[id: string]: ScoreEntity[]; | ||
}): boolean; | ||
"stringMap": Map<string, number>; | ||
}, utteranceEntityLabelsMapGroundTruth: Map<string, Label[]>, utteranceEntityLabelScoresMapPrediction: Map<string, ScoreEntity[]>): Map<string, ScoreEntityUtterancePrediction[]>; | ||
static getJsonIntentsEntitiesUtterances(jsonObjectArray: any, hierarchicalLabel: string, utteranceLabelsMap: Map<string, Set<string>>, utteranceLabelDuplicateMap: Map<string, Set<string>>, utteranceEntityLabelsMap: Map<string, Label[]>, utteranceEntityLabelDuplicateMap: Map<string, Label[]>): boolean; | ||
static getJsonIntentEntityScoresUtterances(jsonObjectArray: any, utteranceLabelScoresMap: Map<string, ScoreIntent[]>, utteranceEntityLabelScoresMap: Map<string, ScoreEntity[]>): boolean; | ||
static insertStringPairToStringIdStringSetNativeMap(key: string, value: string, stringKeyStringSetMap: Map<string, Set<string>>): Map<string, Set<string>>; | ||
static insertStringLabelPairToStringIdLabelSetNativeMap(key: string, value: Label, stringKeyLabelSetMap: Map<string, Label[]>): Map<string, Label[]>; | ||
static addNewLabelUtterance(utterance: string, label: string, hierarchicalLabel: string, utteranceLabelsMap: { | ||
[id: string]: string[]; | ||
}, utteranceLabelDuplicateMap: Map<string, Set<string>>): void; | ||
static addNewEntityLabelUtterance(utterance: string, entityEntry: any, utteranceEntityLabelsMap: { | ||
[id: string]: Label[]; | ||
}, utteranceEntityLabelDuplicateMap: Map<string, Label[]>): void; | ||
static addUniqueLabel(newLabel: string, labels: string[]): boolean; | ||
static addUniqueEntityLabel(newLabel: Label, labels: Label[]): boolean; | ||
static addNewLabelUtterance(utterance: string, label: string, hierarchicalLabel: string, utteranceLabelsMap: Map<string, Set<string>>, utteranceLabelDuplicateMap: Map<string, Set<string>>): void; | ||
static addNewEntityLabelUtterance(utterance: string, entityEntry: any, utteranceEntityLabelsMap: Map<string, Label[]>, utteranceEntityLabelDuplicateMap: Map<string, Label[]>): void; | ||
static addUniqueLabel(newLabel: string, labels: Set<string>): boolean; | ||
static addUniqueLabelToArray(newLabel: string, labels: string[]): boolean; | ||
static addUniqueEntityLabelToArray(newLabel: Label, labels: Label[]): boolean; | ||
} |
@@ -136,7 +136,7 @@ "use strict"; | ||
}); | ||
const utterances = Object.keys(utteranceLabelsMapGroundTruth); | ||
const utterances = [...utteranceLabelsMapGroundTruth.keys()]; | ||
utterances.forEach((utterance) => { | ||
const utteranceGroundTruthLabels = utteranceLabelsMapGroundTruth[utterance]; | ||
if (utteranceLabelScoresMapPrediction.hasOwnProperty(utterance)) { | ||
const utteranceIntentPredictionScores = utteranceLabelScoresMapPrediction[utterance]; | ||
const utteranceGroundTruthLabels = utteranceLabelsMapGroundTruth.get(utterance); | ||
if (utteranceLabelScoresMapPrediction.has(utterance)) { | ||
const utteranceIntentPredictionScores = utteranceLabelScoresMapPrediction.get(utterance); | ||
utteranceIntentPredictionScores.forEach((utteranceIntentPredictionScore) => { | ||
@@ -194,5 +194,5 @@ const utteranceIntentPredictionScoreLabel = utteranceIntentPredictionScore.intent; | ||
labeScoreIntentUtterancePredictionsMap.set(label, perLabeScoreIntentUtterancePredictions); | ||
const utterances = Object.keys(utteranceLabelsMapGroundTruth); | ||
const utterances = [...utteranceLabelsMapGroundTruth.keys()]; | ||
utterances.map((utterance) => { | ||
const utteranceGroundTruthLabels = utteranceLabelsMapGroundTruth[utterance]; | ||
const utteranceGroundTruthLabels = utteranceLabelsMapGroundTruth.get(utterance); | ||
let isInGroundTruthPositive = false; | ||
@@ -206,4 +206,4 @@ for (const utteranceGroundTruthLabel of utteranceGroundTruthLabels) { | ||
let labelScore = 0; | ||
if (utteranceLabelScoresMapPrediction.hasOwnProperty(utterance)) { | ||
const utteranceIntentPredictionScores = utteranceLabelScoresMapPrediction[utterance]; | ||
if (utteranceLabelScoresMapPrediction.has(utterance)) { | ||
const utteranceIntentPredictionScores = utteranceLabelScoresMapPrediction.get(utterance); | ||
for (const utteranceIntentPredictionScore of utteranceIntentPredictionScores) { | ||
@@ -227,7 +227,7 @@ if (utteranceIntentPredictionScore.intent === label) { | ||
}); | ||
const utterances = Object.keys(utteranceEntityLabelsMapGroundTruth); | ||
const utterances = [...utteranceEntityLabelsMapGroundTruth.keys()]; | ||
utterances.forEach((utterance) => { | ||
const utteranceGroundTruthLabels = utteranceEntityLabelsMapGroundTruth[utterance]; | ||
if (utteranceEntityLabelScoresMapPrediction.hasOwnProperty(utterance)) { | ||
const utteranceEntityPredictionScores = utteranceEntityLabelScoresMapPrediction[utterance]; | ||
const utteranceGroundTruthLabels = utteranceEntityLabelsMapGroundTruth.get(utterance); | ||
if (utteranceEntityLabelScoresMapPrediction.has(utterance)) { | ||
const utteranceEntityPredictionScores = utteranceEntityLabelScoresMapPrediction.get(utterance); | ||
utteranceEntityPredictionScores.forEach((utteranceEntityPredictionScore) => { | ||
@@ -317,7 +317,7 @@ const utteranceEntityPredictionScoreLabel = utteranceEntityPredictionScore.entity; | ||
const intentScores = jsonObject.intent_scores; | ||
utteranceLabelScoresMap[utterance] = intentScores.map((intentScore) => { | ||
utteranceLabelScoresMap.set(utterance, intentScores.map((intentScore) => { | ||
const intent = intentScore.intent; | ||
const score = intentScore.score; | ||
return ScoreIntent_1.ScoreIntent.newScoreIntent(intent, score); | ||
}); | ||
})); | ||
} | ||
@@ -327,3 +327,3 @@ // eslint-disable-next-line no-prototype-builtins | ||
const entityScores = jsonObject.entity_scores; | ||
utteranceEntityLabelScoresMap[utterance] = entityScores.map((entityScore) => { | ||
utteranceEntityLabelScoresMap.set(utterance, entityScores.map((entityScore) => { | ||
const entity = entityScore.entity; | ||
@@ -334,3 +334,3 @@ const startPos = entityScore.startPos; | ||
return ScoreEntity_1.ScoreEntity.newScoreEntityByPosition(entity, score, startPos, endPos); | ||
}); | ||
})); | ||
} | ||
@@ -375,3 +375,3 @@ }); | ||
} | ||
LabelStructureUtility.addUniqueEntityLabel(value, labelSet); | ||
LabelStructureUtility.addUniqueEntityLabelToArray(value, labelSet); | ||
} | ||
@@ -386,4 +386,4 @@ else { | ||
static addNewLabelUtterance(utterance, label, hierarchicalLabel, utteranceLabelsMap, utteranceLabelDuplicateMap) { | ||
const existingLabels = utteranceLabelsMap[utterance]; | ||
if (existingLabels) { | ||
if (utteranceLabelsMap.has(utterance)) { | ||
const existingLabels = utteranceLabelsMap.get(utterance); | ||
if (hierarchicalLabel && hierarchicalLabel.length > 0) { | ||
@@ -399,10 +399,17 @@ if (!LabelStructureUtility.addUniqueLabel(hierarchicalLabel, existingLabels)) { | ||
else if (hierarchicalLabel && hierarchicalLabel.length > 0) { | ||
utteranceLabelsMap[utterance] = [hierarchicalLabel]; | ||
const labelSet = new Set(); | ||
labelSet.add(hierarchicalLabel); | ||
utteranceLabelsMap.set(utterance, labelSet); | ||
} | ||
else { | ||
utteranceLabelsMap[utterance] = [label]; | ||
const labelSet = new Set(); | ||
labelSet.add(label); | ||
utteranceLabelsMap.set(utterance, labelSet); | ||
} | ||
} | ||
static addNewEntityLabelUtterance(utterance, entityEntry, utteranceEntityLabelsMap, utteranceEntityLabelDuplicateMap) { | ||
let existingEntityLabels = utteranceEntityLabelsMap[utterance]; | ||
let existingEntityLabels = []; | ||
if (utteranceEntityLabelsMap.has(utterance)) { | ||
existingEntityLabels = utteranceEntityLabelsMap.get(utterance); | ||
} | ||
const entity = entityEntry.entity; | ||
@@ -414,3 +421,3 @@ const startPos = Number(entityEntry.startPos); | ||
if (existingEntityLabels) { | ||
if (!LabelStructureUtility.addUniqueEntityLabel(entityLabel, existingEntityLabels)) { | ||
if (!LabelStructureUtility.addUniqueEntityLabelToArray(entityLabel, existingEntityLabels)) { | ||
LabelStructureUtility.insertStringLabelPairToStringIdLabelSetNativeMap(utterance, entityLabel, utteranceEntityLabelDuplicateMap); | ||
@@ -421,3 +428,3 @@ } | ||
existingEntityLabels = [entityLabel]; | ||
utteranceEntityLabelsMap[utterance] = existingEntityLabels; | ||
utteranceEntityLabelsMap.set(utterance, existingEntityLabels); | ||
} | ||
@@ -427,2 +434,16 @@ } | ||
try { | ||
if (labels.has(newLabel)) { | ||
return false; | ||
} | ||
labels.add(newLabel); | ||
return true; | ||
} | ||
catch (error) { | ||
Utility_1.Utility.debuggingLog(`EXCEPTION calling addUniqueLabel(), error='${error}', newLabel='${newLabel}', labels='${labels}'`); | ||
throw error; | ||
} | ||
return false; | ||
} | ||
static addUniqueLabelToArray(newLabel, labels) { | ||
try { | ||
for (const label of labels) { | ||
@@ -437,3 +458,3 @@ if (label === newLabel) { | ||
catch (error) { | ||
Utility_1.Utility.debuggingLog(`EXCEPTION calling addUniqueLabel(), error='${error}', newLabel=${newLabel}, labels=${labels}`); | ||
Utility_1.Utility.debuggingLog(`EXCEPTION calling addUniqueLabelToArray(), error='${error}', newLabel=${newLabel}, labels=${labels}`); | ||
throw error; | ||
@@ -443,3 +464,3 @@ } | ||
} | ||
static addUniqueEntityLabel(newLabel, labels) { | ||
static addUniqueEntityLabelToArray(newLabel, labels) { | ||
try { | ||
@@ -455,3 +476,3 @@ for (const label of labels) { | ||
catch (error) { | ||
Utility_1.Utility.debuggingLog(`EXCEPTION calling addUniqueEntityLabel(), error='${error}', newLabel=${newLabel}, labels=${labels}`); | ||
Utility_1.Utility.debuggingLog(`EXCEPTION calling addUniqueEntityLabelToArray(), error='${error}', newLabel=${newLabel}, labels=${labels}`); | ||
throw error; | ||
@@ -458,0 +479,0 @@ } |
@@ -9,5 +9,3 @@ /** | ||
"labels": string[]; | ||
"labelMap": { | ||
[id: string]: number; | ||
}; | ||
"labelMap": Map<string, number>; | ||
"binaryConfusionMatrices": BinaryConfusionMatrix[]; | ||
@@ -14,0 +12,0 @@ "confusionMatrix": ConfusionMatrix; |
@@ -22,5 +22,5 @@ "use strict"; | ||
let labels = []; | ||
let labelMap = {}; | ||
let labelMap = new Map(); | ||
if (!Utility_1.Utility.isEmptyString(labelFilename)) { | ||
const labelsAndLabelMap = DictionaryMapUtility_1.DictionaryMapUtility.buildStringIdNumberValueDictionaryFromUniqueStringArrayFile(labelFilename); | ||
const labelsAndLabelMap = DictionaryMapUtility_1.DictionaryMapUtility.buildStringKeyNumberValueMapFromUniqueStringArrayFile(labelFilename); | ||
labels = labelsAndLabelMap.stringArray; | ||
@@ -218,6 +218,6 @@ labelMap = labelsAndLabelMap.stringMap; | ||
const labels = ["label0", "label1", "label2"]; | ||
const labelMap = {}; | ||
labelMap.label0 = 0; | ||
labelMap.label1 = 1; | ||
labelMap.label2 = 2; | ||
const labelMap = new Map(); | ||
labelMap.set("label0", 0); | ||
labelMap.set("label1", 1); | ||
labelMap.set("label2", 2); | ||
const confusionMatrix = new ConfusionMatrix_1.ConfusionMatrix(labels, labelMap); | ||
@@ -224,0 +224,0 @@ confusionMatrix.addInstanceByLabel("label0", "label0"); |
@@ -100,5 +100,3 @@ /** | ||
getSupport(): number; | ||
getBasicMetrics(): { | ||
[id: string]: number; | ||
}; | ||
getBasicMetrics(): Map<string, number>; | ||
getHits(): number; | ||
@@ -227,5 +225,3 @@ getCorrectRejections(): number; | ||
getJaccardDenominatorMaxCoefficient(): number; | ||
getMetrics(explicitTotal?: number, explicitTotalPositives?: number, explicitTotalNegatives?: number, fMeasureBeta?: number, effectivenessMeasureAlpha?: number, rejectRate?: number, alpha?: number, beta?: number, A?: number, B?: number, explicitMaxPositives?: number): { | ||
[id: string]: number; | ||
}; | ||
getMetrics(explicitTotal?: number, explicitTotalPositives?: number, explicitTotalNegatives?: number, fMeasureBeta?: number, effectivenessMeasureAlpha?: number, rejectRate?: number, alpha?: number, beta?: number, A?: number, B?: number, explicitMaxPositives?: number): Map<string, number>; | ||
getMetricNameMap(): IDictionaryStringIdGenericValue<number>; | ||
@@ -232,0 +228,0 @@ getMetricNames(): string[]; |
@@ -13,5 +13,3 @@ /** | ||
protected confusionMatrixTotal: number; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
reset(): void; | ||
@@ -18,0 +16,0 @@ addFrom(other: ConfusionMatrix): void; |
@@ -38,3 +38,3 @@ "use strict"; | ||
Utility_1.Utility.validateStringArrayPairEquality(this.labels, other.labels); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringIdNumberValueDictionaryPair(this.labelMap, other.labelMap); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringKeyNumberValueMapPair(this.labelMap, other.labelMap); | ||
this.confusionMatrixTotal += other.confusionMatrixTotal; | ||
@@ -73,4 +73,4 @@ const numberLabels = this.getNumberLabels(); | ||
this.validateLabel(predictedLabel); | ||
const groundTrueLabelId = this.labelMap[groundTrueLabel]; | ||
const predictedLabelId = this.labelMap[predictedLabel]; | ||
const groundTrueLabelId = this.labelMap.get(groundTrueLabel); | ||
const predictedLabelId = this.labelMap.get(predictedLabel); | ||
this.addInstanceByLabelIndex(groundTrueLabelId, predictedLabelId, value); | ||
@@ -77,0 +77,0 @@ } |
@@ -9,19 +9,9 @@ /** | ||
protected labels: string[]; | ||
protected labelMap: { | ||
[id: string]: number; | ||
}; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
protected labelMap: Map<string, number>; | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
abstract reset(): void; | ||
generateConfusionMatrixMetricStructure(quantileConfiguration?: number): { | ||
"confusionMatrix": IConfusionMatrix; | ||
"labelBinaryConfusionMatrixBasicMetricMap": { | ||
[id: string]: { | ||
[id: string]: number; | ||
}; | ||
}; | ||
"labelBinaryConfusionMatrixMap": { | ||
[id: string]: BinaryConfusionMatrix; | ||
}; | ||
"labelBinaryConfusionMatrixBasicMetricMap": Map<string, Map<string, number>>; | ||
"labelBinaryConfusionMatrixMap": Map<string, BinaryConfusionMatrix>; | ||
"microQuantileMetrics": { | ||
@@ -141,5 +131,3 @@ "quantilesPrecisions": number[]; | ||
getLabels(): string[]; | ||
getLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getLabelMap(): Map<string, number>; | ||
abstract getBinaryConfusionMatrices(): BinaryConfusionMatrix[]; | ||
@@ -260,5 +248,3 @@ getTotal(binaryConfusionMatrices?: BinaryConfusionMatrix[]): number; | ||
validateLabel(label: string, throwIfNotLegal?: boolean): boolean; | ||
protected resetLabelsAndMap(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}): void; | ||
protected resetLabelsAndMap(labels: string[], labelMap: Map<string, number>): void; | ||
} |
@@ -14,3 +14,3 @@ "use strict"; | ||
this.labels = []; | ||
this.labelMap = {}; | ||
this.labelMap = new Map(); | ||
this.resetLabelsAndMap(labels, labelMap); | ||
@@ -22,4 +22,10 @@ } | ||
const labelMap = confusionMatrix.getLabelMap(); | ||
const labelBinaryConfusionMatrixBasicMetricMap = Object.entries(labelMap).reduce((accumulant, [id, value]) => (Object.assign(Object.assign({}, accumulant), { [id]: crossValidationBinaryConfusionMatrix[value].getBasicMetrics() })), {}); | ||
const labelBinaryConfusionMatrixMap = Object.entries(labelMap).reduce((accumulant, [id, value]) => (Object.assign(Object.assign({}, accumulant), { [id]: crossValidationBinaryConfusionMatrix[value] })), {}); | ||
const labelBinaryConfusionMatrixBasicMetricMap = new Map(); | ||
labelMap.forEach((value, key) => { | ||
labelBinaryConfusionMatrixBasicMetricMap.set(key, crossValidationBinaryConfusionMatrix[value].getBasicMetrics()); | ||
}); | ||
const labelBinaryConfusionMatrixMap = new Map(); | ||
labelMap.forEach((value, key) => { | ||
labelBinaryConfusionMatrixMap.set(key, crossValidationBinaryConfusionMatrix[value]); | ||
}); | ||
const binaryConfusionMatrices = confusionMatrix.getBinaryConfusionMatrices(); | ||
@@ -665,3 +671,3 @@ const microQuantileMetrics = confusionMatrix.getMicroQuantileMetrics(binaryConfusionMatrices, quantileConfiguration); | ||
validateLabel(label, throwIfNotLegal = true) { | ||
if (!(label in this.getLabelMap())) { | ||
if (!this.getLabelMap().has(label)) { | ||
if (throwIfNotLegal) { | ||
@@ -675,3 +681,3 @@ Utility_1.Utility.debuggingThrow(`label=${label}, not int the label map=${Utility_1.Utility.jsonStringify(this.getLabelMap())}`); | ||
resetLabelsAndMap(labels, labelMap) { | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringIdNumberValueDictionary(labels, labelMap); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringKeyNumberValueMap(labels, labelMap); | ||
this.labels = labels; | ||
@@ -678,0 +684,0 @@ this.labelMap = labelMap; |
@@ -10,10 +10,4 @@ /** | ||
"confusionMatrix": IConfusionMatrix; | ||
"labelBinaryConfusionMatrixBasicMetricMap": { | ||
[id: string]: { | ||
[id: string]: number; | ||
}; | ||
}; | ||
"labelBinaryConfusionMatrixMap": { | ||
[id: string]: BinaryConfusionMatrix; | ||
}; | ||
"labelBinaryConfusionMatrixBasicMetricMap": Map<string, Map<string, number>>; | ||
"labelBinaryConfusionMatrixMap": Map<string, BinaryConfusionMatrix>; | ||
"microQuantileMetrics": { | ||
@@ -133,5 +127,3 @@ "quantilesPrecisions": number[]; | ||
getLabels(): string[]; | ||
getLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getLabelMap(): Map<string, number>; | ||
getBinaryConfusionMatrices(): BinaryConfusionMatrix[]; | ||
@@ -138,0 +130,0 @@ getTotal(binaryConfusionMatrices: BinaryConfusionMatrix[]): number; |
@@ -9,7 +9,5 @@ /** | ||
export declare class LabelObjectConfusionMatrix extends ConfusionMatrix implements ISingleLabelObjectConfusionMatrix { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelObject(groundTrueLabel: Label, predictedLabel: Label, value?: number): void; | ||
validateLabelObject(label: Label, throwIfNotLegal?: boolean): boolean; | ||
} |
@@ -17,8 +17,8 @@ "use strict"; | ||
this.validateLabelObject(predictedLabel); | ||
const groundTrueLabelId = this.labelMap[groundTrueLabel.name]; | ||
const predictedLabelId = this.labelMap[predictedLabel.name]; | ||
const groundTrueLabelId = this.labelMap.get(groundTrueLabel.name); | ||
const predictedLabelId = this.labelMap.get(predictedLabel.name); | ||
this.addInstanceByLabelIndex(groundTrueLabelId, predictedLabelId, value); | ||
} | ||
validateLabelObject(label, throwIfNotLegal = true) { | ||
if (!(label.name in this.getLabelMap())) { | ||
if (!this.getLabelMap().has(label.name)) { | ||
if (throwIfNotLegal) { | ||
@@ -25,0 +25,0 @@ Utility_1.Utility.debuggingThrow(`label=${label}, not int the label map=${Utility_1.Utility.jsonStringify(this.getLabelMap())}`); |
@@ -9,6 +9,4 @@ /** | ||
export declare abstract class LabelObjectConfusionMatrixBase extends ConfusionMatrixBase implements ILabelObjectConfusionMatrix { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
validateLabelObject(label: Label, throwIfNotLegal?: boolean): boolean; | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
validateLabelObject(label, throwIfNotLegal = true) { | ||
if (!(label.name in this.getLabelMap())) { | ||
if (!this.getLabelMap().has(label.name)) { | ||
if (throwIfNotLegal) { | ||
@@ -18,0 +18,0 @@ Utility_1.Utility.debuggingThrow(`label=${label}, not int the label map=${Utility_1.Utility.jsonStringify(this.getLabelMap())}`); |
@@ -9,6 +9,4 @@ /** | ||
static evaluateMultiLabelPrediction(groundTruths: any[], predictions: any[]): number[]; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -10,5 +10,3 @@ /** | ||
protected binaryConfusionMatrices: BinaryConfusionMatrix[]; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addFrom(other: MultiLabelConfusionMatrixBase): void; | ||
@@ -15,0 +13,0 @@ abstract addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value: number): void; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Utility_1.Utility.validateStringArrayPairEquality(this.labels, other.labels); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringIdNumberValueDictionaryPair(this.labelMap, other.labelMap); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringKeyNumberValueMapPair(this.labelMap, other.labelMap); | ||
const numbergetBinaryConfusionMatrices = this.getBinaryConfusionMatrices().length; | ||
@@ -28,4 +28,4 @@ for (let l = 0; l < numbergetBinaryConfusionMatrices; l++) { | ||
this.validateLabels(predictedLabels); | ||
const groundTrueLabelIds = groundTrueLabels.map((x) => this.labelMap[x]); | ||
const predictedLabelIds = predictedLabels.map((x) => this.labelMap[x]); | ||
const groundTrueLabelIds = groundTrueLabels.map((x) => this.labelMap.get(x)); | ||
const predictedLabelIds = predictedLabels.map((x) => this.labelMap.get(x)); | ||
this.addInstanceByLabelIndexes(groundTrueLabelIds, predictedLabelIds, value); | ||
@@ -32,0 +32,0 @@ } |
@@ -7,6 +7,4 @@ /** | ||
export declare class MultiLabelConfusionMatrixExact extends MultiLabelConfusionMatrixWithBinaryBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -7,6 +7,4 @@ /** | ||
export declare class MultiLabelConfusionMatrixSubset extends MultiLabelConfusionMatrixWithBinaryBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -7,6 +7,4 @@ /** | ||
export declare abstract class MultiLabelConfusionMatrixWithBinaryArrayBase extends MultiLabelConfusionMatrixBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
reset(): void; | ||
} |
@@ -9,5 +9,3 @@ /** | ||
protected binaryConfusionMatrix: BinaryConfusionMatrix; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
reset(): void; | ||
@@ -14,0 +12,0 @@ getBinaryConfusionMatrix(): BinaryConfusionMatrix; |
@@ -8,7 +8,5 @@ /** | ||
export declare class MultiLabelObjectConfusionMatrix extends MultiLabelObjectConfusionMatrixWithBinaryArrayBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelObjects(groundTrueLabels: Label[], predictedLabels: Label[], value?: number): void; | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -31,3 +31,3 @@ "use strict"; | ||
// ---- NOTE-PLACE-HOLDER-FOR-TRACING ---- } | ||
const predictedLabelId = this.labelMap[predictedLabel.name]; | ||
const predictedLabelId = this.labelMap.get(predictedLabel.name); | ||
if (predictedIsInGroundTruth) { | ||
@@ -55,3 +55,3 @@ this.getBinaryConfusionMatrices()[predictedLabelId].addToTruePositives(value, false); | ||
if (!groundTruthIsInPredicted) { | ||
const groundTrueLabelId = this.labelMap[groundTrueLabel.name]; | ||
const groundTrueLabelId = this.labelMap.get(groundTrueLabel.name); | ||
this.getBinaryConfusionMatrices()[groundTrueLabelId].addToFalseNegatives(value, false); | ||
@@ -58,0 +58,0 @@ } |
@@ -9,5 +9,3 @@ /** | ||
export declare abstract class MultiLabelObjectConfusionMatrixBase extends MultiLabelConfusionMatrixBase implements IMultiLabelObjectConfusionMatrix { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
abstract addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value: number): void; | ||
@@ -14,0 +12,0 @@ abstract addInstanceByLabelObjects(groundTrueLabels: Label[], predictedLabels: Label[], value: number): void; |
@@ -23,3 +23,3 @@ "use strict"; | ||
validateLabelObject(label, throwIfNotLegal = true) { | ||
if (!(label.name in this.getLabelMap())) { | ||
if (!this.getLabelMap().has(label.name)) { | ||
if (throwIfNotLegal) { | ||
@@ -26,0 +26,0 @@ Utility_1.Utility.debuggingThrow(`label=${label}, not int the label map=${Utility_1.Utility.jsonStringify(this.getLabelMap())}`); |
@@ -8,7 +8,5 @@ /** | ||
export declare class MultiLabelObjectConfusionMatrixExact extends MultiLabelObjectConfusionMatrixWithBinaryBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelObjects(groundTrueLabels: Label[], predictedLabels: Label[], value?: number): void; | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -26,3 +26,3 @@ "use strict"; | ||
} | ||
const predictedLabelId = this.labelMap[predictedLabel.name]; | ||
const predictedLabelId = this.labelMap.get(predictedLabel.name); | ||
if (predictedIsInGroundTruth) { | ||
@@ -43,3 +43,3 @@ this.getBinaryConfusionMatrices()[predictedLabelId].addToTruePositives(value, false); | ||
} | ||
const groundTrueLabelId = this.labelMap[groundTrueLabel.name]; | ||
const groundTrueLabelId = this.labelMap.get(groundTrueLabel.name); | ||
if (!groundTruthIsInPredicted) { | ||
@@ -46,0 +46,0 @@ this.getBinaryConfusionMatrices()[groundTrueLabelId].addToFalseNegatives(value, false); |
@@ -8,7 +8,5 @@ /** | ||
export declare class MultiLabelObjectConfusionMatrixSubset extends MultiLabelObjectConfusionMatrixWithBinaryBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
addInstanceByLabelObjects(groundTrueLabels: Label[], predictedLabels: Label[], value?: number): void; | ||
addInstanceByLabelIndexes(groundTrueLabelIds: number[], predictedLabelIds: number[], value?: number): void; | ||
} |
@@ -26,3 +26,3 @@ "use strict"; | ||
} | ||
const predictedLabelId = this.labelMap[predictedLabel.name]; | ||
const predictedLabelId = this.labelMap.get(predictedLabel.name); | ||
if (predictedIsInGroundTruth) { | ||
@@ -43,3 +43,3 @@ this.getBinaryConfusionMatrices()[predictedLabelId].addToTruePositives(value, false); | ||
} | ||
const groundTrueLabelId = this.labelMap[groundTrueLabel.name]; | ||
const groundTrueLabelId = this.labelMap.get(groundTrueLabel.name); | ||
if (!groundTruthIsInPredicted) { | ||
@@ -46,0 +46,0 @@ this.getBinaryConfusionMatrices()[groundTrueLabelId].addToFalseNegatives(value, false); |
@@ -7,6 +7,4 @@ /** | ||
export declare abstract class MultiLabelObjectConfusionMatrixWithBinaryArrayBase extends MultiLabelObjectConfusionMatrixBase { | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
reset(): void; | ||
} |
@@ -9,5 +9,3 @@ /** | ||
protected binaryConfusionMatrix: BinaryConfusionMatrix; | ||
constructor(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(labels: string[], labelMap: Map<string, number>); | ||
reset(): void; | ||
@@ -14,0 +12,0 @@ getBinaryConfusionMatrix(): BinaryConfusionMatrix; |
@@ -14,8 +14,4 @@ /** | ||
protected labels: string[]; | ||
protected labelMap: { | ||
[id: string]: number; | ||
}; | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
protected labelMap: Map<string, number>; | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: Map<string, number>); | ||
getModelFilename(): string; | ||
@@ -28,5 +24,3 @@ getFeaturizerFilename(): string; | ||
getLabels(): string[]; | ||
getLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getLabelMap(): Map<string, number>; | ||
getNumberLabels(): number; | ||
@@ -33,0 +27,0 @@ deserializeModel(modelFilename: string): SoftmaxRegressionSparse; |
@@ -21,3 +21,3 @@ "use strict"; | ||
this.labels = []; | ||
this.labelMap = {}; | ||
this.labelMap = new Map(); | ||
if (!Utility_1.Utility.isEmptyString(modelFilename)) { | ||
@@ -46,7 +46,7 @@ this.modelNullable = this.deserializeModel(modelFilename); | ||
} | ||
if (DictionaryMapUtility_1.DictionaryMapUtility.isEmptyStringIdGenericValueDictionary(this.labelMap)) { | ||
if (DictionaryMapUtility_1.DictionaryMapUtility.isEmptyStringKeyGenericValueMap(this.labelMap)) { | ||
this.labelMap = labelMap; | ||
} | ||
if ((!Utility_1.Utility.isEmptyStringArray(this.labels)) && (this.labelMap !== null)) { | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringIdNumberValueDictionary(this.labels, this.labelMap); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringKeyNumberValueMap(this.labels, this.labelMap); | ||
} | ||
@@ -87,3 +87,3 @@ } | ||
getLabelMap() { | ||
if (DictionaryMapUtility_1.DictionaryMapUtility.isEmptyStringIdGenericValueDictionary(this.labelMap)) { | ||
if (DictionaryMapUtility_1.DictionaryMapUtility.isEmptyStringKeyGenericValueMap(this.labelMap)) { | ||
Utility_1.Utility.debuggingThrow("this.labelMap is empty"); | ||
@@ -90,0 +90,0 @@ } |
@@ -17,5 +17,3 @@ /** | ||
protected labelsCachedAfterCrossValidation: string[]; | ||
protected labelMapCachedAfterCrossValidation: { | ||
[id: string]: number; | ||
}; | ||
protected labelMapCachedAfterCrossValidation: Map<string, number>; | ||
protected numberLabelsCachedAfterCrossValidation: number; | ||
@@ -70,5 +68,3 @@ protected numberFeaturesCachedAfterCrossValidation: number; | ||
generateEvaluationDirectReportToFiles(outputReportFilenamePrefix: string, encoding: string, outputEvaluationReportDirect?: IDictionaryStringIdGenericValue<string>): IDictionaryStringIdGenericValue<string>; | ||
crossValidate(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}, numberLabels: number, numberFeatures: number, intents: string[], utterances: string[], labelIndexArray: number[], featureIndexArrays: number[][], labelInstanceIndexMapArray: Map<string, number[]>): { | ||
crossValidate(labels: string[], labelMap: Map<string, number>, numberLabels: number, numberFeatures: number, intents: string[], utterances: string[], labelIndexArray: number[], featureIndexArrays: number[][], labelInstanceIndexMapArray: Map<string, number[]>): { | ||
"confusionMatrixCrossValidation": ConfusionMatrix; | ||
@@ -75,0 +71,0 @@ "thresholdReporterCrossValidation": ThresholdReporter; |
@@ -21,3 +21,3 @@ "use strict"; | ||
this.labelsCachedAfterCrossValidation = []; | ||
this.labelMapCachedAfterCrossValidation = {}; | ||
this.labelMapCachedAfterCrossValidation = new Map(); | ||
this.numberLabelsCachedAfterCrossValidation = -1; | ||
@@ -38,4 +38,4 @@ this.numberFeaturesCachedAfterCrossValidation = -1; | ||
this.crossValidationResultCachedAfterCrossValidation = { | ||
confusionMatrixCrossValidation: new ConfusionMatrix_1.ConfusionMatrix([], {}), | ||
thresholdReporterCrossValidation: new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], {}), | ||
confusionMatrixCrossValidation: new ConfusionMatrix_1.ConfusionMatrix([], new Map()), | ||
thresholdReporterCrossValidation: new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], new Map()), | ||
predictionLabels: [], | ||
@@ -42,0 +42,0 @@ predictionLabelIndexes: [], |
@@ -14,5 +14,3 @@ /** | ||
protected labels: string[]; | ||
protected labelMap: { | ||
[id: string]: number; | ||
}; | ||
protected labelMap: Map<string, number>; | ||
protected intents: string[]; | ||
@@ -19,0 +17,0 @@ protected utterances: string[]; |
@@ -16,5 +16,5 @@ "use strict"; | ||
constructor(modelFilename, featurizerFilename) { | ||
super(modelFilename, featurizerFilename, null, null, [], {}); | ||
super(modelFilename, featurizerFilename, null, null, [], new Map()); | ||
this.labels = []; | ||
this.labelMap = {}; | ||
this.labelMap = new Map(); | ||
this.intents = []; | ||
@@ -24,4 +24,4 @@ this.utterances = []; | ||
this.featureIndexArrays = []; | ||
this.confusionMatrixPrediction = new ConfusionMatrix_1.ConfusionMatrix([], {}); | ||
this.thresholdReporterPrediction = new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], {}); | ||
this.confusionMatrixPrediction = new ConfusionMatrix_1.ConfusionMatrix([], new Map()); | ||
this.thresholdReporterPrediction = new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], new Map()); | ||
this.predictionLabels = []; | ||
@@ -174,3 +174,3 @@ this.predictionLabelIndexes = []; | ||
const predictionLabelIndex = argMax.indexMax; | ||
let groundTruthLabelIndex = labelMap[intent]; | ||
let groundTruthLabelIndex = labelMap.get(intent); | ||
if (!Utility_1.Utility.isEmptyString(intent)) { | ||
@@ -177,0 +177,0 @@ if (!groundTruthLabelIndex) { |
@@ -134,3 +134,3 @@ "use strict"; | ||
// ----------------------------------------------------------------------- | ||
const modelMetaDataProfileReporter = new ModelMetaDataProfileReporter_1.ModelMetaDataProfileReporter(modelFilename, featurizerFilename, null, null, [], {}); | ||
const modelMetaDataProfileReporter = new ModelMetaDataProfileReporter_1.ModelMetaDataProfileReporter(modelFilename, featurizerFilename, null, null, [], new Map()); | ||
// ----------------------------------------------------------------------- | ||
@@ -137,0 +137,0 @@ const evaluationDataArraysReportResult = modelMetaDataProfileReporter.generateEvaluationDataArraysReportToFiles(outputReportFilenamePrefix); |
@@ -133,5 +133,5 @@ "use strict"; | ||
let labels = []; | ||
let labelMap = {}; | ||
let labelMap = new Map(); | ||
if (!Utility_1.Utility.isEmptyString(labelFilename)) { | ||
const labelsAndLabelMap = DictionaryMapUtility_1.DictionaryMapUtility.buildStringIdNumberValueDictionaryFromUniqueStringArrayFile(labelFilename); | ||
const labelsAndLabelMap = DictionaryMapUtility_1.DictionaryMapUtility.buildStringKeyNumberValueMapFromUniqueStringArrayFile(labelFilename); | ||
labels = labelsAndLabelMap.stringArray; | ||
@@ -138,0 +138,0 @@ labelMap = labelsAndLabelMap.stringMap; |
@@ -11,5 +11,3 @@ /** | ||
export declare class ModelMetaDataProfileReporter extends AbstractBaseModelFeaturizerEvaluator { | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: { | ||
[id: string]: number; | ||
}); | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: Map<string, number>); | ||
generateEvaluationDataArraysReport(): IDictionaryStringIdGenericArrays<string>; | ||
@@ -16,0 +14,0 @@ generateEvaluationDataArraysReportToFiles(outputReportFilenamePrefix: string, outputDataArraryHeaders?: string[], columnDelimiter?: string, recordDelimiter?: string, encoding?: string, outputEvaluationReportDataArrays?: IDictionaryStringIdGenericArrays<string>): { |
@@ -30,5 +30,3 @@ /** | ||
protected explicitMaxPositives: number; | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: { | ||
[id: string]: number; | ||
}, targetLabelBatchesToReport?: string[][], numberOfLabelsPerBatch?: number, explicitTotal?: number, explicitTotalPositives?: number, explicitTotalNegatives?: number, fMeasureBeta?: number, effectivenessMeasureAlpha?: number, rejectRate?: number, alpha?: number, beta?: number, A?: number, B?: number, explicitMaxPositives?: number); | ||
constructor(modelFilename: string, featurizerFilename: string, modelNullable: SoftmaxRegressionSparse | null, featurizerNullable: NgramSubwordFeaturizer | null, labels: string[], labelMap: Map<string, number>, targetLabelBatchesToReport?: string[][], numberOfLabelsPerBatch?: number, explicitTotal?: number, explicitTotalPositives?: number, explicitTotalNegatives?: number, fMeasureBeta?: number, effectivenessMeasureAlpha?: number, rejectRate?: number, alpha?: number, beta?: number, A?: number, B?: number, explicitMaxPositives?: number); | ||
generateEvaluationDataArraysReport(): IDictionaryStringIdGenericArrays<string>; | ||
@@ -35,0 +33,0 @@ generateEvaluationDataArraysReportToFiles(outputReportFilenamePrefix: string, outputDataArraryHeaders?: string[], columnDelimiter?: string, recordDelimiter?: string, encoding?: string, outputEvaluationReportDataArrays?: IDictionaryStringIdGenericArrays<string>): { |
@@ -198,3 +198,3 @@ "use strict"; | ||
for (const targetLabel of targetLabelsPerBatchToReport) { | ||
const targetLabelIndex = labelMap[targetLabel]; | ||
const targetLabelIndex = labelMap.get(targetLabel); | ||
if (targetLabelIndex === undefined) { | ||
@@ -283,3 +283,3 @@ Utility_1.Utility.debuggingThrow(`targetLabel|${targetLabel}| is not defined.`); | ||
const scoreArray = scoreDataStructure.scoreArrays[i]; | ||
const labelId = labelMap[label]; | ||
const labelId = labelMap.get(label); | ||
const weight = scoreDataStructure.weights[i]; | ||
@@ -286,0 +286,0 @@ this.addInstance(scoreArray, labelId, text, identifier, weight); |
@@ -16,3 +16,3 @@ "use strict"; | ||
constructor(modelFilename, featurizerFilename) { | ||
super(modelFilename, featurizerFilename, null, null, [], {}); | ||
super(modelFilename, featurizerFilename, null, null, [], new Map()); | ||
this.intentsCachedAfterTest = []; | ||
@@ -23,4 +23,4 @@ this.utterancesCachedAfterTest = []; | ||
this.testResultCachedAfterTest = { | ||
confusionMatrixTest: new ConfusionMatrix_1.ConfusionMatrix([], {}), | ||
thresholdReporterTest: new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], {}), | ||
confusionMatrixTest: new ConfusionMatrix_1.ConfusionMatrix([], new Map()), | ||
thresholdReporterTest: new ThresholdReporter_1.ThresholdReporter("", "", null, null, [], new Map()), | ||
predictionLabels: [], | ||
@@ -27,0 +27,0 @@ predictionLabelIndexes: [], |
@@ -12,9 +12,5 @@ /** | ||
getLabels(): string[]; | ||
getLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getLabelMap(): Map<string, number>; | ||
getFeatures(): string[]; | ||
getFeatureMap(): { | ||
[id: string]: number; | ||
}; | ||
getFeatureMap(): Map<string, number>; | ||
getHashingFeatureArrays(): Array<Set<string>>; | ||
@@ -21,0 +17,0 @@ getNumberHashingFeaturesSetting(): number; |
@@ -20,9 +20,5 @@ /** | ||
protected labels: string[]; | ||
protected labelMap: { | ||
[id: string]: number; | ||
}; | ||
protected labelMap: Map<string, number>; | ||
protected features: string[]; | ||
protected featureMap: { | ||
[id: string]: number; | ||
}; | ||
protected featureMap: Map<string, number>; | ||
protected hashingFeatureArrays: Array<Set<string>>; | ||
@@ -36,9 +32,5 @@ constructor(subwordNgramBegin?: number, subwordNgramEnd?: number, toLowercase?: boolean, toRemovePunctuations?: boolean, toRemoveEmptyElements?: boolean, splitDelimiter?: string, numberHashingFeaturesSetting?: number); | ||
getLabels(): string[]; | ||
getLabelMap(): { | ||
[id: string]: number; | ||
}; | ||
getLabelMap(): Map<string, number>; | ||
getFeatures(): string[]; | ||
getFeatureMap(): { | ||
[id: string]: number; | ||
}; | ||
getFeatureMap(): Map<string, number>; | ||
getHashingFeatureArrays(): Array<Set<string>>; | ||
@@ -45,0 +37,0 @@ getNumberHashingFeaturesSetting(): number; |
@@ -25,5 +25,5 @@ "use strict"; | ||
this.labels = []; | ||
this.labelMap = {}; | ||
this.labelMap = new Map(); | ||
this.features = []; | ||
this.featureMap = {}; | ||
this.featureMap = new Map(); | ||
this.hashingFeatureArrays = []; | ||
@@ -84,4 +84,4 @@ this.subwordNgramBegin = subwordNgramBegin; | ||
} | ||
if (label in this.labelMap) { | ||
labelId = this.labelMap[label]; | ||
if (this.labelMap.has(label)) { | ||
labelId = this.labelMap.get(label); | ||
} | ||
@@ -103,4 +103,4 @@ if (labelId < 0) { | ||
} | ||
if (feature in this.featureMap) { | ||
featureId = this.featureMap[feature]; | ||
if (this.featureMap.has(feature)) { | ||
featureId = this.featureMap.get(feature); | ||
} | ||
@@ -125,4 +125,4 @@ if (featureId < 0) { | ||
let featureId = -1; | ||
if (feature in this.featureMap) { | ||
featureId = this.featureMap[feature]; | ||
if (this.featureMap.has(feature)) { | ||
featureId = this.featureMap.get(feature); | ||
} | ||
@@ -212,4 +212,4 @@ if (featureId >= 0) { | ||
} | ||
if (label in this.labelMap) { | ||
labelId = this.labelMap[label]; | ||
if (this.labelMap.has(label)) { | ||
labelId = this.labelMap.get(label); | ||
} | ||
@@ -236,4 +236,4 @@ const numberLabels = this.getNumberLabels(); | ||
} | ||
if (label in this.labelMap) { | ||
labelId = this.labelMap[label]; | ||
if (this.labelMap.has(label)) { | ||
labelId = this.labelMap.get(label); | ||
} | ||
@@ -264,4 +264,4 @@ const numberLabels = this.getNumberLabels(); | ||
let featureId = -1; | ||
if (feature in this.featureMap) { | ||
featureId = this.featureMap[feature]; | ||
if (this.featureMap.has(feature)) { | ||
featureId = this.featureMap.get(feature); | ||
} | ||
@@ -286,4 +286,4 @@ if (featureId >= 0) { | ||
let featureId = -1; | ||
if (feature in this.featureMap) { | ||
featureId = this.featureMap[feature]; | ||
if (this.featureMap.has(feature)) { | ||
featureId = this.featureMap.get(feature); | ||
} | ||
@@ -471,3 +471,3 @@ if (featureId >= 0) { | ||
const intents = intentsUtterancesWeights.intents; | ||
const intentLabels = DictionaryMapUtility_1.DictionaryMapUtility.buildStringIdNumberValueDictionaryFromStringArray(intents); | ||
const intentLabels = DictionaryMapUtility_1.DictionaryMapUtility.buildStringKeyNumberValueMapFromStringArray(intents); | ||
this.labels = | ||
@@ -492,6 +492,6 @@ intentLabels.stringArray; | ||
// ---- NOTE-FOR-REFERENCE ---- "stringArray": string[], | ||
// ---- NOTE-FOR-REFERENCE ---- "stringMap": { [id: string]: number } } = | ||
// ---- NOTE-FOR-REFERENCE ---- "stringMap": Map<string, number> } = | ||
// tslint:disable-next-line: max-line-length | ||
// ---- NOTE-FOR-REFERENCE ---- DictionaryMapUtility.buildStringIdNumberValueDictionaryFromStringArray(featureArrayFlattened); | ||
const utteranceTexts = DictionaryMapUtility_1.DictionaryMapUtility.buildStringIdNumberValueDictionaryFromStringArrays(featureArray); | ||
const utteranceTexts = DictionaryMapUtility_1.DictionaryMapUtility.buildStringKeyNumberValueMapFromStringArrays(featureArray); | ||
this.features = | ||
@@ -498,0 +498,0 @@ utteranceTexts.stringArray; |
@@ -29,5 +29,3 @@ /** | ||
createLearner(numberLabels: number, numberFeatures: number): SoftmaxRegressionSparse; | ||
learn(labels: string[], labelMap: { | ||
[id: string]: number; | ||
}, numberLabels: number, numberFeatures: number, labelIndexArray: number[], featureIndexArrays: number[][], seedingInstanceIndexArray: number[], candidateInstanceIndexArray: number[]): { | ||
learn(labels: string[], labelMap: Map<string, number>, numberLabels: number, numberFeatures: number, labelIndexArray: number[], featureIndexArrays: number[][], seedingInstanceIndexArray: number[], candidateInstanceIndexArray: number[]): { | ||
"seedingInstanceIndexArray": number[]; | ||
@@ -34,0 +32,0 @@ "learner": SoftmaxRegressionSparse; |
@@ -54,7 +54,7 @@ "use strict"; | ||
const labels = ["label0", "label1", "label2"]; | ||
const labelMap = {}; | ||
labelMap.label0 = 0; | ||
labelMap.label1 = 1; | ||
labelMap.label2 = 2; | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringIdNumberValueDictionary(labels, labelMap); | ||
const labelMap = new Map(); | ||
labelMap.set("label0", 0); | ||
labelMap.set("label1", 1); | ||
labelMap.set("label2", 2); | ||
DictionaryMapUtility_1.DictionaryMapUtility.validateStringArrayAndStringKeyNumberValueMap(labels, labelMap); | ||
// ----------------------------------------------------------------------- | ||
@@ -61,0 +61,0 @@ const intentsUtterancesWeights = Utility_1.Utility.loadLabelTextColumnarFile(filename, // ---- filename: string, |
@@ -107,21 +107,11 @@ /** | ||
}; | ||
static processUtteranceEntityTsv(lines: string[], utterancesEntitiesMap: { | ||
[id: string]: Array<[string, number, number]>; | ||
}, utterancesEntitiesPredictedMap: { | ||
[id: string]: Array<[string, number, number]>; | ||
}, utteranceIndex?: number, entitiesIndex?: number, entitiesPredictedIndex?: number): boolean; | ||
static addToEntitiesUtteranceStructure(utterance: string, entityEntry: string, utterancesEntitiesMap: { | ||
[id: string]: Array<[string, number, number]>; | ||
}): void; | ||
static processUtteranceMultiLabelTsv(lines: string[], utteranceLabelsMap: { | ||
static processUtteranceEntityTsv(lines: string[], utterancesEntitiesMap: Map<string, Array<[string, number, number]>>, utterancesEntitiesPredictedMap: Map<string, Array<[string, number, number]>>, utteranceIndex?: number, entitiesIndex?: number, entitiesPredictedIndex?: number): boolean; | ||
static addToEntitiesUtteranceStructure(utterance: string, entityEntry: string, utterancesEntitiesMap: Map<string, Array<[string, number, number]>>): void; | ||
static processUtteranceMultiLabelTsv(lines: string[], utteranceLabelsMap: Map<string, Set<string>>, utterancesLabelsPredictedMap: Map<string, Set<string>>, utteranceLabelDuplicateMap: Map<string, Set<string>>, utteranceLabelDuplicatePredictedMap: Map<string, Set<string>>, utteranceIndex?: number, labelsIndex?: number, labelsPredictedIndex?: number): boolean; | ||
static addToMultiLabelUtteranceStructure(utterance: string, label: string, utteranceLabelsMap: Map<string, Set<string>>, utteranceLabelDuplicateMap: Map<string, Set<string>>): void; | ||
static addIfNewLabel(newLabel: string, labels: Set<string>): boolean; | ||
static addIfNewLabelToArray(newLabel: string, labels: string[]): boolean; | ||
static reverseUniqueKeyedArrayInMap(input: Map<string, Set<string>>): Map<string, Set<string>>; | ||
static reverseUniqueKeyedArrayInDictionary(input: { | ||
[id: string]: string[]; | ||
}, utterancesLabelsPredictedMap: { | ||
[id: string]: string[]; | ||
}, utteranceLabelDuplicateMap: Map<string, Set<string>>, utteranceLabelDuplicatePredictedMap: Map<string, Set<string>>, utteranceIndex?: number, labelsIndex?: number, labelsPredictedIndex?: number): boolean; | ||
static addToMultiLabelUtteranceStructure(utterance: string, label: string, utteranceLabelsMap: { | ||
[id: string]: string[]; | ||
}, utteranceLabelDuplicateMap: Map<string, Set<string>>): void; | ||
static addIfNewLabel(newLabel: string, labels: string[]): boolean; | ||
static reverseUniqueKeyedArray(input: { | ||
[id: string]: string[]; | ||
}): { | ||
@@ -196,3 +186,4 @@ [id: string]: string[]; | ||
static rename(entryname: string, entrynameNew: string): string; | ||
static carefullyAccessStringMap(stringMap: { | ||
static carefullyAccessStringMap(stringMap: Map<string, number>, key: string): number; | ||
static carefullyAccessStringDictionary(stringMap: { | ||
[id: string]: number; | ||
@@ -199,0 +190,0 @@ }, key: string): number; |
@@ -1,1 +0,1 @@ | ||
{"version":"4.11.0-beta.20200919.b7fef29","commands":{}} | ||
{"version":"4.11.0-beta.20200921.2320a67","commands":{}} |
{ | ||
"name": "@microsoft/bf-dispatcher", | ||
"description": "Dispatcher contains a Softmax learner initially used for auto-active-learning down-sampling and a ML confusion-matrix evaluator on intent classification models.", | ||
"version": "4.11.0-beta.20200919.b7fef29", | ||
"version": "4.11.0-beta.20200921.2320a67", | ||
"author": "Microsoft", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/microsoft/botframework-cli/issues", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1920267
22772