public void Train(string inputPath, string outputPath, FastTextArgs args)
        {
            ValidatePaths(inputPath, outputPath, args.PretrainedVectors);

            var argsStruct = _mapper.Map <FastTextArgsStruct>(args);

            CheckForErrors(Train(_fastText, inputPath, outputPath, argsStruct, args.LabelPrefix, args.PretrainedVectors));
            _maxLabelLen = GetMaxLabelLength(_fastText);
        }
        /// <summary>
        /// Returns the same supervised args defaults as in
        /// https://github.com/olegtarasov/fastText/blob/b0a32d744f4d16d8f9834649f6f178ff79b5a4ce/src/fasttext_api.cc#L41
        /// </summary>
        /// <returns></returns>
        public static unsafe FastTextArgs SupervisedDefaults()
        {
            var result = new FastTextArgs(false);

            FastTextWrapper.FastTextArgsStruct *argsPtr;

            GetDefaultSupervisedArgs(new IntPtr(&argsPtr));

            Mapper.Map(*argsPtr, result);

            DestroyArgs(new IntPtr(argsPtr));

            return(result);
        }
        /// <summary>
        /// Trains a new supervised model.
        /// Use <see cref="FastTextArgs.SupervisedDefaults"/> to get reasonable default args for
        /// supervised training.
        /// </summary>
        /// <param name="inputPath">Path to a training set.</param>
        /// <param name="outputPath">Path to write the model to (excluding extension).</param>
        /// <param name="args">Low-level training arguments.</param>
        /// <remarks>Trained model will consist of two files: .bin (main model) and .vec (word vectors).</remarks>
        public void Supervised(string inputPath, string outputPath, FastTextArgs args)
        {
            ValidatePaths(inputPath, outputPath, args.PretrainedVectors);

            if (args.model != ModelName.Supervised)
            {
                _logger?.LogWarning($"{args.model} model type specified in a Supervised() call. Model type will be changed to Supervised.");
            }

            var argsStruct = _mapper.Map <FastTextArgsStruct>(args);

            argsStruct.model = model_name.sup;
            CheckForErrors(Supervised(_fastText, inputPath, outputPath, argsStruct, args.LabelPrefix, args.PretrainedVectors));
            _maxLabelLen = CheckForErrors(GetMaxLabelLength(_fastText));
        }
        /// <summary>
        /// Trains a new model using low-level FastText arguments.
        /// </summary>
        /// <param name="inputPath">Path to a training set.</param>
        /// <param name="outputPath">Path to write the model to (excluding extension).</param>
        /// <param name="args">Low-level training arguments.</param>
        /// <remarks>Trained model will consist of two files: .bin (main model) and .vec (word vectors).</remarks>
        public void Train(string inputPath, string outputPath, FastTextArgs args)
        {
            ValidatePaths(inputPath, outputPath, args.PretrainedVectors);

            var argsStruct = new TrainingArgsStruct
            {
                bucket = args.bucket,
                cutoff = args.cutoff,
                dim    = args.dim,
                dsub   = args.dsub,
                epoch  = args.epoch,

                loss          = (loss_name)args.loss,
                lr            = args.lr,
                lrUpdateRate  = args.lrUpdateRate,
                maxn          = args.maxn,
                minCount      = args.minCount,
                minCountLabel = args.minCountLabel,
                minn          = args.minn,
                model         = (model_name)args.model,
                neg           = args.neg,

                qnorm      = args.qnorm,
                qout       = args.qout,
                retrain    = args.retrain,
                saveOutput = args.saveOutput,
                t          = args.t,
                thread     = args.thread,
                verbose    = args.verbose,
                wordNgrams = args.wordNgrams,
                ws         = args.ws,
            };

            Train(_fastText, inputPath, outputPath, argsStruct, args.LabelPrefix, args.PretrainedVectors);
            _maxLabelLen = GetMaxLabelLength(_fastText);
            _modelLoaded = true;
        }