예제 #1
0
        /// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of FreeSoundsModel25Input to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public FreeSoundsModel25Output GetPrediction(FreeSoundsModel25Input 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 FreeSoundsModel25Output(classLabelProbsValue, classLabelValue));
        }
예제 #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 FreeSoundsModel25Output GetPrediction(MLMultiArray audioSamples, MLPredictionOptions options, out NSError error)
        {
            var input = new FreeSoundsModel25Input(audioSamples);

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