|
452 | 452 | "source": [ |
453 | 453 | "You can add any user, item or user-item-pair features to candidates. They can be added from dataset or from external sources and they also can be time-dependent (e.g. item popularity).\n", |
454 | 454 | "\n", |
455 | | - "To let the CandidateRankingModel join these features to train data for reranker, you need to create a custom feature collector. Inherit if from `CandidateFeatureCollector` which is used by default.\n", |
| 455 | + "To let the CandidateRankingModel join these features to train data for reranker, you need to create a custom feature collector. Inherit it from `CandidateFeatureCollector` which is used by default.\n", |
456 | 456 | "\n", |
457 | 457 | "You can overwrite the following methods:\n", |
458 | 458 | "- `_get_user_features`\n", |
459 | 459 | "- `_get_item_features`\n", |
460 | 460 | "- `_get_user_item_features`\n", |
461 | 461 | "\n", |
462 | 462 | "Each of the methods receives:\n", |
463 | | - "- `dataset` with all interactions that are available for model in this particular moment (no leak from the future). You can use it to collect user ot items stats on the current moment.\n", |
464 | | - "- `fold_info` with fold stats if you need to know that date that model considers as current date. You can join time-dependant features from external source that are valid on this particular date.\n", |
| 463 | + "- `dataset` with all interactions that are available for model in this particular moment (no leak from the future). You can use it to collect user or items stats on the current moment.\n", |
| 464 | + "- `fold_info` with fold stats if you need to know that date that model considers as current date. You can join time-dependent features from external source that are valid on this particular date.\n", |
465 | 465 | "\n", |
466 | 466 | "In the example below we will simply collect users age, sex and income features from external csv file:" |
467 | 467 | ] |
468 | 468 | }, |
469 | 469 | { |
470 | 470 | "cell_type": "code", |
471 | | - "execution_count": 12, |
| 471 | + "execution_count": null, |
472 | 472 | "metadata": {}, |
473 | 473 | "outputs": [], |
474 | 474 | "source": [ |
475 | | - "# Write custome feature collecting funcs for users, items and user/item pairs\n", |
| 475 | + "# Write custom feature collecting funcs for users, items and user/item pairs\n", |
476 | 476 | "class CustomFeatureCollector(CandidateFeatureCollector):\n", |
477 | 477 | " \n", |
478 | | - " def __init__(self, user_features_path: Path, user_cat_cols: tp.List[str])-> None: \n", |
| 478 | + " def __init__(self, user_features_path: Path, user_cat_cols: tp.List[str]) -> None: \n", |
479 | 479 | " self.user_features_path = user_features_path\n", |
480 | 480 | " self.user_cat_cols = user_cat_cols\n", |
481 | 481 | " \n", |
|
0 commit comments