def __init__(self, region_properties, regions_to_compare=None, data_dir=None, no_download=False): """ :param region_properties: A dict containing the properties of regions to use when doing the similarity computation. This is by default defined in region_properties.py, but can be adjusted. :param regions_to_compare: Default is None. This is a list of region IDs against which we want to do the similarity computation. If none specified, do this for all regions where we have _any_ data. """ self.client = BatchClient(API_HOST, ACCESS_TOKEN) self._logger = get_default_logger() if not regions_to_compare: regions_to_compare = self._regions_avail_for_selection( region_properties) self._logger.info("SimilarRegionState: loading...") self.state = SimilarRegionState(region_properties, regions_to_compare, self.client, data_dir=data_dir, no_download=no_download) self._logger.info("SimilarRegionState: done.") self._logger.info("BallTree: computing...") # Featues are weighted at this point, so this is equivalent to using # sklearn.neighbors.DistanceMetric.get_metric('wminkowski', **{'p':2,'w':self.state.weight_vector}) # but with unweighted features self.ball = BallTree(self.state.data_standardized, leaf_size=2) self._logger.info("BallTree: done.") return
def __init__(self, region_properties, regions_to_compare=None, data_dir=None): """ :param region_properties: A dict containing the properties of regions to use when doing the similarity computation. This is by default defined in region_properties.py, but can be adjusted. :param regions_to_compare: Default is None. This is a list of region IDs against which we want to do the similarity computation. If none specified, do this for all regions where we have _any_ data. """ self.client = BatchClient(API_HOST, ACCESS_TOKEN) self._logger = get_default_logger() if not regions_to_compare: regions_to_compare = self._regions_avail_for_selection( region_properties) self._logger.info("SimilarRegionState: loading...") self.state = SimilarRegionState(region_properties, regions_to_compare, self.client, data_dir=data_dir) self._logger.info("SimilarRegionState: done.") self._logger.info("BallTree: computing...") self.ball = BallTree(self.state.data_standardized, leaf_size=2) self._logger.info("BallTree: done.") return
def __init__(self, api_host, access_token): super(BatchClient, self).__init__(api_host, access_token) self._logger = lib.get_default_logger() self._http_client = AsyncHTTPClient()
def __init__(self, api_host, access_token): super(GroClient, self).__init__(api_host, access_token) self._logger = lib.get_default_logger() self._data_series_list = set() # all that have been added self._data_series_queue = [] # added but not loaded in data frame self._data_frame = pandas.DataFrame()