GeoVexEmbedder
srai.embedders.GeoVexEmbedder ¶
GeoVexEmbedder(
target_features: Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter],
count_subcategories: bool = True,
batch_size: Optional[int] = 32,
neighbourhood_radius: int = 4,
convolutional_layers: int = 2,
embedding_size: int = 32,
convolutional_layer_size: int = 256,
)
Bases: CountEmbedder
GeoVex Embedder.
PARAMETER | DESCRIPTION |
---|---|
target_features
|
The features
that are to be used in the embedding. Should be in "flat" format,
i.e. "
TYPE:
|
count_subcategories
|
Whether to count all subcategories individually or count features only on the highest level based on features column name. Defaults to False.
TYPE:
|
batch_size
|
Batch size. Defaults to 32.
TYPE:
|
convolutional_layers
|
Number of convolutional layers. Defaults to 2.
TYPE:
|
neighbourhood_radius
|
Radius of the neighbourhood. Defaults to 4.
TYPE:
|
embedding_size
|
Size of the embedding. Defaults to 32.
TYPE:
|
convolutional_layer_size
|
Size of the first convolutional layer.
TYPE:
|
Source code in srai/embedders/geovex/embedder.py
fit ¶
fit(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
neighbourhood: H3Neighbourhood,
learning_rate: float = 0.001,
trainer_kwargs: Optional[dict[str, Any]] = None,
) -> None
Fit the model to the data.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf
|
Region indexes and geometries.
TYPE:
|
features_gdf
|
Feature indexes, geometries and feature values.
TYPE:
|
joint_gdf
|
Joiner result with region-feature multi-index.
TYPE:
|
neighbourhood
|
The neighbourhood to use. Should be intialized with the same regions.
TYPE:
|
learning_rate
|
Learning rate. Defaults to 0.001.
TYPE:
|
trainer_kwargs
|
Trainer kwargs. This is where the number of epochs can be set. Defaults to None.
TYPE:
|
Source code in srai/embedders/geovex/embedder.py
fit_transform ¶
fit_transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
neighbourhood: H3Neighbourhood,
learning_rate: float = 0.001,
trainer_kwargs: Optional[dict[str, Any]] = None,
) -> pd.DataFrame
Fit the model to the data and create region embeddings.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf
|
Region indexes and geometries.
TYPE:
|
features_gdf
|
Feature indexes, geometries and feature values.
TYPE:
|
joint_gdf
|
Joiner result with region-feature multi-index.
TYPE:
|
neighbourhood
|
The neighbourhood to use. Should be intialized with the same regions.
TYPE:
|
negative_sample_k_distance
|
Distance of negative samples. Defaults to 2.
TYPE:
|
learning_rate
|
Learning rate. Defaults to 0.001.
TYPE:
|
trainer_kwargs
|
Trainer kwargs. This is where the number of epochs can be set. Defaults to None.
TYPE:
|
Source code in srai/embedders/geovex/embedder.py
load ¶
classmethod
Load the model from a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
model_module
|
Model class.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GeoVexEmbedder
|
GeoVexEmbedder object.
TYPE:
|
Source code in srai/embedders/geovex/embedder.py
save ¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
Source code in srai/embedders/geovex/embedder.py
transform ¶
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Create region embeddings.
PARAMETER | DESCRIPTION |
---|---|
regions_gdf
|
Region indexes and geometries.
TYPE:
|
features_gdf
|
Feature indexes, geometries and feature values.
TYPE:
|
joint_gdf
|
Joiner result with region-feature multi-index.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Region embeddings. |