You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/user_guides/fs/provenance/provenance.md
+28-62
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,28 @@
1
-
# Provenance
1
+
# Provenance
2
2
3
-
## Introduction
3
+
## Introduction
4
4
5
-
Hopsworks feature store allows users to track provenance (lineage) between storage connectors, feature groups, feature views, training datasets and models. Tracking lineage allows users to determine where/if a feature group is being used. You can track if feature groups are being used to create additional (derived) feature groups or feature views.
5
+
Hopsworks allows users to track provenance (lineage) between:
6
6
7
-
You can interact with the provenance graph using the UI and the APIs.
7
+
- storage connectors
8
+
- feature groups
9
+
- feature views
10
+
- training datasets
11
+
- models
12
+
13
+
In the provenance pages we will call a provenance artifact or shortly artifact, any of the five entities above.
14
+
15
+
When following the provenance graph:
16
+
17
+
```
18
+
storage connector -> feature group -> feature group -> feature view -> training dataset -> model
19
+
```
20
+
21
+
we will call the parent, the artifact to the left, and the child, the artifact to the right. So a feature view has a number of feature groups as parents and can have a number of training datasets as children.
22
+
23
+
Tracking provenance allows users to determine where and if an artifact is being used. You can track, for example, if feature groups are being used to create additional (derived) feature groups or feature views, or if their data is eventually used to train models.
24
+
25
+
You can interact with the provenance graph using the UI or the APIs.
8
26
9
27
## Step 1: Storage connector lineage
10
28
@@ -87,7 +105,7 @@ When creating a feature group, it is possible to specify a list of feature group
@@ -103,7 +121,7 @@ When creating a feature group, it is possible to specify a list of feature group
103
121
transaction_fg.insert(transaction_df)
104
122
```
105
123
106
-
Another example use case for derived feature group is if you have a feature group containing features with daily resolution and you are using the content of that feature group to populate a second feature group with monthly resolution:
124
+
Another example use case for derived feature group is if you have a feature group containing features with daily resolution and you are using the content of that feature group to populate a second feature group with monthly resolution:
107
125
108
126
=== "Python"
109
127
@@ -112,7 +130,7 @@ Another example use case for derived feature group is if you have a feature grou
The relationship between feature views and models is captured automatically when you create a model. You can inspect the relationship between feature views and models using the APIs or the UI.
269
-
=== "Python"
270
-
271
-
```python
272
-
lineage = model.get_feature_view_provenance()
273
-
274
-
# List all accessible parent feature views
275
-
lineage.accessible
276
-
277
-
# List all deleted parent feature views
278
-
lineage.deleted
279
-
280
-
# List all the inaccessible parent feature views
281
-
lineage.inaccessible
282
-
```
283
-
284
-
You can also retrieve the training dataset provenance object.
285
-
=== "Python"
286
-
287
-
```python
288
-
lineage = model.get_training_dataset_provenance()
289
-
290
-
# List all accessible parent training datasets
291
-
lineage.accessible
292
-
293
-
# List all deleted parent training datasets
294
-
lineage.deleted
295
-
296
-
# List all the inaccessible parent training datasets
297
-
lineage.inaccessible
298
-
```
299
-
300
-
You can also retrieve directly the parent feature view object, without the need to extract them from the provenance links object
301
-
=== "Python"
302
-
303
-
```python
304
-
feature_view = model.get_feature_view()
305
-
```
306
-
This utility method also has the options to initialize the required components for batch or online retrieval of feature vectors.
By default, the base init for feature vector retrieval is enabled. In case you have a workflow that requires more particular options, you can disable this base init by setting the `init` to `false`.
314
-
The method detects if it is running within a deployment and will initialize the feature vector retrieval for the serving.
315
-
If the `online` argument is provided and `true` it will initialize for online feature vector retrieval.
316
-
If the `online` argument is provided and `false` it will initialize the feature vector retrieval for batch scoring.
Hopsworks allows users to track provenance (lineage) between:
6
+
7
+
- storage connectors
8
+
- feature groups
9
+
- feature views
10
+
- training datasets
11
+
- models
12
+
13
+
In the provenance pages we will call a provenance artifact or shortly artifact, any of the five entities above.
14
+
15
+
When following the provenance graph:
16
+
17
+
```
18
+
storage connector -> feature group -> feature group -> feature view -> training dataset -> model
19
+
```
20
+
21
+
we will call the parent, the artifact to the left, and the child, the artifact to the right. So a feature view has a number of feature groups as parents and can have a number of training datasets as children.
22
+
23
+
Tracking provenance allows users to determine where and if an artifact is being used. You can track, for example, if feature groups are being used to create additional (derived) feature groups or feature views, or if their data is eventually used to train models.
24
+
25
+
You can interact with the provenance graph using the UI or the APIs.
26
+
27
+
## Model provenance
28
+
29
+
The relationship between feature views and models is captured in the model constructor. If you do not provide at least the feature view object to the constructor, the provenance will not capture this relation and you will not be able to navigate from model to the feature view it used or from the feature view to this model.
30
+
31
+
You can provide the feature view object and have the training dataset version be inferred.
32
+
33
+
=== "Python"
34
+
35
+
```python
36
+
# this fv object will be provided to the model constructor
37
+
fv = hsfs.get_feature_view(...)
38
+
39
+
# when calling trainig data related methods on the feature view, the training dataset version is cached in the feature view and is implicitly provided to the model constructor
Once the relation is stored in the provenance graph, you can navigate the graph from model to feature view or training dataset and the other way around.
68
+
69
+
From the model page, in the UI, you can view the provenance graph:
<figcaption>Provenance graph of derived feature groups</figcaption>
75
+
</figure>
76
+
</p>
77
+
78
+
Users can call the `get_feature_view_provenance` or the `get_training_dataset_provenance` methods which will each return a [Link](#provenance-links) object.
79
+
80
+
You can also retrieve directly the parent feature view object, without the need to extract them from the provenance links object
81
+
82
+
=== "Python"
83
+
84
+
```python
85
+
feature_view = model.get_feature_view()
86
+
```
87
+
88
+
This utility method also has the options to initialize the required components for batch or online retrieval of feature vectors.
By default, the base init for feature vector retrieval is enabled. In case you have a workflow that requires more particular options, you can disable this base init by setting the `init` to `false`.
97
+
The method detects if it is running within a deployment and will initialize the feature vector retrieval for the serving.
98
+
If the `online` argument is provided and `true` it will initialize for online feature vector retrieval.
99
+
If the `online` argument is provided and `false` it will initialize the feature vector retrieval for batch scoring.
100
+
101
+
## Provenance Links
102
+
103
+
All the `_provenance` methods return a `Link` dictionary object that contains `accessible`, `inaccesible`, `deleted` lists.
104
+
105
+
-`accessible` - contains any artifact from the result, that the user has access to.
106
+
-`inaccessible` - contains any artifacts that might have been shared at some point in the past, but where this sharing was retracted. Since the relation between artifacts is still maintained in the provenance, the user will only have access to limited metadata and the artifacts will be included in this `inaccessible` list.
107
+
-`deleted` - contains artifacts that are deleted with children stil present in the system. There is minimum amount of metadata for the deleted allowing for some limited human readable identification.
0 commit comments