| 1751 | |
| 1752 | |
| 1753 | static void ProcessFloatFeature( |
| 1754 | TFloatFeatureIdx floatFeatureIdx, |
| 1755 | const TFloatValuesHolder& srcFeature, |
| 1756 | const TSubsetIndexingForBuildBorders& subsetIndexingForBuildBorders, |
| 1757 | const TQuantizationOptions& options, |
| 1758 | const TInitialBorders& initialBorders, |
| 1759 | bool calcQuantizationAndNanModeOnly, |
| 1760 | bool storeFeaturesDataAsExternalValuesHolder, |
| 1761 | |
| 1762 | // can be TNothing if generateBordersOnly |
| 1763 | const TMaybe<TIncrementalDenseIndexing>& incrementalDenseIndexing, |
| 1764 | const TFeaturesArraySubsetIndexing* dstSubsetIndexing, // can be nullptr if generateBordersOnly |
| 1765 | NPar::ILocalExecutor* localExecutor, |
| 1766 | TQuantizedFeaturesInfoPtr quantizedFeaturesInfo, |
| 1767 | THolder<IQuantizedFloatValuesHolder>* dstQuantizedFeature // can be nullptr if generateBordersOnly |
| 1768 | ) { |
| 1769 | bool calculateNanMode = true; |
| 1770 | ENanMode nanMode = ENanMode::Forbidden; |
| 1771 | |
| 1772 | bool calculateQuantization = true; |
| 1773 | const NSplitSelection::TQuantization* quantization = nullptr; |
| 1774 | NSplitSelection::TQuantization calculatedQuantization; |
| 1775 | |
| 1776 | { |
| 1777 | TReadGuard readGuard(quantizedFeaturesInfo->GetRWMutex()); |
| 1778 | if (quantizedFeaturesInfo->HasNanMode(floatFeatureIdx)) { |
| 1779 | calculateNanMode = false; |
| 1780 | nanMode = quantizedFeaturesInfo->GetNanMode(floatFeatureIdx); |
| 1781 | } |
| 1782 | if (quantizedFeaturesInfo->HasQuantization(floatFeatureIdx)) { |
| 1783 | calculateQuantization = false; |
| 1784 | quantization = &(quantizedFeaturesInfo->GetQuantization(floatFeatureIdx)); |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | CB_ENSURE_INTERNAL( |
| 1789 | calculateNanMode == calculateQuantization, |
| 1790 | "Feature #" << srcFeature.GetId() |
| 1791 | << ": NanMode and quantization must be specified or not specified together" |
| 1792 | ); |
| 1793 | |
| 1794 | if (calculateNanMode || calculateQuantization) { |
| 1795 | TMaybe<TVector<float>> initialBordersForFeature = Nothing(); |
| 1796 | if (initialBorders) { |
| 1797 | if (floatFeatureIdx.Idx < initialBorders->size()) { |
| 1798 | initialBordersForFeature.ConstructInPlace(TVector<float>((*initialBorders)[floatFeatureIdx.Idx].begin(), (*initialBorders)[floatFeatureIdx.Idx].end())); |
| 1799 | } |
| 1800 | } |
| 1801 | CalcQuantizationAndNanMode( |
| 1802 | srcFeature, |
| 1803 | subsetIndexingForBuildBorders, |
| 1804 | *quantizedFeaturesInfo, |
| 1805 | initialBordersForFeature, |
| 1806 | options.DefaultValueFractionToEnableSparseStorage, |
| 1807 | &nanMode, |
| 1808 | &calculatedQuantization |
| 1809 | ); |
| 1810 |
no test coverage detected