Index
embedders ¶
This module contains embedders, used to convert spatial data to their vector representations.
Embedders are designed to unify different types of spatial data embedding methods, such as hex2vec or gtfs2vec into a single interface. This allows to easily switch between different embedding methods without changing the rest of the code.
ContextualCountEmbedder ¶
ContextualCountEmbedder(
neighbourhood: Neighbourhood[IndexType],
neighbourhood_distance: int,
concatenate_vectors: bool = False,
expected_output_features: Optional[
Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]
] = None,
count_subcategories: bool = False,
aggregation_function: Literal[
"average", "median", "sum", "min", "max"
] = "average",
num_of_multiprocessing_workers: int = -1,
multiprocessing_activation_threshold: Optional[int] = None,
)
Bases: CountEmbedder
ContextualCountEmbedder.
PARAMETER | DESCRIPTION |
---|---|
neighbourhood
|
Neighbourhood object used to get neighbours for the contextualization.
TYPE:
|
neighbourhood_distance
|
How many neighbours levels should be included in the embedding.
TYPE:
|
concatenate_vectors
|
Whether to sum all neighbours into a single vector
with the same width as
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:
|
aggregation_function
|
Function used to aggregate data from the neighbours. Defaults to average.
TYPE:
|
num_of_multiprocessing_workers
|
Number of workers used for
multiprocessing. Defaults to -1 which results in a total number of available
cpu threads.
TYPE:
|
multiprocessing_activation_threshold
|
Number of seeds required to start processing on multiple processes. Activating multiprocessing for a small amount of points might not be feasible. Defaults to 100.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
Source code in srai/embedders/contextual_count_embedder.py
transform ¶
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Embed a given GeoDataFrame.
Creates region embeddings by counting the frequencies of each feature value and applying a contextualization based on neighbours of regions. For each region, features will be altered based on the neighbours either by adding aggregated values dimished based on distance, or by adding new separate columns with neighbour distance postfix. Expects features_gdf to be in wide format with each column being a separate type of feature (e.g. amenity, leisure) and rows to hold values of these features for each object. The rows will hold numbers of this type of feature in each region. Numbers can be fractional because neighbourhoods are aggregated to represent a single value from all neighbours on a given level.
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: Embedding for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If features_gdf is empty and self.expected_output_features is not set. |
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/contextual_count_embedder.py
CountEmbedder ¶
CountEmbedder(
expected_output_features: Optional[
Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]
] = None,
count_subcategories: bool = True,
)
Bases: Embedder
Simple Embedder that counts occurences of feature values.
PARAMETER | DESCRIPTION |
---|---|
count_subcategories
|
Whether to count all subcategories individually or count features only on the highest level based on features column name. Defaults to True.
TYPE:
|
Source code in srai/embedders/count_embedder.py
transform ¶
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Embed a given GeoDataFrame.
Creates region embeddings by counting the frequencies of each feature value. Expects features_gdf to be in wide format with each column being a separate type of feature (e.g. amenity, leisure) and rows to hold values of these features for each object. The resulting DataFrame will have columns made by combining the feature name (column) and value (row) e.g. amenity_fuel or type_0. The rows will hold numbers of this type of feature in each region.
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: Embedding for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If features_gdf is empty and self.expected_output_features is not set. |
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
ValueError
|
If features_gdf contains boolean columns and count_subcategories is True. |
Source code in srai/embedders/count_embedder.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
Embedder ¶
Bases: ABC
Abstract class for embedders.
transform ¶
abstractmethod
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Embed regions using features.
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: Embedding and geometry index for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/_base.py
GTFS2VecEmbedder ¶
GTFS2VecEmbedder(
hidden_size: int = 48,
embedding_size: int = 64,
skip_autoencoder: bool = False,
)
Bases: Embedder
GTFS2Vec Embedder.
PARAMETER | DESCRIPTION |
---|---|
hidden_size
|
Hidden size in encoder and decoder. Defaults to 48.
TYPE:
|
embedding_size
|
Embedding size. Defaults to 64.
TYPE:
|
skip_autoencoder
|
Skip using autoencoder as part of embedding.
TYPE:
|
Source code in srai/embedders/gtfs2vec/embedder.py
fit ¶
fit(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> None
Fit model to a given 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:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/gtfs2vec/embedder.py
fit_transform ¶
fit_transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Fit model and transform a given 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:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Embedding and geometry index for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/gtfs2vec/embedder.py
load ¶
classmethod
Load the model from a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Hex2VecEmbedder
|
The loaded embedder.
TYPE:
|
Source code in srai/embedders/gtfs2vec/embedder.py
save ¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
Source code in srai/embedders/gtfs2vec/embedder.py
transform ¶
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Embed a given 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:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Embedding and geometry index for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
ValueError
|
If number of features is incosistent with the model. |
ModelNotFitException
|
If model is not fit. |
Source code in srai/embedders/gtfs2vec/embedder.py
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. |
Source code in srai/embedders/geovex/embedder.py
Hex2VecEmbedder ¶
Hex2VecEmbedder(
encoder_sizes: Optional[list[int]] = None,
expected_output_features: Optional[
Union[list[str], OsmTagsFilter, GroupedOsmTagsFilter]
] = None,
count_subcategories: bool = True,
)
Bases: CountEmbedder
Hex2Vec Embedder.
PARAMETER | DESCRIPTION |
---|---|
encoder_sizes
|
Sizes of the encoder layers. The input layer size shouldn't be included - it's inferred from the data. The last element is the embedding size. Defaults to [150, 75, 50].
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:
|
Source code in srai/embedders/hex2vec/embedder.py
fit ¶
fit(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
neighbourhood: Neighbourhood[T],
negative_sample_k_distance: int = 2,
batch_size: int = 32,
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:
|
negative_sample_k_distance
|
When sampling negative samples, sample from a distance > k. Defaults to 2.
TYPE:
|
batch_size
|
Batch size. Defaults to 32.
TYPE:
|
learning_rate
|
Learning rate. Defaults to 0.001.
TYPE:
|
trainer_kwargs
|
Trainer kwargs. Defaults to None.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If features_gdf is empty and self.expected_output_features is not set. |
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
ValueError
|
If negative_sample_k_distance < 2. |
Source code in srai/embedders/hex2vec/embedder.py
fit_transform ¶
fit_transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
neighbourhood: Neighbourhood[T],
negative_sample_k_distance: int = 2,
batch_size: int = 32,
learning_rate: float = 0.001,
trainer_kwargs: Optional[dict[str, Any]] = None,
) -> pd.DataFrame
Fit the model to the data and return the 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
|
When sampling negative samples, sample from a distance > k. Defaults to 2.
TYPE:
|
batch_size
|
Batch size. Defaults to 32.
TYPE:
|
learning_rate
|
Learning rate. Defaults to 0.001.
TYPE:
|
trainer_kwargs
|
Trainer kwargs. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Region embeddings. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If features_gdf is empty and self.expected_output_features is not set. |
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
ValueError
|
If negative_sample_k_distance < 2. |
Source code in srai/embedders/hex2vec/embedder.py
load ¶
classmethod
Load the model from a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Hex2VecEmbedder
|
The loaded embedder.
TYPE:
|
Source code in srai/embedders/hex2vec/embedder.py
save ¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
Source code in srai/embedders/hex2vec/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: Embedding and geometry index for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If features_gdf is empty and self.expected_output_features is not set. |
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/hex2vec/embedder.py
Highway2VecEmbedder ¶
Bases: Embedder
Highway2Vec Embedder.
PARAMETER | DESCRIPTION |
---|---|
hidden_size
|
Hidden size in encoder and decoder. Defaults to 64.
TYPE:
|
embedding_size
|
Embedding size. Defaults to 30.
TYPE:
|
Source code in srai/embedders/highway2vec/embedder.py
fit ¶
fit(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
trainer_kwargs: Optional[dict[str, Any]] = None,
dataloader_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:
|
trainer_kwargs
|
Trainer kwargs. Defaults to None.
TYPE:
|
dataloader_kwargs
|
Dataloader kwargs. Defaults to None.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/highway2vec/embedder.py
fit_transform ¶
fit_transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
trainer_kwargs: Optional[dict[str, Any]] = None,
dataloader_kwargs: Optional[dict[str, Any]] = None,
) -> pd.DataFrame
Fit the model to the data and return the 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:
|
trainer_kwargs
|
Trainer kwargs. Defaults to None.
TYPE:
|
dataloader_kwargs
|
Dataloader kwargs. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Region embeddings. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/highway2vec/embedder.py
load ¶
classmethod
Load the model from a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Hex2VecEmbedder
|
The loaded embedder.
TYPE:
|
Source code in srai/embedders/highway2vec/embedder.py
save ¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|
Source code in srai/embedders/highway2vec/embedder.py
transform ¶
transform(
regions_gdf: gpd.GeoDataFrame,
features_gdf: gpd.GeoDataFrame,
joint_gdf: gpd.GeoDataFrame,
) -> pd.DataFrame
Embed regions using features.
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: Embedding and geometry index for each region in regions_gdf. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If any of the gdfs index names is None. |
ValueError
|
If joint_gdf.index is not of type pd.MultiIndex or doesn't have 2 levels. |
ValueError
|
If index levels in gdfs don't overlap correctly. |
Source code in srai/embedders/highway2vec/embedder.py
Model ¶
Bases: LightningModule
Class for model based on LightningModule.
get_config ¶
Get model config.
Source code in srai/embedders/_base.py
load ¶
classmethod
Load model from a file.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the file.
TYPE:
|
**kwargs
|
Additional kwargs to pass to the model constructor.
TYPE:
|
Source code in srai/embedders/_base.py
save ¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path
|
Path to the directory.
TYPE:
|