Simulate embedding generation with Ray native processing.
(ds: ray.data.Dataset)
| 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( |
nothing calls this directly
no test coverage detected