DiseasystoreBase {diseasystore} | R Documentation |
diseasystore base handler
Description
This DiseasystoreBase
R6 class forms the basis of all feature stores.
It defines the primary methods of each feature stores as well as all of the public methods.
Value
A new instance of the DiseasystoreBase
R6 class.
Active bindings
ds_map
(
named list
(character
))
A list that maps features known by the feature store to the corresponding feature handlers that compute the features. Read only.available_features
(
character
)
A list of available features in the feature store. Read only.label
(
character
)
A human readable label of the feature store. Read only.source_conn
(
DBIConnection
orfile path
)
Used to specify where data is located. Read only. Can beDBIConnection
or file path depending on thediseasystore
.target_conn
(
DBIConnection
)
A database connection to store the computed features in. Read only.target_schema
(
character
)
The schema to place the feature store in. Read only. If the database backend does not support schema, the tables will be prefixed with <target_schema>.start_date
(
Date
)
Study period start. Read only.end_date
(
Date
)
Study period end. Read only.slice_ts
(
Date
orcharacter
)
Date or timestamp (parsable byas.POSIXct
) to slice the database on (used if source_conn is a database). Read only.
Methods
Public methods
Method new()
Creates a new instance of the DiseasystoreBase
R6 class.
Usage
DiseasystoreBase$new( start_date = NULL, end_date = NULL, slice_ts = NULL, source_conn = NULL, target_conn = NULL, target_schema = NULL, verbose = diseasyoption("verbose", self) )
Arguments
start_date
(
Date
)
Study period start.end_date
(
Date
)
Study period end.slice_ts
(
Date
orcharacter
)
Date or timestamp (parsable byas.POSIXct
) to slice the database on (used if source_conn is a database).source_conn
(
DBIConnection
orfile path
)
Used to specify where data is located. Can beDBIConnection
or file path depending on thediseasystore
.target_conn
(
DBIConnection
)
A database connection to store the computed features in.target_schema
(
character
)
The schema to place the feature store in. If the database backend does not support schema, the tables will be prefixed with <target_schema>.verbose
(
boolean
)
Boolean that controls enables debugging information.
Returns
A new instance of the DiseasystoreBase
R6 class.
Method finalize()
Closes the open DB connection when removing the object
Usage
DiseasystoreBase$finalize()
Method get_feature()
Computes, stores, and returns the requested feature for the study period.
Usage
DiseasystoreBase$get_feature( feature, start_date = self %.% start_date, end_date = self %.% end_date, slice_ts = self %.% slice_ts )
Arguments
feature
(
character
)
The name of a feature defined in the feature store.start_date
(
Date
)
Study period start.end_date
(
Date
)
Study period end.slice_ts
(
Date
orcharacter
)
Date or timestamp (parsable byas.POSIXct
) to slice the database on (used if source_conn is a database).
Returns
A tbl_dbi with the requested feature for the study period.
Method key_join_features()
Joins various features from feature store assuming a primary feature (observable)
that contains keys to witch the secondary features (defined by stratification
) can be joined.
Usage
DiseasystoreBase$key_join_features( observable, stratification, start_date = self %.% start_date, end_date = self %.% end_date )
Arguments
observable
(
character
)
The name of a feature defined in the feature storestratification
(
list
(quosures
))
Expressions instratification
are evaluated to find appropriate features. These are then joined to the observable feature beforestratification
is performed.start_date
(
Date
)
Study period start.end_date
(
Date
)
Study period end.
Returns
A tbl_dbi with the requested joined features for the study period.
Method clone()
The objects of this class are cloneable with this method.
Usage
DiseasystoreBase$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
# DiseasystoreBase is mostly used as the basis of other, more specific, classes
# The DiseasystoreBase can be initialised individually if needed.
ds <- DiseasystoreBase$new(source_conn = NULL,
target_conn = DBI::dbConnect(RSQLite::SQLite()))
rm(ds)