Пример #1
0
 /// <summary>
 /// Apply the training package to the model
 /// </summary>
 /// <param name="trainingPackage"></param>
 private void UseTrainingPackage(TrainingPackage trainingPackage)
 {
     foreach (FeaturePackage fp in trainingPackage.TrainingPackageQueries)
     {
         _lrModel.TrainModel(fp); // Pass to model for training
     }
 }
Пример #2
0
        /// <summary>
        /// Build the training package for a query prefix
        /// </summary>
        /// <param name="partialQuery"></param>
        /// <returns></returns>
        private TrainingPackage BuildTrainingPackage(string partialQuery, bool isFirstTrainingPackageForPrefix)
        {
            TrainingPackage trainingPackage = new TrainingPackage();
            trainingPackage.QueryCountAtCreation = _currentQueryCount; // Set the query count at package creation
            trainingPackage.IsFirstTrainingPackageForPrefix = isFirstTrainingPackageForPrefix;
            trainingPackage.ForPrefix = partialQuery;

            trainingPackage.TrainingPackageQueries = new List<FeaturePackage>();

            Dictionary<string, FeaturePackage> trainingPackageQueriesLookup = new Dictionary<string, FeaturePackage>(); // Index lookup by query

            NonTemporalBucket<BaseIndexEntry> biggestNTB = _ntbs[_ntbs.Length - 1][partialQuery];

            // Efficiently build the features for each query
            foreach (BaseIndexEntry prefixEntry in biggestNTB.AllBucketQueries)
            {
                FeaturePackage tpq = BuildFeaturePackage(prefixEntry, partialQuery);

                trainingPackage.TrainingPackageQueries.Add(tpq);
            }

            return trainingPackage;
        }