示例#1
0
        static void DoFeatureReordering(string dataPath)
        {
            var model            = GetModel(dataPath, null);
            int numTrees         = model.Trees.Length;
            var timer            = new Timer(SaveBestFeatures, dataPath, 60_000, 60_000);
            var greedyReorderMap = FeatureReorderer.Greedy(model, numTrees);

            timer.Dispose();
            SaveBestFeatures(null);
            var allFeatureIndices = new HashSet <short>(greedyReorderMap);

            for (short i = 0; i < greedyReorderMap.Length; i++)
            {
                if (!allFeatureIndices.Contains(i))
                {
                    Console.WriteLine("The reorder mapping is not valid: not found index " + i);
                    break;
                }
            }
        }