public void Univariate(decimal population, decimal profitFrom, decimal profitTo) { var algorithm = new LinearRegression(_cities, _profits, new Settings { ScaleAndNormalize = false, InputSplitRatio = InputSplitRatio.No }); var city = new City { Population = population }; var profit = algorithm.GetPrediction(city); Assert.That(profit, Is.InRange(profitFrom, profitTo), "Incorrect price prediction for [" + city + "]"); }
public void MultivariateScaled(decimal size, int bedroomCount, decimal priceFrom, decimal priceTo) { //var algorithm = new LinearRegression(_houses, _housePrices, new Settings { InputSplitRatio = InputSplitRatio.No, MaxIterations = 400}); //the above works - looks like IsConverging isn't working properly var algorithm = new LinearRegression(_houses, _housePrices, new Settings { InputSplitRatio = InputSplitRatio.No }); var house = new House { Size = size, BedroomCount = bedroomCount }; var price = algorithm.GetPrediction(house); Assert.That(price, Is.InRange(priceFrom, priceTo), "Incorrect price prediction for [" + house + "]"); }
public void PredictCarPrice() { //var algorithm = new LinearRegression(_cars, _carPrices, new Settings { InputSplitRatio = InputSplitRatio.No, MaxIterations = 425}); //the above works - looks like IsConverging isn't working properly var algorithm = new LinearRegression(_cars, _carPrices, new Settings { InputSplitRatio = InputSplitRatio.No }); var car = new Car { Model = "Mazda MPV", EngineSize = 12, MaxHorsePower = 12, IsManualShift = false }; var price = algorithm.GetPrediction(car); Assert.That(price, Is.InRange(15.9, 16.9), "Incorrect price prediction for [" + car + "]"); }