MCPcopy Create free account
hub / github.com/feast-dev/feast / ray_embedding_udf

Function ray_embedding_udf

sdk/python/tests/component/ray/test_compute.py:276–288  ·  view source on GitHub ↗

Simulate embedding generation with Ray native processing.

(ds: ray.data.Dataset)

Source from the content-addressed store, hash-verified

274 registry = fs.registry
275
276 def ray_embedding_udf(ds: ray.data.Dataset) -> ray.data.Dataset:
277 """Simulate embedding generation with Ray native processing."""
278
279 def generate_embeddings(batch: pd.DataFrame) -> pd.DataFrame:
280 # Simulate embedding generation
281 if "conv_rate" in batch.columns:
282 # Create a simple embedding based on conv_rate
283 batch["embedding"] = batch["conv_rate"].apply(
284 lambda x: [x * 0.1, x * 0.2, x * 0.3]
285 )
286 return batch
287
288 return ds.map_batches(generate_embeddings, batch_format="pandas", concurrency=2)
289
290 # Create Ray transformation for embeddings
291 ray_embedding_transform = RayTransformation(

Callers

nothing calls this directly

Calls 1

map_batchesMethod · 0.80

Tested by

no test coverage detected