private void TreeNodeChecked(object sender, RadTreeNodeEventArgs e) { RadTreeNode node = e.Node; int termId = int.Parse(node.Value); if (node.Checked) { //Add Term foreach (Term term in Terms) { if (term.TermId == termId) { SelectedTerms.Add(term); break; } } } else { //Remove Term foreach (Term term in SelectedTerms) { if (term.TermId == termId) { SelectedTerms.Remove(term); break; } } } //Rebind _tree.DataBind(); }
/// <summary> /// Scores the specified entry. /// </summary> /// <param name="entry">The entry.</param> /// <param name="context">The context.</param> /// <param name="log">The log.</param> /// <returns></returns> public override double Score(DocumentSelectResultEntry entry, DocumentSelectResult context, ILogBuilder log) { if (useMachineLearning) { WeightDictionary dc_vec = TermWeightModel.GetWeights(SelectedTerms.GetKeys(), entry.spaceDocument, context.spaceModel); var n_vec = fvConstructor.ConstructFeatureVector(dc_vec, entry.AssignedID); Double score = 0; Int32 l_id = -1; if (sc_id.ContainsKey(entry.AssignedID)) { l_id = sc_id[entry.AssignedID]; } score = classifier.DoScore(n_vec, log, l_id); return(score); } else { if (scoreDictionary.ContainsKey(entry.AssignedID)) { var fv = scoreDictionary[entry.AssignedID]; return(fv.CompressNumericVector(vectorCompression)); } else { return(0); } } }
/// <summary> /// Computes score for given entry /// </summary> /// <param name="entry">The entry.</param> /// <param name="context">The context.</param> /// <param name="log">The log.</param> /// <returns></returns> public override double Score(DocumentSelectResultEntry entry, DocumentSelectResult context, ILogBuilder log) { Double output = 0; foreach (String term in entry.spaceDocument.terms.GetTokens()) { Boolean isOk = true; if (context.selectedFeatures != null) { if (context.selectedFeatures.Count > 0) { if (!context.selectedFeatures.ContainsKey(term)) { isOk = false; } } } if (isOk && SelectedTerms != null) { if (SelectedTerms.Count > 0) { if (!SelectedTerms.ContainsKey(term)) { isOk = false; } } } if (isOk) { if (queryTerms.Any()) { if (queryTerms.Contains(term)) { output += TermWeightModel.GetWeight(term, entry.spaceDocument, context.spaceModel); } } else { output += TermWeightModel.GetWeight(term, entry.spaceDocument, context.spaceModel); } } } return(output); }