Exemple #1
0
        /// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of FreeSoundsPlusModel25Input to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public FreeSoundsPlusModel25Output GetPrediction(FreeSoundsPlusModel25Input input, out NSError error)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            var prediction = model.GetPrediction(input, out error);

            if (prediction == null)
            {
                return(null);
            }

            var classLabelProbsValue = prediction.GetFeatureValue("classLabelProbs").DictionaryValue;
            var classLabelValue      = prediction.GetFeatureValue("classLabel").StringValue;

            return(new FreeSoundsPlusModel25Output(classLabelProbsValue, classLabelValue));
        }
Exemple #2
0
        /// <summary>
        /// Make a prediction using the convenience interface
        /// </summary>
        /// <param name="audioSamples">Input audio samples to be classified as 15600 1-dimensional array of floats</param>
        /// <param name="options">prediction options</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public FreeSoundsPlusModel25Output GetPrediction(MLMultiArray audioSamples, MLPredictionOptions options, out NSError error)
        {
            var input = new FreeSoundsPlusModel25Input(audioSamples);

            return(GetPrediction(input, options, out error));
        }