示例#1
0
def main():
    home = generate_datum()
    data = []
    for i in range(0, 10000):
        data.append(generate_datum())
    n = 10
    similarList = find_similar(home, data, n)
    print similarList
def main():
	home = generate_datum()
	data = []
	for i in range (0,10000):
		data.append(generate_datum())
	n = 10
	similarList = find_similar(home,data,n)
	print similarList
示例#3
0
def load_listings():
    """
    gets random listings and inserts into database
    """
    for i in range (0, DATA_SAMPLE_SIZE):
	    l = generate_datum()
	    listing = l._asdict()
	    cur = get_mysql_connection().cursor()
	    listing['zip'] = get_nearest_zips_for_lat_lon(listing.get('lat'), listing.get('lon'))[0].get('postalCode')
	    cur.execute("""insert into listing (num_bedrooms, num_bathrooms, living_area, lat, lon, 
	    	exterior_stories, pool, dwelling_type,	list_date, list_price, close_date, close_price, zip) 
	    values (%(num_bedrooms)s, %(num_bathrooms)s, %(living_area)s, %(lat)s, %(lon)s, %(exterior_stories)s, 
	    	'%(pool)s', '%(dwelling_type)s', '%(list_date)s', %(list_price)s, '%(close_date)s', %(close_price)s, '%(zip)s' )""" % listing)
示例#4
0
def main():
    ps = ProximitySearch()
    home = generate_datum()
    n = 10
    print 'Input:\n'
    print home, '\n'

    result = ps.n_most_similar_homes(home, n)
    print 'The ' + str(n) + ' most similar homes:\n'
    for h in result:
        print h

    save_csv(home, result)
示例#5
0
 def generate_homes(self):
     return [generate_datum() for x in xrange(self.data_size)]