* refactor evaluation API

* fixed missing semicolons
This commit is contained in:
Hung-chih Yang 2020-03-25 22:45:51 -07:00 коммит произвёл GitHub
Родитель bdd9aeef39
Коммит 34cb280e7d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
26 изменённых файлов: 755 добавлений и 337 удалений

Просмотреть файл

@ -9,7 +9,8 @@
"@microsoft/bf-lu": "1.0.0",
"@oclif/command": "~1.5.19",
"@oclif/config": "~1.13.3",
"tslib": "^1.10.0"
"tslib": "^1.10.0",
"argparse": "~1.0.10"
},
"devDependencies": {
"@oclif/dev-cli": "^1.22.2",

Просмотреть файл

@ -69,9 +69,9 @@ export function exampleFunctionData(): ColumnarData {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);

Просмотреть файл

@ -53,9 +53,9 @@ export function exampleFunctionData(): EntityAnnotatedCorpusData {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);

Просмотреть файл

@ -43,9 +43,9 @@ export async function exampleFunctionData(): Promise<string[]> {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);

Просмотреть файл

@ -3,6 +3,9 @@
* Licensed under the MIT License.
*/
import { isNull } from "util";
import { isUndefined } from "util";
import { NgramSubwordFeaturizer } from "../model/language_understanding/featurizer/NgramSubwordFeaturizer";
import { EntityAnnotatedCorpusData } from "./EntityAnnotatedCorpusData";
@ -43,6 +46,8 @@ export class DataUtility {
}
public static async LoadData(
filename: string,
featurizerNullable: NgramSubwordFeaturizer|null = null,
toResetFeaturizerLabelFeatureMaps: boolean = true,
filetype: string = "",
labelColumnIndex: number = 0,
textColumnIndex: number = 1,
@ -52,40 +57,44 @@ export class DataUtility {
if (Utility.isEmptyString(filetype)) {
filetype = DataUtility.getDataFileTypeFromFilenameExtension(filename);
}
if (isNull(featurizerNullable) || (isUndefined(featurizerNullable))) {
featurizerNullable = new NgramSubwordFeaturizer();
toResetFeaturizerLabelFeatureMaps = true;
}
if (filetype === DataUtility.DATA_FORMAT_TYPE_LU) {
const luData: LuData =
await LuData.createLuData(
content,
new NgramSubwordFeaturizer(),
true);
featurizerNullable,
toResetFeaturizerLabelFeatureMaps);
return luData;
}
if (filetype === DataUtility.DATA_FORMAT_TYPE_QUESTION_AND_ANSWER) {
const luData: LuData =
await LuData.createLuData(
content,
new NgramSubwordFeaturizer(),
true);
featurizerNullable,
toResetFeaturizerLabelFeatureMaps);
return luData;
}
if (filetype === DataUtility.DATA_FORMAT_TYPE_ENTITY_ANNOTATED_CORPUS) {
const entityAnnotatedCorpusData: EntityAnnotatedCorpusData =
EntityAnnotatedCorpusData.createEntityAnnotatedCorpusData(
content,
new NgramSubwordFeaturizer(),
featurizerNullable,
linesToSkip,
true);
toResetFeaturizerLabelFeatureMaps);
return entityAnnotatedCorpusData;
}
{
const columnarData: ColumnarData =
ColumnarData.createColumnarData(
content,
new NgramSubwordFeaturizer(),
labelColumnIndex,
textColumnIndex,
linesToSkip,
true);
ColumnarData.createColumnarData(
content,
featurizerNullable,
labelColumnIndex,
textColumnIndex,
linesToSkip,
toResetFeaturizerLabelFeatureMaps);
return columnarData;
}
}

Просмотреть файл

@ -19,14 +19,14 @@ export class ConfusionMatrix {
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } {
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } {
const crossValidationBinaryConfusionMatrix: BinaryConfusionMatrix[] =
confusionMatrix.getBinaryConfusionMatrices();
const labelMap: { [id: string]: number; } =
@ -45,14 +45,18 @@ export class ConfusionMatrix {
microAverageMetricArray[0];
const truePositives: number =
microAverageMetricArray[1];
const totalMicroAverage: number =
const supportMicroAverage: number =
microAverageMetricArray[2];
const microAverageMetrics: {
"accuracy": number,
"truePositives": number,
"totalMicroAverage": number } = { accuracy,
truePositives,
totalMicroAverage };
"support": number } = {
// tslint:disable-next-line: object-literal-key-quotes
"accuracy": accuracy,
// tslint:disable-next-line: object-literal-key-quotes
"truePositives": truePositives,
// tslint:disable-next-line: object-literal-key-quotes
"support": supportMicroAverage };
const macroAverageMetricArray: [number, number, number, number] =
confusionMatrix.getMacroAverageMetrics();
const averagePrecision: number =
@ -61,16 +65,21 @@ export class ConfusionMatrix {
macroAverageMetricArray[1];
const averageF1Score: number =
macroAverageMetricArray[2];
const totalMacroAverage: number =
const supportMacroAverage: number =
macroAverageMetricArray[3];
const macroAverageMetrics: {
"averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number } = { averagePrecision,
averageRecall,
averageF1Score,
totalMacroAverage };
"support": number } = {
// tslint:disable-next-line: object-literal-key-quotes
"averagePrecision": averagePrecision,
// tslint:disable-next-line: object-literal-key-quotes
"averageRecall": averageRecall,
// tslint:disable-next-line: object-literal-key-quotes
"averageF1Score": averageF1Score,
// tslint:disable-next-line: object-literal-key-quotes
"support": supportMacroAverage };
const weightedMacroAverageMetricArray: [number, number, number, number] =
confusionMatrix.getWeightedMacroAverageMetrics();
const weightedAveragePrecision: number =
@ -79,16 +88,21 @@ export class ConfusionMatrix {
weightedMacroAverageMetricArray[1];
const weightedAverageF1Score: number =
weightedMacroAverageMetricArray[2];
const weightedTotalMacroAverage: number =
const supportWeightedMacroAverage: number =
weightedMacroAverageMetricArray[3];
const weightedMacroAverageMetrics: {
"weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } = { weightedAveragePrecision,
weightedAverageRecall,
weightedAverageF1Score,
weightedTotalMacroAverage };
"support": number } = {
// tslint:disable-next-line: object-literal-key-quotes
"weightedAveragePrecision": weightedAveragePrecision,
// tslint:disable-next-line: object-literal-key-quotes
"weightedAverageRecall": weightedAverageRecall,
// tslint:disable-next-line: object-literal-key-quotes
"weightedAverageF1Score": weightedAverageF1Score,
// tslint:disable-next-line: object-literal-key-quotes
"support": supportWeightedMacroAverage };
const confusionMatrixMetricStructure: {
"confusionMatrix": ConfusionMatrix,
"labelBinaryConfusionMatrixDerivedMetricMap": { [id: string]: { [id: string]: number }; },
@ -96,14 +110,14 @@ export class ConfusionMatrix {
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } = {
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } = {
confusionMatrix,
labelBinaryConfusionMatrixDerivedMetricMap,
labelBinaryConfusionMatrixMetricMap,

Просмотреть файл

@ -2190,6 +2190,321 @@ export class MathematicsHelper {
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAssignRandomTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] = Utility.getRandomNumber();
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAssignConstantTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] = constant;
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAddConstantTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] += constant;
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayMultiplyConstantTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] *= constant;
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArraySubtractConstantFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] -= constant;
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayDivideConstantFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] /= constant;
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAssignTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] = denseValueArray1[index];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAddTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] += denseValueArray1[index];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayMultiplyTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] *= denseValueArray1[index];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArraySubtractFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] -= denseValueArray1[index];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayDivideFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[]): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] /= denseValueArray1[index];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAssignScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] = (constant * denseValueArray1[index]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayAddScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] += (constant * denseValueArray1[index]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayMultiplyScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] *= (constant * denseValueArray1[index]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArraySubtractScaledFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] -= (constant * denseValueArray1[index]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorSparseMapDenseArrayDivideScaledFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (const index of sparseIndexArray0) {
denseValueArray0[index] /= (constant * denseValueArray1[index]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayAssignTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[]): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] = denseValueArray1[index1];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayAddTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[]): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] += denseValueArray1[index1];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayMultiplyTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[]): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] *= denseValueArray1[index1];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArraySubtractFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[]): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] -= denseValueArray1[index1];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayDivideFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[]): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] /= denseValueArray1[index1];
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayAssignScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] = (constant * denseValueArray1[index1]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayAddScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] += (constant * denseValueArray1[index1]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayMultiplyScaledTo(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] *= (constant * denseValueArray1[index1]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArraySubtractScaledFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] -= (constant * denseValueArray1[index1]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static vectorIndependentSparseMapDenseArrayDivideScaledFrom(
sparseIndexArray0: number[],
sparseValueArray0: number[],
denseValueArray0: number[],
sparseIndexArray1: number[],
sparseValueArray1: number[],
denseValueArray1: number[],
constant: number): [number[], number[]] {
for (let i: number = 0; i < sparseIndexArray0.length; i++) {
const index0 = sparseIndexArray0[i];
const index1 = sparseIndexArray1[i];
denseValueArray0[index0] /= (constant * denseValueArray1[index1]);
}
return [sparseIndexArray0, denseValueArray0];
}
public static tensor4dNewLikeWithRandomCells(
tensor4d: number[][][][]): number[][][][] {
return MathematicsHelper.tensor4dNewWithRandomCells(

Просмотреть файл

@ -14,9 +14,11 @@ import { IDictionaryStringIdGenericValue } from "../../../data_structure/IDictio
import { AppSoftmaxRegressionSparse } from "../../supervised/classifier/neural_network/learner/AppSoftmaxRegressionSparse";
import { ConfusionMatrix } from "../../../mathematics/confusion_matrix/ConfusionMatrix";
import { BinaryConfusionMatrix } from "../../../mathematics/confusion_matrix/BinaryConfusionMatrix";
import { ConfusionMatrix } from "../../../mathematics/confusion_matrix/ConfusionMatrix";
import { ThresholdReporter } from "../report/ThresholdReporter";
import { ColumnarData } from "../../../data/ColumnarData";
import { LuData } from "../../../data/LuData";
@ -76,15 +78,6 @@ export function mainCrossValidatorWithData(
assert(utteranceFeatureIndexArrays, "utteranceFeatureIndexArrays is undefined.");
const crossValidator: CrossValidator =
new CrossValidator(
data.getFeaturizerLabels(),
data.getFeaturizerLabelMap(),
data.getFeaturizer().getNumberLabels(),
data.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
data.getIntentInstanceIndexMapArray(),
numberOfCrossValidationFolds,
learnerParameterEpochs,
learnerParameterMiniBatchSize,
@ -93,6 +86,30 @@ export function mainCrossValidatorWithData(
learnerParameterLossEarlyStopRatio,
learnerParameterLearningRate,
learnerParameterToCalculateOverallLossAfterEpoch);
const crossValidationResult: {
"confusionMatrixCrossValidation": ConfusionMatrix,
"thresholdReporterCrossValidation": ThresholdReporter,
"predictionLabels": string[],
"predictionLabelIndexes": number[],
"groundTruthLabels": string[],
"groundTruthLabelIndexes": number[],
"predictions": number[][] } = crossValidator.crossValidate(
data.getFeaturizerLabels(),
data.getFeaturizerLabelMap(),
data.getFeaturizer().getNumberLabels(),
data.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
data.getIntentInstanceIndexMapArray());
Utility.debuggingLog(
`crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()}`);
return crossValidator;
// -----------------------------------------------------------------------
}
@ -152,15 +169,6 @@ export async function mainCrossValidatorWithLuContent(
assert(utteranceFeatureIndexArrays, "utteranceFeatureIndexArrays is undefined.");
const crossValidator: CrossValidator =
new CrossValidator(
luData.getFeaturizerLabels(),
luData.getFeaturizerLabelMap(),
luData.getFeaturizer().getNumberLabels(),
luData.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
luData.getIntentInstanceIndexMapArray(),
numberOfCrossValidationFolds,
learnerParameterEpochs,
learnerParameterMiniBatchSize,
@ -169,6 +177,30 @@ export async function mainCrossValidatorWithLuContent(
learnerParameterLossEarlyStopRatio,
learnerParameterLearningRate,
learnerParameterToCalculateOverallLossAfterEpoch);
const crossValidationResult: {
"confusionMatrixCrossValidation": ConfusionMatrix,
"thresholdReporterCrossValidation": ThresholdReporter,
"predictionLabels": string[],
"predictionLabelIndexes": number[],
"groundTruthLabels": string[],
"groundTruthLabelIndexes": number[],
"predictions": number[][] } = crossValidator.crossValidate(
luData.getFeaturizerLabels(),
luData.getFeaturizerLabelMap(),
luData.getFeaturizer().getNumberLabels(),
luData.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
luData.getIntentInstanceIndexMapArray());
Utility.debuggingLog(
`crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()}`);
return crossValidator;
// -----------------------------------------------------------------------
}
@ -237,15 +269,6 @@ export function mainCrossValidatorWithColumnarContent(
assert(utteranceFeatureIndexArrays, "utteranceFeatureIndexArrays is undefined.");
const crossValidator: CrossValidator =
new CrossValidator(
columnarData.getFeaturizerLabels(),
columnarData.getFeaturizerLabelMap(),
columnarData.getFeaturizer().getNumberLabels(),
columnarData.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
columnarData.getIntentInstanceIndexMapArray(),
numberOfCrossValidationFolds,
learnerParameterEpochs,
learnerParameterMiniBatchSize,
@ -254,6 +277,30 @@ export function mainCrossValidatorWithColumnarContent(
learnerParameterLossEarlyStopRatio,
learnerParameterLearningRate,
learnerParameterToCalculateOverallLossAfterEpoch);
const crossValidationResult: {
"confusionMatrixCrossValidation": ConfusionMatrix,
"thresholdReporterCrossValidation": ThresholdReporter,
"predictionLabels": string[],
"predictionLabelIndexes": number[],
"groundTruthLabels": string[],
"groundTruthLabelIndexes": number[],
"predictions": number[][] } = crossValidator.crossValidate(
columnarData.getFeaturizerLabels(),
columnarData.getFeaturizerLabelMap(),
columnarData.getFeaturizer().getNumberLabels(),
columnarData.getFeaturizer().getNumberFeatures(),
intents,
utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays,
columnarData.getIntentInstanceIndexMapArray());
Utility.debuggingLog(
`crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()}` +
`,crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()=` +
`${crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()}`);
return crossValidator;
// -----------------------------------------------------------------------
}
@ -410,9 +457,9 @@ export async function mainCrossValidator(): Promise<{
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -427,7 +474,7 @@ export async function mainCrossValidator(): Promise<{
args.filetype;
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(filename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(filename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}
@ -484,6 +531,8 @@ export async function mainCrossValidator(): Promise<{
// -----------------------------------------------------------------------
const data: Data = await DataUtility.LoadData(
filename,
null,
true,
filetype,
labelColumnIndex,
textColumnIndex,
@ -504,11 +553,13 @@ export async function mainCrossValidator(): Promise<{
const evaluationJsonReportResult: {
"outputEvaluationReportJson": IDictionaryStringIdGenericValue<any>,
"outputFilenames": string[],
} = crossValidator.generateEvaluationJsonReportToFiles(outputReportFilenamePrefix);
} = crossValidator.generateEvaluationJsonReportToFiles(
outputReportFilenamePrefix);
const evaluationDataArraysReportResult: {
"outputEvaluationReportDataArrays": IDictionaryStringIdGenericArrays<string>,
"outputFilenames": string[],
} = crossValidator.generateEvaluationDataArraysReportToFiles(outputReportFilenamePrefix);
} = crossValidator.generateEvaluationDataArraysReportToFiles(
outputReportFilenamePrefix);
// -----------------------------------------------------------------------
const dateTimeEndInString: string = (new Date()).toISOString();
// -----------------------------------------------------------------------

Просмотреть файл

@ -29,15 +29,15 @@ export class CrossValidator extends AbstractBaseEvaluator {
protected numberOfCrossValidationFolds: number =
CrossValidator.defaultNumberOfCrossValidationFolds;
protected labels: string[] = [];
protected labelMap: { [id: string]: number; } = {};
protected numberLabels: number = -1;
protected numberFeatures: number = -1;
protected intents: string[] = [];
protected utterances: string[] = [];
protected labelIndexArray: number[] = [];
protected featureIndexArrays: number[][] = [];
protected labelInstanceIndexMapArray: Map<string, number[]> = new Map<string, number[]>();
protected labelsCachedAfterCrossValidation: string[] = [];
protected labelMapCachedAfterCrossValidation: { [id: string]: number; } = {};
protected numberLabelsCachedAfterCrossValidation: number = -1;
protected numberFeaturesCachedAfterCrossValidation: number = -1;
protected intentsCachedAfterCrossValidation: string[] = [];
protected utterancesCachedAfterCrossValidation: string[] = [];
protected labelIndexArrayCachedAfterCrossValidation: number[] = [];
protected featureIndexArraysCachedAfterCrossValidation: number[][] = [];
protected labelInstanceIndexMapArrayCachedAfterCrossValidation: Map<string, number[]> = new Map<string, number[]>();
protected learnerParameterEpochs: number =
AppSoftmaxRegressionSparse.defaultEpochs;
@ -54,7 +54,7 @@ export class CrossValidator extends AbstractBaseEvaluator {
protected learnerParameterToCalculateOverallLossAfterEpoch: boolean =
true;
protected crossValidationResult: {
protected crossValidationResultCachedAfterCrossValidation: {
"confusionMatrixCrossValidation": ConfusionMatrix
"thresholdReporterCrossValidation": ThresholdReporter,
"predictionLabels": string[],
@ -71,15 +71,6 @@ export class CrossValidator extends AbstractBaseEvaluator {
predictions: [] };
constructor(
labels: string[],
labelMap: { [id: string]: number; },
numberLabels: number,
numberFeatures: number,
intents: string[],
utterances: string[],
labelIndexArray: number[],
featureIndexArrays: number[][],
labelInstanceIndexMapArray: Map<string, number[]>,
numberOfCrossValidationFolds: number =
CrossValidator.defaultNumberOfCrossValidationFolds,
learnerParameterEpochs: number =
@ -97,15 +88,6 @@ export class CrossValidator extends AbstractBaseEvaluator {
learnerParameterToCalculateOverallLossAfterEpoch: boolean =
true) {
super();
this.labels = labels;
this.labelMap = labelMap;
this.numberLabels = numberLabels;
this.numberFeatures = numberFeatures;
this.intents = intents;
this.utterances = utterances;
this.labelIndexArray = labelIndexArray;
this.featureIndexArrays = featureIndexArrays;
this.labelInstanceIndexMapArray = labelInstanceIndexMapArray;
this.numberOfCrossValidationFolds =
numberOfCrossValidationFolds;
this.learnerParameterEpochs =
@ -122,23 +104,6 @@ export class CrossValidator extends AbstractBaseEvaluator {
learnerParameterLearningRate;
this.learnerParameterToCalculateOverallLossAfterEpoch =
learnerParameterToCalculateOverallLossAfterEpoch;
this.crossValidationResult = this.crossValidate(
this.labels,
this.labelMap,
this.numberLabels,
this.numberFeatures,
this.intents,
this.utterances,
this.labelIndexArray,
this.featureIndexArrays,
labelInstanceIndexMapArray);
Utility.debuggingLog(
`this.crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()=` +
`${this.crossValidationResult.confusionMatrixCrossValidation.getMicroAverageMetrics()}` +
`,this.crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()=` +
`${this.crossValidationResult.confusionMatrixCrossValidation.getMacroAverageMetrics()}` +
`,this.crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()=` +
`${this.crossValidationResult.confusionMatrixCrossValidation.getWeightedMacroAverageMetrics()}`);
}
public getCrossValidationResult(): {
@ -149,7 +114,7 @@ export class CrossValidator extends AbstractBaseEvaluator {
"groundTruthLabels": string[],
"groundTruthLabelIndexes": number[],
"predictions": number[][] } {
return this.crossValidationResult;
return this.crossValidationResultCachedAfterCrossValidation;
}
public getNumberOfCrossValidationFolds(): number {
@ -173,15 +138,20 @@ export class CrossValidator extends AbstractBaseEvaluator {
public generateEvaluationDataArraysReport(): IDictionaryStringIdGenericArrays<string> {
const outputEvaluationReportDataArrays: IDictionaryStringIdGenericArrays<string> = {};
{
const predictionLabels: string[] = this.crossValidationResult.predictionLabels;
const predictionLabelIndexes: number[] = this.crossValidationResult.predictionLabelIndexes;
const groundTruthLabels: string[] = this.crossValidationResult.predictionLabels;
const groundTruthLabelIndexes: number[] = this.crossValidationResult.predictionLabelIndexes;
const predictions: number[][] = this.crossValidationResult.predictions;
const predictionLabels: string[] =
this.crossValidationResultCachedAfterCrossValidation.predictionLabels;
const predictionLabelIndexes: number[] =
this.crossValidationResultCachedAfterCrossValidation.predictionLabelIndexes;
const groundTruthLabels: string[] =
this.crossValidationResultCachedAfterCrossValidation.predictionLabels;
const groundTruthLabelIndexes: number[] =
this.crossValidationResultCachedAfterCrossValidation.predictionLabelIndexes;
const predictions: number[][] =
this.crossValidationResultCachedAfterCrossValidation.predictions;
const outputEvaluationReportDataArraysScoreRecords: string[][] = [];
for (let index: number = 0; index < this.intents.length; index++) {
const intent: string = this.intents[index];
const utterance: string = this.utterances[index];
for (let index: number = 0; index < this.intentsCachedAfterCrossValidation.length; index++) {
const intent: string = this.intentsCachedAfterCrossValidation[index];
const utterance: string = this.utterancesCachedAfterCrossValidation[index];
const groundTruthLabel: string = groundTruthLabels[index];
const groundTruthLabelIndex: number = groundTruthLabelIndexes[index];
const predictionLabel: string = predictionLabels[index];
@ -239,7 +209,7 @@ export class CrossValidator extends AbstractBaseEvaluator {
public generateEvaluationJsonReport(): IDictionaryStringIdGenericValue<any> {
const outputEvaluationReport: IDictionaryStringIdGenericValue<any> = {};
const confusionMatrixCrossValidation: ConfusionMatrix =
this.crossValidationResult.confusionMatrixCrossValidation;
this.crossValidationResultCachedAfterCrossValidation.confusionMatrixCrossValidation;
const confusionMatrixMetricStructure: {
"confusionMatrix": ConfusionMatrix,
"labelBinaryConfusionMatrixDerivedMetricMap": { [id: string]: { [id: string]: number }; },
@ -247,14 +217,14 @@ export class CrossValidator extends AbstractBaseEvaluator {
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } =
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } =
ConfusionMatrix.generateConfusionMatrixMetricStructure(
confusionMatrixCrossValidation);
Utility.debuggingLog(
@ -329,6 +299,16 @@ export class CrossValidator extends AbstractBaseEvaluator {
Utility.debuggingLog(`labelInstanceIndexMapArray.size=` +
`${labelInstanceIndexMapArray.size}`);
// -------------------------------------------------------------------
this.labelsCachedAfterCrossValidation = labels;
this.labelMapCachedAfterCrossValidation = labelMap;
this.numberLabelsCachedAfterCrossValidation = numberLabels;
this.numberFeaturesCachedAfterCrossValidation = numberFeatures;
this.intentsCachedAfterCrossValidation = intents;
this.utterancesCachedAfterCrossValidation = utterances;
this.labelIndexArrayCachedAfterCrossValidation = labelIndexArray;
this.featureIndexArraysCachedAfterCrossValidation = featureIndexArrays;
this.labelInstanceIndexMapArrayCachedAfterCrossValidation = labelInstanceIndexMapArray;
// -------------------------------------------------------------------
const confusionMatrixCrossValidation =
new ConfusionMatrix(labels, labelMap);
const thresholdReporterCrossValidation: ThresholdReporter =
@ -528,7 +508,7 @@ export class CrossValidator extends AbstractBaseEvaluator {
// ---------------------------------------------------------------
}
// -------------------------------------------------------------------
return {
this.crossValidationResultCachedAfterCrossValidation = {
confusionMatrixCrossValidation,
thresholdReporterCrossValidation,
predictionLabels,
@ -536,6 +516,7 @@ export class CrossValidator extends AbstractBaseEvaluator {
groundTruthLabels,
groundTruthLabelIndexes,
predictions };
return this.crossValidationResultCachedAfterCrossValidation;
// -------------------------------------------------------------------
}
}

Просмотреть файл

@ -82,9 +82,9 @@ export function mainPredictor(): void {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -112,7 +112,7 @@ export function mainPredictor(): void {
}
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(modelFilename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(modelFilename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}
@ -187,11 +187,13 @@ export function mainPredictor(): void {
const evaluationJsonReportResult: {
"outputEvaluationReportJson": IDictionaryStringIdGenericValue<any>,
"outputFilenames": string[],
} = predictor.generateEvaluationJsonReportToFiles(outputReportFilenamePrefix);
} = predictor.generateEvaluationJsonReportToFiles(
outputReportFilenamePrefix);
const evaluationDataArraysReportResult: {
"outputEvaluationReportDataArrays": IDictionaryStringIdGenericArrays<string>,
"outputFilenames": string[],
} = predictor.generateEvaluationDataArraysReportToFiles(outputReportFilenamePrefix);
} = predictor.generateEvaluationDataArraysReportToFiles(
outputReportFilenamePrefix);
// -----------------------------------------------------------------------
const dateTimeEndInString: string = (new Date()).toISOString();
// -----------------------------------------------------------------------

Просмотреть файл

@ -168,14 +168,14 @@ export class Predictor extends AbstractBaseModelFeaturizerEvaluator {
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } =
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } =
ConfusionMatrix.generateConfusionMatrixMetricStructure(
confusionMatrixPrediction);
Utility.debuggingLog(

Просмотреть файл

@ -18,6 +18,7 @@ import { DataUtility } from "../../../data/DataUtility";
import { Data } from "../../../data/Data";
import { Utility } from "../../../utility/Utility";
import { NgramSubwordFeaturizer } from "../../language_understanding/featurizer/NgramSubwordFeaturizer";
export function mainDataProfileReporter(): void {
// -----------------------------------------------------------------------
@ -84,9 +85,9 @@ export function mainDataProfileReporter(): void {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -108,7 +109,7 @@ export function mainDataProfileReporter(): void {
// ---- NOTE-TODO-PLACEHOLDER ---- }
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(filename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(filename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}
@ -130,6 +131,8 @@ export function mainDataProfileReporter(): void {
// -----------------------------------------------------------------------
DataUtility.LoadData(
filename,
null,
true,
filetype,
labelColumnIndex,
textColumnIndex,

Просмотреть файл

@ -99,9 +99,9 @@ export function mainModelMetaDataProfileReporter(): void {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -129,7 +129,7 @@ export function mainModelMetaDataProfileReporter(): void {
}
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(modelFilename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(modelFilename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}

Просмотреть файл

@ -57,9 +57,9 @@ export function mainThresholdReporter(): void {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -78,7 +78,7 @@ export function mainThresholdReporter(): void {
}
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(scoreFilename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(scoreFilename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}

Просмотреть файл

@ -108,9 +108,9 @@ export async function mainTester(): Promise<void> {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -137,7 +137,7 @@ export async function mainTester(): Promise<void> {
}
let outputReportFilenamePrefix: string = args.outputReportFilenamePrefix;
if (Utility.isEmptyString(outputReportFilenamePrefix)) {
outputReportFilenamePrefix = Utility.getFileBasename(filename);
outputReportFilenamePrefix = Utility.getFilenameWithoutExtension(filename);
// Utility.debuggingThrow(
// `The output file ${outputReportFilenamePrefix} is empty! process.cwd()=${process.cwd()}`);
}
@ -162,6 +162,15 @@ export async function mainTester(): Promise<void> {
Utility.debuggingLog(
`linesToSkip=${linesToSkip}`);
// -----------------------------------------------------------------------
const tester: Tester =
new Tester(
modelFilename,
featurizerFilename);
const featurizer: NgramSubwordFeaturizer =
tester.getFeaturizer();
// Utility.debuggingLog(
// `featurizer.getLabelMap()=${Utility.JSONstringify(featurizer.getLabelMap())}`);
// -----------------------------------------------------------------------
let intentsUtterances: {
"intents": string[],
"utterances": string[] } = {
@ -171,6 +180,8 @@ export async function mainTester(): Promise<void> {
let utteranceFeatureIndexArrays: number[][] = [];
const data: Data = await DataUtility.LoadData(
filename,
featurizer,
false,
filetype,
labelColumnIndex,
textColumnIndex,
@ -179,19 +190,17 @@ export async function mainTester(): Promise<void> {
intentLabelIndexArray = data.getIntentLabelIndexArray();
utteranceFeatureIndexArrays = data.getUtteranceFeatureIndexArrays();
// -----------------------------------------------------------------------
const tester: Tester =
new Tester(
modelFilename,
featurizerFilename,
intentsUtterances.intents,
intentsUtterances.utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays);
tester.test(
intentsUtterances.intents,
intentsUtterances.utterances,
intentLabelIndexArray,
utteranceFeatureIndexArrays);
// -----------------------------------------------------------------------
const evaluationJsonReportResult: {
"outputEvaluationReportJson": IDictionaryStringIdGenericValue<any>,
"outputFilenames": string[],
} = tester.generateEvaluationJsonReportToFiles(outputReportFilenamePrefix);
} = tester.generateEvaluationJsonReportToFiles(
outputReportFilenamePrefix);
const evaluationDataArraysReportResult: {
"outputEvaluationReportDataArrays": IDictionaryStringIdGenericArrays<string>,
"outputFilenames": string[],

Просмотреть файл

@ -30,12 +30,12 @@ import { Utility } from "../../../utility/Utility";
export class Tester extends AbstractBaseModelFeaturizerEvaluator {
protected intents: string[] = [];
protected utterances: string[] = [];
protected labelIndexArray: number[] = [];
protected featureIndexArrays: number[][] = [];
protected intentsCachedAfterTest: string[] = [];
protected utterancesCachedAfterTest: string[] = [];
protected labelIndexArrayCachedAfterTest: number[] = [];
protected featureIndexArraysCachedAfterTest: number[][] = [];
protected testResult: {
protected testResultCachedAfterTest: {
"confusionMatrixTest": ConfusionMatrix
"thresholdReporterTest": ThresholdReporter,
"predictionLabels": string[],
@ -53,21 +53,8 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
public constructor(
modelFilename: string,
featurizerFilename: string,
intents: string[],
utterances: string[],
labelIndexArray: number[],
featureIndexArrays: number[][]) {
featurizerFilename: string) {
super(modelFilename, featurizerFilename, null, null, [], {});
this.intents = intents;
this.utterances = utterances;
this.labelIndexArray = labelIndexArray;
this.featureIndexArrays = featureIndexArrays;
this.testResult = this.test(
this.intents,
this.utterances,
this.labelIndexArray,
this.featureIndexArrays);
}
public getTestResult(): {
@ -78,21 +65,21 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
"groundTruthLabels": string[],
"groundTruthLabelIndexes": number[],
"predictions": number[][] } {
return this.testResult;
return this.testResultCachedAfterTest;
}
public generateEvaluationDataArraysReport(): IDictionaryStringIdGenericArrays<string> {
const outputEvaluationReportDataArrays: IDictionaryStringIdGenericArrays<string> = {};
{
const predictionLabels: string[] = this.testResult.predictionLabels;
const predictionLabelIndexes: number[] = this.testResult.predictionLabelIndexes;
const groundTruthLabels: string[] = this.testResult.predictionLabels;
const groundTruthLabelIndexes: number[] = this.testResult.predictionLabelIndexes;
const predictions: number[][] = this.testResult.predictions;
const predictionLabels: string[] = this.testResultCachedAfterTest.predictionLabels;
const predictionLabelIndexes: number[] = this.testResultCachedAfterTest.predictionLabelIndexes;
const groundTruthLabels: string[] = this.testResultCachedAfterTest.predictionLabels;
const groundTruthLabelIndexes: number[] = this.testResultCachedAfterTest.predictionLabelIndexes;
const predictions: number[][] = this.testResultCachedAfterTest.predictions;
const outputEvaluationReportDataArraysScoreRecords: string[][] = [];
for (let index: number = 0; index < this.intents.length; index++) {
const intent: string = this.intents[index];
const utterance: string = this.utterances[index];
for (let index: number = 0; index < this.intentsCachedAfterTest.length; index++) {
const intent: string = this.intentsCachedAfterTest[index];
const utterance: string = this.utterancesCachedAfterTest[index];
const groundTruthLabel: string = groundTruthLabels[index];
const groundTruthLabelIndex: number = groundTruthLabelIndexes[index];
const predictionLabel: string = predictionLabels[index];
@ -149,7 +136,7 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
public generateEvaluationJsonReport(): IDictionaryStringIdGenericValue<any> {
const outputEvaluationReport: IDictionaryStringIdGenericValue<any> = {};
const confusionMatrixTest: ConfusionMatrix =
this.testResult.confusionMatrixTest;
this.testResultCachedAfterTest.confusionMatrixTest;
const confusionMatrixMetricStructure: {
"confusionMatrix": ConfusionMatrix,
"labelBinaryConfusionMatrixDerivedMetricMap": { [id: string]: { [id: string]: number }; },
@ -157,14 +144,14 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } =
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } =
ConfusionMatrix.generateConfusionMatrixMetricStructure(
confusionMatrixTest);
Utility.debuggingLog(
@ -227,6 +214,11 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
"groundTruthLabelIndexes": number[],
"predictions": number[][] } {
// -------------------------------------------------------------------
this.intentsCachedAfterTest = intents;
this.utterancesCachedAfterTest = utterances;
this.labelIndexArrayCachedAfterTest = labelIndexArray;
this.featureIndexArraysCachedAfterTest = featureIndexArrays;
// -------------------------------------------------------------------
const model: SoftmaxRegressionSparse =
this.getModel();
const featurizer: NgramSubwordFeaturizer =
@ -306,7 +298,7 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
// ---------------------------------------------------------------
}
// -------------------------------------------------------------------
return {
this.testResultCachedAfterTest = {
confusionMatrixTest,
thresholdReporterTest,
predictionLabels,
@ -314,6 +306,7 @@ export class Tester extends AbstractBaseModelFeaturizerEvaluator {
groundTruthLabels,
groundTruthLabelIndexes,
predictions };
return this.testResultCachedAfterTest;
// -------------------------------------------------------------------
}
}

Просмотреть файл

@ -102,7 +102,7 @@ export class NgramSubwordFeaturizer {
}
if (labelId < 0) {
if (throwIfNonExistentLabel) {
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${this.labelMap}`);
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${Utility.JSONstringify(this.labelMap)}`);
}
}
return labelId;
@ -261,7 +261,7 @@ export class NgramSubwordFeaturizer {
labelArray[labelId] = true;
} else {
if (throwIfNonExistentLabel) {
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${this.labelMap}`);
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${Utility.JSONstringify(this.labelMap)}`);
}
}
return labelArray;
@ -285,7 +285,7 @@ export class NgramSubwordFeaturizer {
labelArray[labelId] = 1;
} else {
if (throwIfNonExistentLabel) {
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${this.labelMap}`);
Utility.debuggingThrow(`label=${label} does not exist in this.labelMap=${Utility.JSONstringify(this.labelMap)}`);
}
}
return labelArray;

Просмотреть файл

@ -935,9 +935,9 @@ export class AppAutoActiveLearner {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);
@ -1058,6 +1058,8 @@ export class AppAutoActiveLearner {
let utteranceFeatureIndexArrays: number[][] = [];
const data: Data = await DataUtility.LoadData(
filename,
null,
true,
filetype,
labelColumnIndex,
textColumnIndex,
@ -1071,6 +1073,8 @@ export class AppAutoActiveLearner {
if (Utility.exists(bootstrapResamplingDistributionFilename)) {
const dataBootstrapResampling: Data = await DataUtility.LoadData(
bootstrapResamplingDistributionFilename,
null,
true,
filetype,
bootstrapResamplingDistributionFileLabelColumnIndex,
bootstrapResamplingDistributionFileTextColumnIndex,

Просмотреть файл

@ -168,11 +168,11 @@ export class SoftmaxRegressionSparse {
const logLossVectorInGradientUpdate: number[] = new Array<number>();
while (true) {
if (miniBatchIndexBegin >= numberInstances) {
Utility.debuggingLog(
`G-epoch=${epoch}/${epochs}` +
`, numberInstances=${numberInstances}` +
`, miniBatchIndexBegin=${miniBatchIndexBegin}` +
`, numberInstances=${numberInstances}`);
// Utility.debuggingLog(
// `G-epoch=${epoch}/${epochs}` +
// `, numberInstances=${numberInstances}` +
// `, miniBatchIndexBegin=${miniBatchIndexBegin}` +
// `, numberInstances=${numberInstances}`);
break;
}
// Utility.debuggingLog(

Просмотреть файл

@ -98,9 +98,9 @@ export function exampleFunctionUtility(): void {
const args: any = parsedKnownArgs[0];
const unknownArgs: any = parsedKnownArgs[1];
Utility.debuggingLog(
`args=${JSON.stringify(args)}`);
`args=${Utility.JSONstringify(args)}`);
Utility.debuggingLog(
`unknownArgs=${JSON.stringify(unknownArgs)}`);
`unknownArgs=${Utility.JSONstringify(unknownArgs)}`);
const debugFlag: boolean = Utility.toBoolean(args.debug);
Utility.toPrintDebuggingLogToConsole = debugFlag;
// ---- NOTE-FOR-DEBUGGING ---- console.dir(args);

Просмотреть файл

@ -988,6 +988,14 @@ export class Utility {
`, utterance=$${utterance}$` +
`, line=$${line}$`);
}
if (Utility.isEmptyString(utterance)) {
Utility.debuggingThrow(
`LINE - INDEX=${lineIndex}, utterance is empty` +
`, lineColumns.length=${lineColumns.length}` +
`, utterance=$${utterance}$` +
`, utterance=$${utterance}$` +
`, line=$${line}$`);
}
// {
// Utility.debuggingLog(
// `LINE - INDEX=${lineIndex}` +
@ -1384,7 +1392,7 @@ export class Utility {
Utility.debuggingThrow(
`lineColumns.length|${lineColumns.length}|!=4` +
`,line=$${line}$` +
`,lineColumns=$${JSON.stringify(lineColumns)}$`);
`,lineColumns=$${Utility.JSONstringify(lineColumns)}$`);
}
const id: string = lineColumns[0];
const word: string = lineColumns[1];
@ -1609,29 +1617,39 @@ export class Utility {
message: any): void {
const dateTimeString: string = (new Date()).toISOString();
const logMessage: string = `[${dateTimeString}] ERROR-MESSAGE: ${message}`;
throw new Error(JSON.stringify(logMessage));
throw new Error(Utility.JSONstringify(logMessage));
}
public static almostEqual(first: number, second: number): boolean {
return Utility.getAlmostEqualPercentage(first, second) < Utility.epsilon;
const almostEqualPercentage: number = Utility.getAlmostEqualPercentage(first, second);
const isAlmostEqual: boolean = almostEqualPercentage < Utility.epsilon;
return isAlmostEqual;
}
public static almostEqualRough(first: number, second: number): boolean {
return Utility.getAlmostEqualPercentage(first, second) < Utility.epsilonRough;
const almostEqualPercentage: number = Utility.getAlmostEqualPercentage(first, second);
const isAlmostEqual: boolean = almostEqualPercentage < Utility.epsilonRough;
return isAlmostEqual;
}
public static getAlmostEqualPercentage(first: number, second: number): number {
if (second === 0) {
return Math.abs(first);
}
return Math.abs((first - second) / second);
const almostEqualPercentage: number = Math.abs((first - second) / second);
return almostEqualPercentage;
}
public static almostEqualAbsolute(first: number, second: number): boolean {
return Utility.getAlmostEqualAbsolute(first, second) < Utility.epsilon;
const almostEqualAbsolute: number = Utility.getAlmostEqualAbsolute(first, second);
const isAlmostEqualAbsolute: boolean = almostEqualAbsolute < Utility.epsilon;
return isAlmostEqualAbsolute;
}
public static almostEqualAbsoluteRough(first: number, second: number): boolean {
return Utility.getAlmostEqualAbsolute(first, second) < Utility.epsilonRough;
const almostEqualAbsolute: number = Utility.getAlmostEqualAbsolute(first, second);
const isAlmostEqualAbsolute: boolean = almostEqualAbsolute < Utility.epsilonRough;
return isAlmostEqualAbsolute;
}
public static getAlmostEqualAbsolute(first: number, second: number): number {
return Math.abs(first - second);
const almostEqualAbsolute: number = Math.abs(first - second);
return almostEqualAbsolute;
}
public static toBoolean(value: any): boolean {
@ -1849,6 +1867,21 @@ export class Utility {
public static getFileBasename(filename: string): string {
return path.basename(filename);
}
public static getFileDirname(filename: string): string {
return path.dirname(filename);
}
public static getFileExtname(filename: string): string {
return path.extname(filename);
}
public static getFilenameWithoutExtension(filename: string): string {
const extension: string = Utility.getFileExtname(filename);
const filenameWithoutExtension: string = filename.substring(0, filename.length - extension.length);
return filenameWithoutExtension;
}
public static JSONstringify(input: any): string {
return JSON.stringify(input, null, 4);
}
protected static rngBurninIterations: number = 16384;
protected static rngBurninDone: boolean = false;

Просмотреть файл

@ -10,6 +10,7 @@ import { DataUtility } from "../../src/data/DataUtility";
import { Utility } from "../../src/utility/Utility";
import { UnitTestHelper } from "../utility/Utility.test";
import { NgramSubwordFeaturizer } from "../../src/model/language_understanding/featurizer/NgramSubwordFeaturizer";
describe("Test Suite - data/DataUtility", () => {
it("Test.0000 getDataFileTypeFromFilenameExtension", function() {
@ -74,7 +75,7 @@ describe("Test Suite - data/DataUtility", () => {
const luQnaJsonStructure: string =
luData.getLuQnaJsonStructure();
Utility.debuggingLog(
`luQnaJsonStructure-MicrosoftFaqForWindows=${JSON.stringify(luQnaJsonStructure)}`);
`luQnaJsonStructure-MicrosoftFaqForWindows=${Utility.JSONstringify(luQnaJsonStructure)}`);
});
});
it("Test.0102 LoadData", function() {
@ -89,7 +90,7 @@ describe("Test Suite - data/DataUtility", () => {
const luQnaJsonStructure: string =
luData.getLuQnaJsonStructure();
Utility.debuggingLog(
`luQnaJsonStructure-MicrosoftFaqForOffice=${JSON.stringify(luQnaJsonStructure)}`);
`luQnaJsonStructure-MicrosoftFaqForOffice=${Utility.JSONstringify(luQnaJsonStructure)}`);
});
});
});

Просмотреть файл

@ -294,23 +294,23 @@ describe("Test Suite - model/evaluation/confusion_matrix/confusion_matrix", () =
"macroAverageMetrics": { "averagePrecision": number,
"averageRecall": number,
"averageF1Score": number,
"totalMacroAverage": number },
"support": number },
"microAverageMetrics": { "accuracy": number,
"truePositives": number,
"totalMicroAverage": number },
"support": number },
"weightedMacroAverageMetrics": { "weightedAveragePrecision": number,
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"weightedTotalMacroAverage": number } } =
"weightedAverageRecall": number,
"weightedAverageF1Score": number,
"support": number } } =
ConfusionMatrix.generateConfusionMatrixMetricStructure(
confusionMatrix);
const confusionMatrixMetrics: [number, number, number, number] =
[ confusionMatrixMetricStructure.macroAverageMetrics.averagePrecision,
confusionMatrixMetricStructure.macroAverageMetrics.averageRecall,
confusionMatrixMetricStructure.macroAverageMetrics.averageF1Score,
confusionMatrixMetricStructure.macroAverageMetrics.totalMacroAverage ];
confusionMatrixMetricStructure.macroAverageMetrics.support ];
Utility.debuggingLog(
`confusionMatrixMetricStructure=${JSON.stringify(confusionMatrixMetricStructure, null, 4)}`);
`confusionMatrixMetricStructure=${Utility.JSONstringify(confusionMatrixMetricStructure)}`);
assert.ok(Utility.almostEqual(confusionMatrixMetrics[0], 0.3333333333333333),
`confusionMatrixMetrics[0]=${confusionMatrixMetrics[0]}`);
assert.ok(Utility.almostEqual(confusionMatrixMetrics[1], 0.3333333333333333),

Просмотреть файл

@ -61,15 +61,6 @@ describe("Test Suite - model/evaluation/cross_validator/CrossValidator", async (
assert(utteranceFeatureIndexArrays, "utteranceFeatureIndexArrays is undefined.");
const crossValidator: CrossValidator =
new CrossValidator(
luData.getFeaturizerLabels(),
luData.getFeaturizerLabelMap(),
luData.getFeaturizer().getNumberLabels(),
luData.getFeaturizer().getNumberFeatures(),
luData.getIntents(),
luData.getUtterances(),
luData.getIntentLabelIndexArray(),
luData.getUtteranceFeatureIndexArrays(),
luData.getIntentInstanceIndexMapArray(),
numberOfCrossValidationFolds,
learnerParameterEpochs,
learnerParameterMiniBatchSize,
@ -78,6 +69,16 @@ describe("Test Suite - model/evaluation/cross_validator/CrossValidator", async (
learnerParameterLossEarlyStopRatio,
learnerParameterLearningRate,
learnerParameterToCalculateOverallLossAfterEpoch);
crossValidator.crossValidate(
luData.getFeaturizerLabels(),
luData.getFeaturizerLabelMap(),
luData.getFeaturizer().getNumberLabels(),
luData.getFeaturizer().getNumberFeatures(),
luData.getIntents(),
luData.getUtterances(),
luData.getIntentLabelIndexArray(),
luData.getUtteranceFeatureIndexArrays(),
luData.getIntentInstanceIndexMapArray());
const crossValidationResult: {
"confusionMatrixCrossValidation": ConfusionMatrix
"thresholdReporterCrossValidation": ThresholdReporter,
@ -134,15 +135,6 @@ describe("Test Suite - model/evaluation/cross_validator/CrossValidator", async (
assert(utteranceFeatureIndexArrays, "utteranceFeatureIndexArrays is undefined.");
const crossValidator: CrossValidator =
new CrossValidator(
columnarData.getFeaturizerLabels(),
columnarData.getFeaturizerLabelMap(),
columnarData.getFeaturizer().getNumberLabels(),
columnarData.getFeaturizer().getNumberFeatures(),
columnarData.getIntents(),
columnarData.getUtterances(),
columnarData.getIntentLabelIndexArray(),
columnarData.getUtteranceFeatureIndexArrays(),
columnarData.getIntentInstanceIndexMapArray(),
numberOfCrossValidationFolds,
learnerParameterEpochs,
learnerParameterMiniBatchSize,
@ -151,6 +143,16 @@ describe("Test Suite - model/evaluation/cross_validator/CrossValidator", async (
learnerParameterLossEarlyStopRatio,
learnerParameterLearningRate,
learnerParameterToCalculateOverallLossAfterEpoch);
crossValidator.crossValidate(
columnarData.getFeaturizerLabels(),
columnarData.getFeaturizerLabelMap(),
columnarData.getFeaturizer().getNumberLabels(),
columnarData.getFeaturizer().getNumberFeatures(),
columnarData.getIntents(),
columnarData.getUtterances(),
columnarData.getIntentLabelIndexArray(),
columnarData.getUtteranceFeatureIndexArrays(),
columnarData.getIntentInstanceIndexMapArray());
const crossValidationResult: {
"confusionMatrixCrossValidation": ConfusionMatrix
"thresholdReporterCrossValidation": ThresholdReporter,

Просмотреть файл

@ -92,7 +92,7 @@ describe("Test Suite - model/language_understanding/featurizer/ngram_subword_fea
const intentsUtterances: { "intents": string[], "utterances": string[] } =
featurizer.getIntentsUtterances();
Utility.debuggingLog(
`intentsUtterances=${JSON.stringify(intentsUtterances)}`);
`intentsUtterances=${Utility.JSONstringify(intentsUtterances)}`);
});
it("Test.0200 getLabels()", function() {

Просмотреть файл

@ -217,7 +217,7 @@ describe("Test Suite - utility/Utility", () => {
stringNumberMap.set("a", 1);
const mapInObject: any = Utility.stringMapToObject(stringNumberMap);
const mapInJsonString: string =
JSON.stringify(mapInObject);
Utility.JSONstringify(mapInObject);
Utility.debuggingLog(
`mapInJsonString=${mapInJsonString}`);
});
@ -228,7 +228,7 @@ describe("Test Suite - utility/Utility", () => {
stringNumberMap.set("a", 1);
const mapInObject: any = Utility.stringMapToObject(stringNumberMap);
const mapInJsonString: string =
JSON.stringify(mapInObject);
Utility.JSONstringify(mapInObject);
Utility.debuggingLog(
`mapInJsonString=${mapInJsonString}`);
const mapInObjectFromJsonString: Map<string, number> =
@ -245,7 +245,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetInObject: any =
Utility.stringMapSetToObject(stringNumberMapSet);
const mapSetInJsonString: string =
JSON.stringify(stringMapSetInObject);
Utility.JSONstringify(stringMapSetInObject);
Utility.debuggingLog(
`mapSetInJsonString=${mapSetInJsonString}`);
});
@ -257,7 +257,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetInObject: any =
Utility.stringMapSetToObject(stringNumberMapSet);
const mapSetInJsonString: string =
JSON.stringify(stringMapSetInObject);
Utility.JSONstringify(stringMapSetInObject);
Utility.debuggingLog(
`mapSetInJsonString=${mapSetInJsonString}`);
const stringNumberMapSetNew: Map<string, Set<number>> =
@ -268,7 +268,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetNewInObject: any =
Utility.stringMapSetToObject(stringNumberMapSetNew);
const mapSetNewInJsonString: string =
JSON.stringify(stringMapSetNewInObject);
Utility.JSONstringify(stringMapSetNewInObject);
Utility.debuggingLog(
`mapSetNewInJsonString=${mapSetNewInJsonString}`);
assert.ok((stringNumberMapSetNew.get("a") as Set<number>).size === 1,
@ -286,7 +286,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayInObject: any =
Utility.stringMapArrayToObject(stringNumberMapArray);
const mapArrayInJsonString: string =
JSON.stringify(stringMapArrayInObject);
Utility.JSONstringify(stringMapArrayInObject);
Utility.debuggingLog(
`mapArrayInJsonString=${mapArrayInJsonString}`);
});
@ -298,7 +298,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayInObject: any =
Utility.stringMapArrayToObject(stringNumberMapArray);
const mapArrayInJsonString: string =
JSON.stringify(stringMapArrayInObject);
Utility.JSONstringify(stringMapArrayInObject);
Utility.debuggingLog(
`mapArrayInJsonString=${mapArrayInJsonString}`);
const stringNumberMapArrayNew: Map<string, number[]> =
@ -309,7 +309,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayNewInObject: any =
Utility.stringMapArrayToObject(stringNumberMapArrayNew);
const mapArrayNewInJsonString: string =
JSON.stringify(stringMapArrayNewInObject);
Utility.JSONstringify(stringMapArrayNewInObject);
Utility.debuggingLog(
`mapArrayNewInJsonString=${mapArrayNewInJsonString}`);
assert.ok((stringNumberMapArrayNew.get("a") as number[]).length === 1,
@ -329,7 +329,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetInJson: string =
Utility.stringMapSetToJson(stringNumberMapSet);
const mapSetInJsonString: string =
JSON.stringify(stringMapSetInJson);
Utility.JSONstringify(stringMapSetInJson);
Utility.debuggingLog(
`mapSetInJsonString=${mapSetInJsonString}`);
});
@ -341,7 +341,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetInJson: string =
Utility.stringMapSetToJson(stringNumberMapSet);
const mapSetInJsonString: string =
JSON.stringify(stringMapSetInJson);
Utility.JSONstringify(stringMapSetInJson);
Utility.debuggingLog(
`mapSetInJsonString=${mapSetInJsonString}`);
const stringNumberMapSetNew: Map<string, Set<number>> =
@ -352,7 +352,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapSetNewInJson: string =
Utility.stringMapSetToJson(stringNumberMapSetNew);
const mapSetNewInJsonString: string =
JSON.stringify(stringMapSetNewInJson);
Utility.JSONstringify(stringMapSetNewInJson);
Utility.debuggingLog(
`mapSetNewInJsonString=${mapSetNewInJsonString}`);
assert.ok((stringNumberMapSetNew.get("a") as Set<number>).size === 1,
@ -370,7 +370,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayInJson: string =
Utility.stringMapArrayToJson(stringNumberMapArray);
const mapArrayInJsonString: string =
JSON.stringify(stringMapArrayInJson);
Utility.JSONstringify(stringMapArrayInJson);
Utility.debuggingLog(
`mapArrayInJsonString=${mapArrayInJsonString}`);
});
@ -382,7 +382,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayInJson: string =
Utility.stringMapArrayToJson(stringNumberMapArray);
const mapArrayInJsonString: string =
JSON.stringify(stringMapArrayInJson);
Utility.JSONstringify(stringMapArrayInJson);
Utility.debuggingLog(
`mapArrayInJsonString=${mapArrayInJsonString}`);
const stringNumberMapArrayNew: Map<string, number[]> =
@ -393,7 +393,7 @@ describe("Test Suite - utility/Utility", () => {
const stringMapArrayNewInJson: string =
Utility.stringMapArrayToJson(stringNumberMapArrayNew);
const mapArrayNewInJsonString: string =
JSON.stringify(stringMapArrayNewInJson);
Utility.JSONstringify(stringMapArrayNewInJson);
Utility.debuggingLog(
`mapArrayNewInJsonString=${mapArrayNewInJsonString}`);
assert.ok((stringNumberMapArrayNew.get("a") as number[]).length === 1,
@ -643,13 +643,13 @@ describe("Test Suite - utility/Utility", () => {
this.timeout(UnitTestHelper.getDefaultUnitTestTimeout());
const array: number[] = [1, 2, 3, 4, 5];
const arrayInJsonString: string =
JSON.stringify(array);
Utility.JSONstringify(array);
Utility.debuggingLog(
`arrayInJsonString=${arrayInJsonString}`);
const arrayShuffled: number[] =
Utility.shuffle(array);
const arrayShuffledInJsonString: string =
JSON.stringify(arrayShuffled);
Utility.JSONstringify(arrayShuffled);
Utility.debuggingLog(
`arrayShuffledInJsonString=${arrayShuffledInJsonString}`);
assert.ok(array === arrayShuffled,
@ -660,7 +660,7 @@ describe("Test Suite - utility/Utility", () => {
this.timeout(UnitTestHelper.getDefaultUnitTestTimeout());
const arrayOriginal: number[] = [1, 2, 3, 4, 5];
const arrayOriginalInJsonString: string =
JSON.stringify(arrayOriginal);
Utility.JSONstringify(arrayOriginal);
Utility.debuggingLog(
`arrayOriginalInJsonString=${arrayOriginalInJsonString}`);
Utility.rngSeedXorshift128plusBigIntWithNumber(3, 4);
@ -668,7 +668,7 @@ describe("Test Suite - utility/Utility", () => {
Object.assign([], arrayOriginal);
Utility.shuffle(arrayShuffled);
const arrayShuffledInJsonString: string =
JSON.stringify(arrayShuffled);
Utility.JSONstringify(arrayShuffled);
Utility.debuggingLog(
`arrayShuffledInJsonString=${arrayShuffledInJsonString}`);
Utility.rngSeedXorshift128plusBigIntWithNumber(3, 4);
@ -676,7 +676,7 @@ describe("Test Suite - utility/Utility", () => {
Object.assign([], arrayOriginal);
Utility.shuffle(arrayShuffledNew);
const arrayShuffledNewInJsonString: string =
JSON.stringify(arrayShuffledNew);
Utility.JSONstringify(arrayShuffledNew);
Utility.debuggingLog(
`arrayShuffledNewInJsonString=${arrayShuffledNewInJsonString}`);
assert.ok(arrayOriginal.length === arrayShuffled.length,
@ -694,13 +694,13 @@ describe("Test Suite - utility/Utility", () => {
this.timeout(UnitTestHelper.getDefaultUnitTestTimeout());
const stringArray: string[] = ["b", "a", "c", "d"];
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
const stringMap: IDictionaryStringIdGenericValue<number> =
DictionaryMapUtility.buildStringIdNumberValueDictionaryFromUniqueStringArray(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringMapInJsonString=${stringMapInJsonString}`);
});
@ -709,7 +709,7 @@ describe("Test Suite - utility/Utility", () => {
this.timeout(UnitTestHelper.getDefaultUnitTestTimeout());
const stringArray: string[] = ["b", "a", "b", "c", "a", "a", "b", "d"];
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
const stringArrayMap: { "stringArray": string[], "stringMap": IDictionaryStringIdGenericValue<number> } =
@ -719,11 +719,11 @@ describe("Test Suite - utility/Utility", () => {
const stringMappedMap: IDictionaryStringIdGenericValue<number> =
stringArrayMap.stringMap;
const stringMappedArrayInJsonString: string =
JSON.stringify(stringMappedArray);
Utility.JSONstringify(stringMappedArray);
Utility.debuggingLog(
`stringMappedArrayInJsonString=${stringMappedArrayInJsonString}`);
const stringMappedMapInJsonString: string =
JSON.stringify(stringMappedMap);
Utility.JSONstringify(stringMappedMap);
Utility.debuggingLog(
`stringMappedMapInJsonString=${stringMappedMapInJsonString}`);
});
@ -734,7 +734,7 @@ describe("Test Suite - utility/Utility", () => {
[["b", "a", "b", "c", "a", "a", "b", "d"],
["b", "a", "b", "c", "a", "a", "b", "d"]];
const stringArraysInJsonString: string =
JSON.stringify(stringArrays);
Utility.JSONstringify(stringArrays);
Utility.debuggingLog(
`stringArraysInJsonString=${stringArraysInJsonString}`);
const stringArrayMap: { "stringArray": string[], "stringMap": IDictionaryStringIdGenericValue<number> } =
@ -744,11 +744,11 @@ describe("Test Suite - utility/Utility", () => {
const stringMappedMap: IDictionaryStringIdGenericValue<number> =
stringArrayMap.stringMap;
const stringMappedArrayInJsonString: string =
JSON.stringify(stringMappedArray);
Utility.JSONstringify(stringMappedArray);
Utility.debuggingLog(
`stringMappedArrayInJsonString=${stringMappedArrayInJsonString}`);
const stringMappedMapInJsonString: string =
JSON.stringify(stringMappedMap);
Utility.JSONstringify(stringMappedMap);
Utility.debuggingLog(
`stringMappedMapInJsonString=${stringMappedMapInJsonString}`);
});
@ -759,9 +759,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = ["b", "a", "c", "d"];
const stringArray1: string[] = ["b", "a", "c", "d"];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -778,9 +778,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = [];
const stringArray1: string[] = [];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -797,9 +797,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = [];
const stringArray1: string[] = ["b", "a", "c", "d"];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -816,9 +816,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = ["b", "a", "c", "d"];
const stringArray1: string[] = [];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -835,9 +835,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = [];
const stringArray1: string[] = ["b", "f", "c", "d"];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -851,9 +851,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = ["b", "a", "c", "d"];
const stringArray1: string[] = [];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -867,9 +867,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray0: string[] = ["b", "a", "c", "d"];
const stringArray1: string[] = ["b", "f", "c", "d"];
const stringArray0InJsonString: string =
JSON.stringify(stringArray0);
Utility.JSONstringify(stringArray0);
const stringArray1InJsonString: string =
JSON.stringify(stringArray1);
Utility.JSONstringify(stringArray1);
Utility.debuggingLog(
`stringArray0InJsonString=${stringArray0InJsonString}`);
Utility.debuggingLog(
@ -1007,9 +1007,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap1: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1026,9 +1026,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = {};
const stringMap1: IDictionaryStringIdGenericValue<number> = {};
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1045,9 +1045,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = {};
const stringMap1: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1064,9 +1064,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap1: IDictionaryStringIdGenericValue<number> = {};
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1083,9 +1083,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = {};
const stringMap1: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1099,9 +1099,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap1: IDictionaryStringIdGenericValue<number> = {};
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1115,9 +1115,9 @@ describe("Test Suite - utility/Utility", () => {
const stringMap0: IDictionaryStringIdGenericValue<number> = { a: 1, b: 2, c: 3 };
const stringMap1: IDictionaryStringIdGenericValue<number> = { a: 2, b: 2, c: 3 };
const stringMap0InJsonString: string =
JSON.stringify(stringMap0);
Utility.JSONstringify(stringMap0);
const stringMap1InJsonString: string =
JSON.stringify(stringMap1);
Utility.JSONstringify(stringMap1);
Utility.debuggingLog(
`stringMap0InJsonString=${stringMap0InJsonString}`);
Utility.debuggingLog(
@ -1132,9 +1132,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "c"];
const stringMap: IDictionaryStringIdGenericValue<number> = {a: 0, b: 1, c: 2};
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1151,9 +1151,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = [];
const stringMap: IDictionaryStringIdGenericValue<number> = {a: 0, b: 1, c: 2};
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1170,9 +1170,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "c"];
const stringMap: IDictionaryStringIdGenericValue<number> = {};
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1189,9 +1189,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b"];
const stringMap: IDictionaryStringIdGenericValue<number> = {a: 0, b: 1, c: 2};
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1208,9 +1208,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "d"];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1227,9 +1227,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "c"];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: -1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1246,9 +1246,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = [];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1265,9 +1265,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "c"];
const stringMap: IDictionaryStringIdGenericValue<number> = {};
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1284,9 +1284,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b"];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1303,9 +1303,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "d"];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1322,9 +1322,9 @@ describe("Test Suite - utility/Utility", () => {
const stringArray: string[] = ["a", "b", "c"];
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: -1, c: 2 };
const stringArrayInJsonString: string =
JSON.stringify(stringArray);
Utility.JSONstringify(stringArray);
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`stringArrayInJsonString=${stringArrayInJsonString}`);
Utility.debuggingLog(
@ -1341,7 +1341,7 @@ describe("Test Suite - utility/Utility", () => {
const keyId: number = 1;
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`keyId=${keyId}`);
Utility.debuggingLog(
@ -1358,7 +1358,7 @@ describe("Test Suite - utility/Utility", () => {
const keyId: number = -1;
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`keyId=${keyId}`);
Utility.debuggingLog(
@ -1375,7 +1375,7 @@ describe("Test Suite - utility/Utility", () => {
const keyId: number = 3;
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`keyId=${keyId}`);
Utility.debuggingLog(
@ -1392,7 +1392,7 @@ describe("Test Suite - utility/Utility", () => {
const keyId: number = -1;
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`keyId=${keyId}`);
Utility.debuggingLog(
@ -1408,7 +1408,7 @@ describe("Test Suite - utility/Utility", () => {
const keyId: number = 3;
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`keyId=${keyId}`);
Utility.debuggingLog(
@ -1424,7 +1424,7 @@ describe("Test Suite - utility/Utility", () => {
const key: string = "b";
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`key=${key}`);
Utility.debuggingLog(
@ -1441,7 +1441,7 @@ describe("Test Suite - utility/Utility", () => {
const key: string = "d";
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`key=${key}`);
Utility.debuggingLog(
@ -1458,7 +1458,7 @@ describe("Test Suite - utility/Utility", () => {
const key: string = "d";
const stringMap: IDictionaryStringIdGenericValue<number> = { a: 0, b: 1, c: 2 };
const stringMapInJsonString: string =
JSON.stringify(stringMap);
Utility.JSONstringify(stringMap);
Utility.debuggingLog(
`key=${key}`);
Utility.debuggingLog(