示例#1
0
 private static void TrainLowLevel()
 {
     using (var fastText = new FastTextWrapper())
     {
         fastText.Train(@"D:\__Models\cooking.train.txt", @"D:\__Models\cooking", new FastTextArgs
         {
         });
     }
 }
        public void CanTrainModelWithOldApi()
        {
            var    fastText = new FastTextWrapper(loggerFactory: _loggerFactory);
            string outPath  = Path.Combine(_tempDir, "cooking");

            fastText.Train("cooking.train.txt", outPath, FastTextArgs.SupervisedDefaults());

            CheckLabels(fastText.GetLabels());

            File.Exists(outPath + ".bin").Should().BeTrue();
            File.Exists(outPath + ".vec").Should().BeTrue();
        }
示例#3
0
 private static void TrainSupervised(FastTextWrapper fastText, string trainFile, string modelFile)
 {
     fastText.Train(trainFile, modelFile, SupervisedArgs.SupervisedDefaults(
                        x =>
     {
         x.Epochs       = 25;
         x.LearningRate = 1.0;
         x.WordNGrams   = 3;
         x.Verbose      = 2;
         x.LabelPrefix  = "__label__";
     }));
 }
示例#4
0
 private static void TrainSupervised()
 {
     using (var fastText = new FastTextWrapper())
     {
         fastText.Train(@"D:\__Models\cooking.train.txt", @"D:\__Models\cooking", SupervisedArgs.SupervisedDefaults(x =>
         {
             x.Epochs       = 25;
             x.LearningRate = 1.0;
             x.WordNGrams   = 3;
             x.Verbose      = 2;
             x.LabelPrefix  = "__label__";
         }));
     }
 }
示例#5
0
        static void Main(string[] args)
        {
            var fastText = new FastTextWrapper();

            fastText.Train(@"C:\_Models\cooking.train.txt", @"C:\_Models\cooking", TrainingArgs.SupervisedDefaults(x =>
            {
                x.Epochs        = 25;
                x.LearningRate  = 1.0;
                x.WordNGrams    = 3;
                x.Verbose       = 2;
                x.MinCharNGrams = 3;
                x.MaxCharNGrams = 6;
            }));

            //fastText.LoadModel(@"C:\_Models\fasttext.bin");
            var prediction = fastText.PredictSingle("what is the difference between a new york strip and a bone-in new york cut sirloin ?");
        }
示例#6
0
 private static void TrainLowLevel(FastTextWrapper fastText, string trainFile, string modelFile)
 {
     fastText.Train(trainFile, modelFile, new FastTextArgs
     {
     });
 }