def getEstimation(query): estimations = [] current_predicted_value = ml_prediction_client.predict( query["ptype"], float(query["bedr"]), float(query["bathr"]), query["geohash"], float(query["es"]), float(query["ms"]), float(query["hs"]), float(query["floor_size"]), 1000000, float(query["lot_size"]), ) new_predicted_value = ml_prediction_client.predict( query["ptype"], float(query["new_bedr"]), float(query["new_bathr"]), query["geohash"], float(query["new_es"]), float(query["new_ms"]), float(query["new_hs"]), float(query["new_floor_size"]), 1000000, float(query["new_lot_size"]), ) estimations.append(float(current_predicted_value)) estimations.append(float(new_predicted_value)) return json.loads(dumps(estimations))
def getDetailsByZpid(zpid, get_prediction=False): db = mongodb_client.getDB() prop = json.loads(dumps(db[PROPERTY_TABLE_NAME].find_one({'zpid': zpid}))) if prop == None: prop = zillow_web_scraper_client.get_property_by_zpid(zpid) # Get prediction if get_prediction: predicted_value = ml_prediction_client.predict( prop['zipcode'], prop['property_type'], prop['bedroom'], prop['bathroom'], prop['size'], prop['longitude'], prop['latitude']) prop['predicted_value'] = int(predicted_value) return prop
def getDetailsByZpid(zpid, get_prediction=False): db = mongodb_client.getDB() prop = json.loads(dumps(db[PROPERTY_TABLE_NAME].find_one({'zpid': zpid}))) if prop == None or prop['zestimate'] == None: prop = zillow_web_scraper_client.get_property_by_zpid(zpid) ##Get prediction if get_prediction: prop['lotsize'] = getLot(prop) predicted_value = ml_prediction_client.predict( prop['property_type'], prop['bedroom'], prop['bathroom'], prop['geohash'], prop['school_ratingE'], prop['school_ratingH'], prop['school_ratingM'], prop['size'], prop['zestimate'], prop['lotsize']) prop['predicted_value'] = int(predicted_value) return prop
def getDetailsByZpid(zpid, get_prediction=False): print "getDetailsByZpid() gets called with zpid=[%s]" % str(zpid) db = mongodb_client.getDB() property_detail = json.loads( dumps(db[PROPERTY_TABLE_NAME].find_one({'zpid': zpid}))) if property_detail is None: property_detail = zillow_web_scraper_client.get_property_by_zpid(zpid) # prediciton! if get_prediction: print "getting prediction" predicted_value = ml_prediction_client.predict( property_detail['zipcode'], property_detail['property_type'], property_detail['bedroom'], property_detail['bathroom'], property_detail['size']) property_detail['predicted_value'] = int(predicted_value) return property_detail
import ml_prediction_client as client print client.predict('94015', 'Single Family', 4, 2, 2000)
import ml_prediction_client as client print client.predict('Single Family', 3, 2, '9q8z7z', 10, 10, 10, 1696, 15, 6100)
import ml_prediction_client as client print client.predict('94015', 'Single Family', 4.0, 2.0, 1500)
import ml_prediction_client as client print client.predict('94109', 'Condo', 2, 1.5, 908, -122.419334, 37.787158)