Index
Models.
¶
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
¶
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
¶
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 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
¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path |
Path to the directory.
TYPE:
|
Source code in srai/embedders/gtfs2vec/embedder.py
¶
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
¶
Bases: Model
Autoencoder based embedding model for gtfs2vec.
PARAMETER | DESCRIPTION |
---|---|
n_features |
Number of features.
TYPE:
|
n_hidden |
Number of hidden units. Defaults to 48.
TYPE:
|
n_embed |
Embedding size. Defaults to 64.
TYPE:
|
Source code in srai/embedders/gtfs2vec/model.py
¶
Get model config.
Source code in srai/embedders/_base.py
¶
Save the model to a directory.
PARAMETER | DESCRIPTION |
---|---|
path |
Path to the directory.
TYPE:
|
¶
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
¶
Forward pass.
PARAMETER | DESCRIPTION |
---|---|
x |
Input tensor.
TYPE:
|
¶
Training step.
PARAMETER | DESCRIPTION |
---|---|
batch |
Batch.
TYPE:
|
batch_idx |
Batch index.
TYPE:
|