| 504 | } |
| 505 | |
| 506 | static TVector<TVector<double>> GetTransformedTarget( |
| 507 | const TVector<TVector<double>>& approx, |
| 508 | const TVector<TVector<double>>& targetData, |
| 509 | const IMetric& metric |
| 510 | ) { |
| 511 | CB_ENSURE_INTERNAL( |
| 512 | approx[0].size() == targetData[0].size(), |
| 513 | "Approx and target must have same sizes" |
| 514 | ); |
| 515 | TVector<TVector<double>> transformedTarget(approx.size(), TVector<double>(approx[0].size(), 0.0)); |
| 516 | const bool isMultiTarget = (targetData.size() > 1); |
| 517 | for (auto dimension : xrange(approx.size())) { |
| 518 | TConstArrayRef<double> targetDataRef = isMultiTarget ? MakeConstArrayRef(targetData[dimension]) : MakeConstArrayRef(targetData[0]); |
| 519 | TConstArrayRef<double> approxRef = MakeConstArrayRef(approx[dimension]); |
| 520 | TArrayRef<double> transformedTargetRef = MakeArrayRef(transformedTarget[dimension]); |
| 521 | |
| 522 | for (auto documentIdx : xrange(approxRef.size())) { |
| 523 | transformedTargetRef[documentIdx] = TransformDocument( |
| 524 | metric, |
| 525 | targetDataRef[documentIdx], |
| 526 | approxRef[documentIdx] |
| 527 | ); |
| 528 | } |
| 529 | } |
| 530 | return transformedTarget; |
| 531 | } |
| 532 | |
| 533 | void TIndependentTreeShapParams::InitTransformedData( |
| 534 | const TFullModel& model, |
no test coverage detected