/// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of MarsHabitatPricerInput to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public MarsHabitatPricerOutput GetPrediction(MarsHabitatPricerInput input, out NSError error)
        {
            var prediction = model.GetPrediction(input, out error);

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

            var priceValue = prediction.GetFeatureValue("price").DoubleValue;

            return(new MarsHabitatPricerOutput(priceValue));
        }
        void updatePredictedPrice()
        {
            var pricerInput = new MarsHabitatPricerInput(datasource.GetValue(pickerView.SelectedRowInComponent(0), Feature.SolarPanels),
                                                         datasource.GetValue(pickerView.SelectedRowInComponent(1), Feature.Greenhouses),
                                                         datasource.GetValue(pickerView.SelectedRowInComponent(2), Feature.Size));

            // Use the ML model
            NSError prErr;
            var     outFeatures = model.GetPrediction(pricerInput, out prErr);
            var     result      = outFeatures.GetFeatureValue("price").DoubleValue;

            priceLabel.Text = "Predicted Price (millions) " + priceFormatter.StringFor(new NSNumber(result));

            Console.WriteLine(prErr == null ? $"result was {result}" : "Unexpected runtime error " + prErr.Description);
        }
        /// <summary>
        /// Make a prediction using the standard interface
        /// </summary>
        /// <param name="input">an instance of MarsHabitatPricerInput to predict from</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public MarsHabitatPricerOutput GetPrediction(MarsHabitatPricerInput 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 priceValue = prediction.GetFeatureValue("price").DoubleValue;

            return(new MarsHabitatPricerOutput(priceValue));
        }
        /// <summary>
        /// Make a prediction using the convenience interface
        /// </summary>
        /// <param name="solarPanels">Number of solar panels as double</param>
        /// <param name="greenhouses">Number of greenhouses as double</param>
        /// <param name="size">Size in acres as double</param>
        /// <param name="error">If an error occurs, upon return contains an NSError object that describes the problem.</param>
        public MarsHabitatPricerOutput GetPrediction(double solarPanels, double greenhouses, double size, out NSError error)
        {
            var input = new MarsHabitatPricerInput(solarPanels, greenhouses, size);

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