internal static void Reset() { mostRecent = null; }
/// <summary> /// Generate a random query. No need to pass labelForUnlabeled here, since the random queries are all given labels. /// Still pass scoreForDegenerateQuery just in case some query gets all labels the same. /// Scores are not set here. /// </summary> /// <param name="priors"></param> /// <param name="scale"></param> /// <param name="nScores"></param> /// <param name="rangen"></param> /// <param name="nRows"></param> public Query(float[] priors, double scale, int nScores, int nRows, string queryID, Random rangen) { length = nRows; QueryID = queryID; QueryRow[] qr = new QueryRow[length]; ftrVectors = new float[length][]; scores = new double[length]; labels = new float[length]; for (int i = 0; i < nRows; ++i) { qr[i] = new QueryRow(priors, scale, nScores, rangen); labels[i] = qr[i].Label; ftrVectors[i] = qr[i].Features; } DCGScorer dcg = new DCGScorer(); FillMaxDCGs(dcg); }
public QueryRow(float label, float[] features, float labelForUnlabeled) { this.label = (label == -1) ? labelForUnlabeled : label; this.features = features; previous = mostRecent; mostRecent = this; }