protected override void OnNavigatedTo(NavigationEventArgs e) { Debug.WriteLine("Adam odebrał eventa"); base.OnNavigatedTo(e); this.autController = (AuthorController)e.Parameter; Debug.WriteLine("Imiona autorów Adama to: "); foreach (var name in autController.getAuthorsNames()) { Debug.WriteLine("\t " + name); } foreach (var autor in autController.getAuthorsNames()) { this.authorNames.Add(autor); } }
private string kNearestNeighbours(List <double> inputFeatures) { const int k = 10; return(authorController.getAuthorsNames().Select(name => authorController.getAuthor(name)). Select(author => author.getOriginalSignatures().Select(sgn => Tuple.Create(author.getName(), sgn))). SelectMany(x => x).AsEnumerable().Select(x => Tuple.Create(x.Item1, buildFeatures(x.Item2))). Select(x => Tuple.Create(x.Item1, L1(inputFeatures, x.Item2))).OrderByDescending(x => x.Item2). Take(k).GroupBy(x => x.Item1).OrderByDescending(grp => grp.Count()).First().Select(x => x.Item1).First()); }
private void updateAuthorCombobox() { var authorNames = authorController.getAuthorsNames(); if (authorNames.Any()) { this.authorCombobox.Items.Clear(); foreach (var authorName in this.authorController.getAuthorsNames()) { this.authorCombobox.Items.Add(authorName); } this.authorCombobox.SelectedIndex = 0; } }
private void updateAuthorCombobox() { authorCombobox.Items.Clear(); foreach (var authorName in authorController.getAuthorsNames()) { authorCombobox.Items.Add(authorName); } if (authorCombobox.Items.Count.Equals(0)) { authorCombobox.IsEnabled = false; } else { authorCombobox.IsEnabled = true; authorCombobox.SelectedIndex = authorCombobox.Items.Count - 1; } }