当前位置: 首页>>代码示例>>C++>>正文


C++ TVector::clear方法代码示例

本文整理汇总了C++中TVector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector::clear方法的具体用法?C++ TVector::clear怎么用?C++ TVector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TVector的用法示例。


在下文中一共展示了TVector::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CalcShapValuesForDocumentBlock

static TVector<TVector<double>> CalcShapValuesForDocumentBlock(const TFullModel& model,
                                                               const TPool& pool,
                                                               size_t start,
                                                               size_t end,
                                                               NPar::TLocalExecutor& localExecutor,
                                                               int dimension) {
    CB_ENSURE(!HasComplexCtrs(model.ObliviousTrees), "Model uses complex Ctr features. This is not allowed for SHAP values calculation");

    const TObliviousTrees& forest = model.ObliviousTrees;
    const size_t documentCount = end - start;

    TVector<ui8> allBinarizedFeatures = BinarizeFeatures(model, pool, start, end);
    TVector<TVector<ui8>> binarizedFeaturesByDocument = TransposeBinarizedFeatures(allBinarizedFeatures, documentCount);
    allBinarizedFeatures.clear();

    const int flatFeatureCount = pool.Docs.GetFactorsCount();
    TVector<int> binFeaturesMapping = MapFeatures(forest);
    TVector<TVector<double>> shapValues(documentCount, TVector<double>(flatFeatureCount + 1, 0.0));

    NPar::TLocalExecutor::TExecRangeParams blockParams(0, documentCount);
    localExecutor.ExecRange([&] (int documentIdx) {
        const size_t treeCount = forest.GetTreeCount();
        for (size_t treeIdx = 0; treeIdx < treeCount; ++treeIdx) {
            TVector<TVector<size_t>> subtreeSizes = CalcSubtreeSizesForTree(forest, treeIdx);
            TVector<TFeaturePathElement> initialFeaturePath;
            CalcShapValuesRecursive(forest, binFeaturesMapping, binarizedFeaturesByDocument[documentIdx], treeIdx, /*depth*/ 0, subtreeSizes, dimension,
                                    /*nodeIdx*/ 0, initialFeaturePath, /*zeroPathFraction*/ 1, /*onePathFraction*/ 1, /*feature*/ -1,
                                    &shapValues[documentIdx]);

            shapValues[documentIdx][flatFeatureCount] += CalcMeanValueForTree(forest, subtreeSizes, treeIdx, dimension);
        }
    }, blockParams, NPar::TLocalExecutor::WAIT_COMPLETE);

    return shapValues;
}
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:35,代码来源:shap_values.cpp

示例2: TestDriveUnlimited

void TestDriveUnlimited(){
	{
		TVector<A> uber;
		A a;
		A b(a);
		uber.resize(18);
		uber.push_back(a);
		uber.reserve(32);
		uber.resize(4);
		uber.push_back(b);
		uber.pop_back();
		uber.clear();
	}
	cout << ((A::creat==0)?"All fine":"Red alert") << endl;
	system("pause");
}
开发者ID:divyang4481,项目名称:mipt-hw,代码行数:16,代码来源:Vector.cpp

示例3: main

int main()
{
    TVector<int> A;
	A.PrintStat();
	for (int i = 0; i < 35; ++i)
		A.push_back(i);
	A.PrintStat();
	for (int i = 0; i < 5; ++i)
		cout << " Pop: " << A.pop_back();
	cout << endl;
	A.PrintStat();
	A.swap(5,6);
	A.PrintStat();
	TVector<int> B = A;
	B.PrintStat();	
	A.clear();
	A.PrintStat();
    return 0;
}
开发者ID:divyang4481,项目名称:mipt-hw,代码行数:19,代码来源:TVector.cpp

示例4: clear

 void clear() final {
     m_vector.clear();
     m_vector.shrink_to_fit();
 }
开发者ID:Cultrarius,项目名称:libosmium,代码行数:4,代码来源:vector_map.hpp

示例5: clear

 void clear() override final {
     m_vector.clear();
     m_vector.shrink_to_fit();
 }
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:4,代码来源:vector.hpp


注:本文中的TVector::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。