Skip to content

Commit aeffcce

Browse files
Minor change so only needed files are copied. Training dataset is not needed for scoring in the sample
1 parent 7cb26f3 commit aeffcce

File tree

3 files changed

+57295
-3
lines changed

3 files changed

+57295
-3
lines changed

samples/csharp/getting-started/AnomalyDetection_CreditCardFraudDetection/CreditCardFraudDetection.Predictor/Program.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ static void Main(string[] args)
1212
string assetsPath = GetAbsolutePath(@"../../../assets");
1313
string trainOutput = GetAbsolutePath(@"../../../../CreditCardFraudDetection.Trainer/assets/output");
1414

15-
CopyModelAndDatasetFromTrainingProject(trainOutput, assetsPath);
16-
1715
var inputDatasetForPredictions = Path.Combine(assetsPath, "input", "testData.csv");
1816
var modelFilePath = Path.Combine(assetsPath, "input", "randomizedPca.zip");
1917

18+
//Always copy the trained model from the trainer project just in case there's a new version trained.
19+
CopyModelAndDatasetFromTrainingProject(trainOutput, assetsPath);
20+
2021
// Create model predictor to perform a few predictions
2122
var modelPredictor = new Predictor(modelFilePath, inputDatasetForPredictions);
2223

@@ -50,7 +51,9 @@ public static void CopyModelAndDatasetFromTrainingProject(string trainOutput, st
5051
LocalConsoleHelper.DeleteAssets(fileDestination);
5152
}
5253

53-
File.Copy(file, Path.Combine(Path.Combine(assetsPath, "input"), Path.GetFileName(file)));
54+
//Only copy the files we need for the scoring project
55+
if ((Path.GetFileName(file) == "testData.csv") || (Path.GetFileName(file) == "randomizedPca.zip"))
56+
File.Copy(file, Path.Combine(Path.Combine(assetsPath, "input"), Path.GetFileName(file)));
5457
}
5558
}
5659

0 commit comments

Comments
 (0)