示例#1
0


if task == 'house_price':
    input_data = region_grid.load_housing_data(c['housing_data_file'])
    re_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, c['embedding_file'])
    autoencoder_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, c['autoencoder_embedding_file'])
    gcn_skipgram_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, gcn_sg_embed)
    gcn_flow_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, gcn_flow_embed)
    gcn_all_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, gcn_all_embed)
    gcn_ae_concat_mod = HousePriceModel(region_grid.idx_coor_map, c, n_epochs, c['autoencoder_embedding_file'],
                                     gcn_all_embed)


elif task == 'check_in':
    input_data = region_grid.get_checkin_counts(metric="mean")
    # init prediction models
    re_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, c['embedding_file'])
    gcn_all_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, gcn_all_embed)
    gcn_skipgram_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, gcn_sg_embed)
    gcn_flow_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, gcn_flow_embed)
    gcn_ae_concat_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, c['autoencoder_embedding_file'],
                                     gcn_all_embed)
    autoencoder_mod = CheckinModel(region_grid.idx_coor_map, c, n_epochs, c['autoencoder_embedding_file'])


else:
    raise NotImplementedError("User must input task: {'house_price', or 'check_in}'")


# get features
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from config import get_config
from grid.create_grid import RegionGrid
import numpy as np
import matplotlib.pyplot as plt
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
import geopandas as gpd

c = get_config()

region_grid = RegionGrid(config=c)

house_price = region_grid.load_housing_data(c['housing_data_file'])
print(house_price.head())
checkin = region_grid.get_checkin_counts(metric="mean")

trim = np.percentile(house_price['priceSqft'], 99)
print(trim)

house_price = house_price[house_price['priceSqft'] < trim]
house_price.to_csv(c['data_dir_main'] + 'zillow_house_price_trim.csv',
                   index=False)
checkin.to_csv(c['data_dir_main'] + "checkin.csv", index=False)
print(checkin.head())

#checkin.checkins.hist()
#plt.show()
#plt.clf()

#house_price['priceSqft'].hist(bins=50)