public abstract class FeatureViewBase<T extends FeatureViewBase,T3 extends FeatureStoreBase<T4>,T4 extends QueryBase,T5> extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
description |
protected Integer |
extraFilterVersion |
protected List<TrainingDatasetFeature> |
features |
protected T3 |
featureStore |
protected Integer |
id |
protected List<String> |
labels |
protected static org.slf4j.Logger |
LOGGER |
protected String |
name |
protected T4 |
query |
protected String |
type |
protected VectorServer |
vectorServer |
protected Integer |
version |
Constructor and Description |
---|
FeatureViewBase() |
Modifier and Type | Method and Description |
---|---|
void |
closeVectorServer()
Closes the ExecutorService and JDBC DataSource used
to retrieve feature vectors from the online feature store.
|
List<Object> |
getFeatureVector(Map<String,Object> entry)
Returns assembled feature vector from online feature store.
|
List<Object> |
getFeatureVector(Map<String,Object> entry,
boolean external)
Returns assembled feature vector from online feature store.
|
List<List<Object>> |
getFeatureVectors(Map<String,List<Object>> entry)
Returns assembled feature vectors in batches from online feature store.
|
List<List<Object>> |
getFeatureVectors(Map<String,List<Object>> entry,
boolean external)
Returns assembled feature vectors in batches from online feature store.
|
HashSet<String> |
getPrimaryKeys()
Set of primary key names that is used as keys in input dict object for `get_serving_vector` method.
|
void |
initBatchScoring(Integer trainingDatasetVersion)
Initialise feature view to retrieve feature vector from offline feature store.
|
void |
initServing()
Initialise feature view to retrieve feature vector from online feature store.
|
void |
initServing(Boolean batch,
Boolean external)
Initialise feature view to retrieve feature vector from online feature store.
|
protected void |
validateTrainTestSplit(Float testSize,
String trainEnd,
String testStart) |
protected void |
validateTrainValidationTestSplit(Float validationSize,
Float testSize,
String trainEnd,
String validationStart,
String validationEnd,
String testStart) |
protected T3 extends FeatureStoreBase<T4> featureStore
protected Integer id
protected String name
protected Integer version
protected String description
protected List<TrainingDatasetFeature> features
protected String type
protected static final org.slf4j.Logger LOGGER
protected VectorServer vectorServer
protected Integer extraFilterVersion
public void initServing() throws FeatureStoreException, IOException, SQLException, ClassNotFoundException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// Initialise feature view serving
fv.initServing();
FeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.SQLException
- In case there is online storage (RonDB) access error or other errors.ClassNotFoundException
- In case class `com.mysql.jdbc.Driver` can not be found.public void initServing(Boolean batch, Boolean external) throws FeatureStoreException, IOException, SQLException, ClassNotFoundException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// Initialise feature view batch serving
fv.initServing(true, false);
batch
- Whether to initialise feature view to retrieve feature vector from offline feature store.external
- If set to `true`, the connection to the online feature store is established using the same host as
for the `host` parameter in the connection object.
If set to False, the online feature store storage connector is used which relies on the private IP.FeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.SQLException
- In case there is online storage (RonDB) access error or other errors.ClassNotFoundException
- In case class `com.mysql.jdbc.Driver` can not be found.protected void validateTrainTestSplit(Float testSize, String trainEnd, String testStart) throws FeatureStoreException
FeatureStoreException
protected void validateTrainValidationTestSplit(Float validationSize, Float testSize, String trainEnd, String validationStart, String validationEnd, String testStart) throws FeatureStoreException
FeatureStoreException
public void initBatchScoring(Integer trainingDatasetVersion)
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// Initialise feature view batch scoring
fv.initBatchScoring(1);
trainingDatasetVersion
- Version of training dataset to identify additional filters attached to the training
dataset and statistics to use for transformation functions.public List<Object> getFeatureVector(Map<String,Object> entry) throws FeatureStoreException, IOException, ClassNotFoundException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// define primary key values to fetch data from online feature store
Map<String, Object> pkMap = new HashMap<String, Object>() {
{put("customer_id", 1);
put("contract_id" , 100);
}
};
// get feature vector
fv.getFeatureVector(entry);
entry
- Fictionary of feature group primary key and values provided by serving application.FeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.ClassNotFoundException
- In case class `com.mysql.jdbc.Driver` can not be found.public List<Object> getFeatureVector(Map<String,Object> entry, boolean external) throws FeatureStoreException, IOException, ClassNotFoundException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// define primary key values to fetch data from online feature store
Map<String, Object> pkMap = new HashMap<String, Object>() {
{put("customer_id", 1);
put("contract_id" , 100);
}
};
// get feature vector
fv.getFeatureVector(entry, false);
entry
- Dictionary of feature group primary key and values provided by serving application.external
- If set to true, the connection to the online feature store is established using the same host as
for the `host` parameter in the connection object.
If set to false, the online feature store storage connector is used which relies on the private IP.
Defaults to True if connection to Hopsworks is established from external environmentFeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.ClassNotFoundException
- In case class `com.mysql.jdbc.Driver` can not be found.public List<List<Object>> getFeatureVectors(Map<String,List<Object>> entry) throws SQLException, FeatureStoreException, IOException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// define primary key values to fetch data from online feature store
Map<String, List<Long>> entry = ...;
// get feature vector
fv.getFeatureVector(entry);
entry
- A list of dictionaries of feature group primary key and values provided by serving application.FeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.SQLException
- In case there is online storage (RonDB) access error or other errors.public List<List<Object>> getFeatureVectors(Map<String,List<Object>> entry, boolean external) throws SQLException, FeatureStoreException, IOException, ClassNotFoundException
// get feature store handle
FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
// get feature view handle
FeatureView fv = fs.getFeatureView("fv_name", 1);
// define primary key values to fetch data from online feature store
Map<String, List<Long>> entry = ...;
// get feature vector
fv.getFeatureVectors(entry, false);
entry
- A list of dictionaries of feature group primary key and values provided by serving application.external
- If set to `true`, the connection to the online feature store is established using the same host as
for the `host` parameter in the connection object.
If set to False, the online feature store storage connector is used which relies on the private IP.FeatureStoreException
- In case client is not connected to Hopsworks.IOException
- Generic IO exception.SQLException
- In case there is online storage (RonDB) access error or other errors.ClassNotFoundException
- In case class `com.mysql.jdbc.Driver` can not be found.public HashSet<String> getPrimaryKeys() throws SQLException, IOException, FeatureStoreException, ClassNotFoundException
SQLException
IOException
FeatureStoreException
ClassNotFoundException
public void closeVectorServer()
Copyright © 2025. All rights reserved.