(X, y, cat_features, text_features, embedding_features, pairs, graph, sample_weight, group_id, group_weight, subgroup_id, pairs_weight, baseline, column_description)
| 1520 | |
| 1521 | |
| 1522 | def _build_train_pool(X, y, cat_features, text_features, embedding_features, pairs, graph, sample_weight, group_id, group_weight, subgroup_id, pairs_weight, baseline, column_description): |
| 1523 | train_pool = None |
| 1524 | if isinstance(X, Pool): |
| 1525 | train_pool = X |
| 1526 | if any(v is not None for v in [cat_features, text_features, embedding_features, sample_weight, group_id, group_weight, subgroup_id, pairs_weight, baseline]): |
| 1527 | raise CatBoostError( |
| 1528 | "cat_features, text_features, embedding_features, sample_weight, group_id, group_weight, subgroup_id," |
| 1529 | " pairs_weight, baseline should have the None type when X has catboost.Pool type." |
| 1530 | ) |
| 1531 | if (not X.has_label()) and X.num_pairs() == 0: |
| 1532 | raise CatBoostError("Label in X has not been initialized.") |
| 1533 | if y is not None: |
| 1534 | raise CatBoostError("Incorrect value of y: X is catboost.Pool object, y must be initialized inside catboost.Pool.") |
| 1535 | elif isinstance(X, PATH_TYPES): |
| 1536 | train_pool = Pool(data=X, pairs=pairs, graph=graph, column_description=column_description) |
| 1537 | else: |
| 1538 | if y is None: |
| 1539 | raise CatBoostError("y has not initialized in fit(): X is not catboost.Pool object, y must be not None in fit().") |
| 1540 | train_pool = Pool(X, y, cat_features=cat_features, text_features=text_features, embedding_features=embedding_features, pairs=pairs, graph=graph, weight=sample_weight, group_id=group_id, |
| 1541 | group_weight=group_weight, subgroup_id=subgroup_id, pairs_weight=pairs_weight, baseline=baseline) |
| 1542 | return train_pool |
| 1543 | |
| 1544 | |
| 1545 | def _clear_training_files(train_dir): |
no test coverage detected