Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleAgeEstimator"/> class with the model file path that this estimator uses.
        /// </summary>
        /// <param name="modelPath">The model file path that this estimator uses.</param>
        /// <exception cref="FileNotFoundException">The model file is not found.</exception>
        public SimpleAgeEstimator(string modelPath)
        {
            if (!File.Exists(modelPath))
            {
                throw new FileNotFoundException(modelPath);
            }

            var ret       = NativeMethods.LossMulticlassLog_age_train_type_create();
            var networkId = LossMulticlassLogRegistry.GetId(ret);

            if (LossMulticlassLogRegistry.Contains(networkId))
            {
                NativeMethods.LossMulticlassLog_age_train_type_delete(ret);
            }
            else
            {
                LossMulticlassLogRegistry.Add(ret);
            }

            this._Network = LossMulticlassLog.Deserialize(modelPath, networkId);
        }