Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
        async void CreateInputs(int num)
        {
            SetupUI(true, "Generating sample data...");
            Random r = new Random();
            await Task.Run(() =>
            {
                for (int i = 0; i < num; i++)
                {
                    double solarPanels = r.NextDouble() * MaxSolarPanels;
                    double greenHouses = r.NextDouble() * MaxGreenHouses;
                    double acres       = r.NextDouble() * MaxAcres;
                    inputs[i]          = new MarsHabitatPricerInput(solarPanels, greenHouses, acres);
                }
            });

            SetupUI(false, "");
        }
Exemplo n.º 3
0
        /// <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));
        }