public void AddTag(Tag tag, IList songs) { if (tag == null || songs.Count <= 0) { return; } foreach (Song song in songs) { App.SongDb.TagSong(song, tag); } UpdateTags(); OnPropertyChanged("Prediction"); if (Prediction.Any()) { SelectedIndex = 0; } }
protected void RunModel(int foldN, IModel <LblT, ModelExT> model, ILabeledDataset <LblT, InputExT> trainSet, ILabeledDataset <LblT, ModelExT> mappedTrainSet, ILabeledDataset <LblT, InputExT> testSet, ILabeledDataset <LblT, ModelExT> mappedTestSet, CrossValidationTimeProfile modelProfile) { // train ILabeledDataset <LblT, ModelExT> usedTrainSet = BeforeTrain(foldN, model, trainSet, mappedTrainSet); Train(foldN, model, usedTrainSet); AfterTrain(foldN, model, usedTrainSet); modelProfile.TrainEndTime = DateTime.Now; // test modelProfile.TestStartTime = DateTime.Now; ILabeledDataset <LblT, ModelExT> usedTestSet = BeforeTest(foldN, model, testSet, mappedTestSet); PerfMatrix <LblT> foldMatrix = GetPerfMatrix(GetModelName(model), foldN); for (int i = 0; i < usedTestSet.Count; i++) { LabeledExample <LblT, ModelExT> le = usedTestSet[i]; Prediction <LblT> prediction = Predict(foldN, model, le); if (AfterPrediction(foldN, model, testSet[i].Example, le, prediction) && prediction.Any()) { foldMatrix.AddCount(le.Label, prediction.BestClassLabel); } } modelProfile.TestEndTime = DateTime.Now; AfterTest(foldN, model, usedTestSet); }