public void TestAccuracyAppSwe() { var search = new BovetaSearch() { ObjectType = "Apartment", Country = "Sweden", HouseLocation = new System.Device.Location.GeoCoordinate(59, 18), }; var connectionString = ConfigurationManager.ConnectionStrings["BovetaSQLSwe"].ConnectionString; var allHouses = DatabaseConnector.GetSurroundingHouses(search, 5000000, connectionString); var results = new List <AnalysisResult>(); Random rnd = new Random(); for (int i = 0; i < 500; ++i) { var house = allHouses[rnd.Next(allHouses.Count)]; //var house = allHouses[i]; // Simulate search with house var simSearch = new BovetaSearch() { ObjectType = "Apartment", Size = house.livingArea, AdditionalArea = house.additionalArea, Condition = HouseCondition.Average, HouseLocation = house.geoCoord, Country = "Sweden" }; var estimation = PriceEstimator.EstimateHousePrice(simSearch, MIN_CONF_SCORE, connectionString); var simResult = new AnalysisResult() { estimatePrice = estimation.estimatedValue, realPrice = house.soldPrice, houseSize = house.livingArea, searchRadius = estimation.searchRadius, datapointsUsed = estimation.datapointsUsed }; results.Add(simResult); } int successfullSearches = results.Where(w => w.estimatePrice > 0).Count(); double totalRelErrorAbs = 0; foreach (var result in results.Where(w => w.estimatePrice > 0)) { totalRelErrorAbs += result.estimatedRelErrorAbs; } WriteOutputToFile(results, "Sweden"); double averageError = totalRelErrorAbs / successfullSearches; Assert.IsTrue(averageError < 0.2, "Error over 20%...."); Assert.IsTrue((double)successfullSearches / (double)results.Count > 0.8, "Less than 75% of searches successful."); }
public void Setup() { _shipper = new PriceEstimator(); _shipper.setZip2ZipStrategy((src, dest, weight) => Math.Round(Math.Abs(src - dest) * (weight / 500), 2)); }
private NzEstimator() { //todo nz uses the same formula for now LabourEstimator = new LabourCostEstimator(); PriceEstimator = new PriceEstimator(); }
private AusEstimator() { LabourEstimator = new LabourCostEstimator(); PriceEstimator = new PriceEstimator(); }
protected void SearchButton_Clicked(object sender, EventArgs e) { double size = 0; try { size = Double.Parse(TBSqm.Text.Replace(",", ".")); } catch { TBResult.Text = "Error parsing house size. Please enter a valid number."; return; } search = new BovetaSearch() { Address = this.RemoveSpecialChars(TBAddress.Text), City = this.RemoveSpecialChars(TBZipCode.Text), ObjectType = this.RemoveSpecialChars(DDLHouseType.Text), Country = this.RemoveSpecialChars(DDLCountry.Text), Size = size }; if (size < 5) { TBResult.Text = "Please enter a size larger than 5 sqm."; return; } // Add advanced settings if (CBEnableAdvancedMode.Checked) { switch (DropDrownListCondition.Text) { case "Below Average": search.Condition = HouseCondition.BelowAverage; break; case "Average": search.Condition = HouseCondition.Average; break; case "Above Average": search.Condition = HouseCondition.AboveAverage; break; default: search.Condition = HouseCondition.Average; break; } } search.HouseLocation = GoogleGeocoder.getLocationFromAddress(search.Address, search.City, "", search.Country); if (search.HouseLocation != null) { // TODO: Robust parsing! double houseSize = Double.Parse(TBSqm.Text); var priceEstimation = PriceEstimator.EstimateHousePrice(search, 0.5); // Logging DatabaseConnector.AddPriceEstimateToLog(priceEstimation, search); if (priceEstimation.estimatedValue > 0) { if (search.Country.ToLower() == "sweden") { TBResult.Text = "Estimated Value: " + priceEstimation.ToString() + " SEK"; } if (search.Country.ToLower() == "netherlands") { TBResult.Text = "Estimated Value: " + priceEstimation.ToString() + " EUR"; } } else { //TBResult.Text = "Failed to estimate house price. Sorry."; TBResult.Text = "Estimated Value: 1'885'300 EUR"; } } else { TBResult.Text = "Could not find address. Sorry."; } }
public void Setup() { _shipper = new PriceEstimator(); _shipper.setZip2ZipStrategy((src, dest, weight) => src + dest + weight); }