MCPcopy
hub / github.com/feast-dev/feast / active_learning_candidates

Function active_learning_candidates

sdk/python/feast/ui_server.py:428–585  ·  view source on GitHub ↗

Find entities that exist in a reference feature view but have NOT been labeled yet.

(request: ActiveLearningRequest)

Source from the content-addressed store, hash-verified

426
427 @rest_app.post("/active-learning/candidates")
428 def active_learning_candidates(request: ActiveLearningRequest):
429 """Find entities that exist in a reference feature view but have NOT been labeled yet."""
430 try:
431 fv_name = request.feature_view
432 fv: Any = None
433 try:
434 fv = store.registry.get_label_view(fv_name, store.project)
435 except Exception:
436 pass
437
438 if fv is None:
439 return Response(
440 content=json.dumps({"detail": f"Label view '{fv_name}' not found"}),
441 status_code=status.HTTP_404_NOT_FOUND,
442 media_type="application/json",
443 )
444
445 ref_fv_name = request.reference_feature_view or (
446 getattr(fv, "reference_feature_view", None) or ""
447 )
448
449 if not ref_fv_name:
450 return Response(
451 content=json.dumps(
452 {
453 "detail": "No reference feature view specified. "
454 "Provide a feature view containing all entities."
455 }
456 ),
457 status_code=status.HTTP_400_BAD_REQUEST,
458 media_type="application/json",
459 )
460
461 ref_fv: Any = None
462 try:
463 ref_fv = store.get_feature_view(ref_fv_name)
464 except Exception:
465 pass
466
467 if ref_fv is None:
468 return Response(
469 content=json.dumps(
470 {"detail": f"Reference feature view '{ref_fv_name}' not found"}
471 ),
472 status_code=status.HTTP_404_NOT_FOUND,
473 media_type="application/json",
474 )
475
476 provider = store._get_provider()
477
478 # Get all entities from reference feature view
479 ref_batch_source = getattr(ref_fv, "batch_source", None)
480 if ref_batch_source is None:
481 return Response(
482 content=json.dumps(
483 {
484 "detail": f"No batch source for reference view '{ref_fv_name}'"
485 }

Callers

nothing calls this directly

Calls 7

_safe_error_responseFunction · 0.85
exceptionMethod · 0.80
get_label_viewMethod · 0.45
get_feature_viewMethod · 0.45
_get_providerMethod · 0.45
to_dfMethod · 0.45

Tested by

no test coverage detected