Skip to content

Commit b8931e0

Browse files
Alexandru OrmenisanAlexandru Ormenisan
Alexandru Ormenisan
authored and
Alexandru Ormenisan
committed
Model provenance - including init feature vector
1 parent 75d6f7e commit b8931e0

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/user_guides/fs/provenance/provenance.md

+93
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,47 @@ You can also traverse the provenance graph in the opposite direction. Starting f
211211
lineage.inaccessible
212212
```
213213

214+
You can also traverse the provenance graph downstream to retrieve the models which use training datasets of this feature view as its parents.
215+
=== "Python"
216+
217+
```python
218+
models = fraud_fv.get_models_provenance()
219+
220+
# List all accessible models
221+
lineage.accessible
222+
223+
# List all the inaccessible models
224+
lineage.inaccessible
225+
```
226+
227+
You can also retrieve only the models generated from specific training dataset versions:
228+
=== "Python"
229+
230+
```python
231+
models = fraud_fv.get_models_provenance(training_dataset_version: 1)
232+
```
233+
234+
You can also retrive directly the accessible model objects, without the need to extract them from the provenance links object:
235+
=== "Python"
236+
237+
```python
238+
#List all accessible models
239+
models = fraud_fv.get_models()
240+
241+
#List accessible models trained from a specific training dataset version
242+
models = fraud_fv.get_models(training_dataset_version: 1)
243+
```
244+
245+
Also we added a utility method to retrieve from the user's accessible models, the last trained one. Last is determined based on timestamp when it was saved into the model registry.
246+
=== "Python"
247+
248+
```python
249+
#Retrieve newest model from all user's accessible models based on this feature view
250+
model = fraud_fv.get_newest_model()
251+
#Retrieve newest model from all user's accessible models based on this training dataset version
252+
model = fraud_fv.get_newest_model(training_dataset_version: 1)
253+
```
254+
214255
### Using the UI
215256

216257
In the feature view overview UI you can explore the provenance graph of the feature view:
@@ -221,3 +262,55 @@ In the feature view overview UI you can explore the provenance graph of the feat
221262
<figcaption>Feature view provenance graph</figcaption>
222263
</figure>
223264
</p>
265+
266+
## Step 3: Model lineage
267+
268+
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.
307+
=== "Python"
308+
309+
```python
310+
model.get_feature_view(init: bool = True, online: Optional[bool]: None)
311+
```
312+
313+
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.

0 commit comments

Comments
 (0)