Example #1
0
        /// <summary>
        /// Constructor for a maximum entropy model trained using the
        /// Generalized Iterative Scaling procedure.
        /// </summary>
        /// <param name="reader">
        /// A reader providing the data for the model.
        /// </param>
        public GisModel(IO.IGisModelReader reader)
        {
            this._reader        = reader;
            _outcomeNames       = reader.GetOutcomeLabels();
            CorrectionConstant  = reader.CorrectionConstant;
            CorrectionParameter = reader.CorrectionParameter;

            _outcomeCount              = _outcomeNames.Length;
            _initialProbability        = Math.Log(1.0 / _outcomeCount);
            _correctionConstantInverse = 1.0 / CorrectionConstant;
            _featureCounts             = new int[_outcomeCount];
        }
Example #2
0
        /// <summary>
        /// Constructor for a maximum entropy model trained using the
        /// Generalized Iterative Scaling procedure.
        /// </summary>
        /// <param name="reader">
        /// A reader providing the data for the model.
        /// </param>
        public GisModel(IO.IGisModelReader reader)
        {
            mReader              = reader;
            mOutcomeNames        = reader.GetOutcomeLabels();
            mCorrectionConstant  = (double)reader.CorrectionConstant;
            mCorrectionParameter = reader.CorrectionParameter;

            mOutcomeCount              = mOutcomeNames.Length;
            mInitialProbability        = System.Math.Log(1.0 / mOutcomeCount);
            mCorrectionConstantInverse = 1.0 / mCorrectionConstant;
            mFeatureCounts             = new int[mOutcomeCount];
        }
Example #3
0
        /// <summary>
        /// Constructor for a maximum entropy model trained using the
        /// Generalized Iterative Scaling procedure.
        /// </summary>
        /// <param name="reader">
        /// A reader providing the data for the model.
        /// </param>
        public GisModel(IO.IGisModelReader reader)
        {
            mReader       = reader;
            mOutcomeNames = reader.GetOutcomeLabels();
            // Quick & dirty solution for reading the latest OpenNLP sentence detection models
            if (mOutcomeNames.Length == 2 && mOutcomeNames.Contains("n") && mOutcomeNames.Contains("s"))
            {
                mOutcomeNames[Array.IndexOf(mOutcomeNames, "n")] = "F";
                mOutcomeNames[Array.IndexOf(mOutcomeNames, "s")] = "T";
            }
            mCorrectionConstant  = (double)reader.CorrectionConstant;
            mCorrectionParameter = reader.CorrectionParameter;

            mOutcomeCount              = mOutcomeNames.Length;
            mInitialProbability        = System.Math.Log(1.0 / mOutcomeCount);
            mCorrectionConstantInverse = 1.0 / mCorrectionConstant;
            mFeatureCounts             = new int[mOutcomeCount];
        }