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


C++ DataVector::end方法代码示例

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


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

示例1: update_seeds

    /** Updates the seeds priority queue with new neighbors or neighbors that now have a better 
     * reachability distance than before.
     * @param N_eps All points in the the epsilon-neighborhood of the center_object, including p itself.
     * @param center_object The point on which to start the update process.
     * @param c_dist The core distance of the given center_object.
     * @param[out] o_seeds The seeds priority queue (aka set with special comparator function) that will be modified.
     */
    void update_seeds( const DataVector& N_eps, const DataPoint* center_object, const real c_dist, DataSet& o_seeds) {
        assert( c_dist != OPTICS::UNDEFINED && "the core distance must be set <> UNDEFINED when entering update_seeds");
        
        for( DataVector::const_iterator it=N_eps.begin(); it!=N_eps.end(); ++it) {
            DataPoint* o = *it;

            if( o->is_processed())
                continue;

            const real new_r_dist = std::max( c_dist, squared_distance( center_object, o));
            // *** new_r_dist != UNDEFINED ***
        
            if( o->reachability_distance() == OPTICS::UNDEFINED) {
                // *** o not in seeds ***
                o->reachability_distance( new_r_dist);
                o_seeds.insert( o);

            } else if( new_r_dist < o->reachability_distance()) {
                // *** o already in seeds & can be improved ***
                o_seeds.erase( o);
                o->reachability_distance( new_r_dist);
                o_seeds.insert( o);
            }
        }
    }
开发者ID:langenhagen,项目名称:Master-Thesis,代码行数:32,代码来源:optics.hpp

示例2:

util::Clustering::Clustering(const DataVector& _data, unsigned _max) : m_maxClusters(_max) {
    m_data.insert(m_data.begin(), _data.begin(), _data.end());
    
    ClusterMap clusterQualityScores;
    
    for (unsigned clusterCount = 1; clusterCount <= m_maxClusters; clusterCount++) {
        clusterQualityScores[clusterCount] = _kmeans(clusterCount);
    }
        
    std::vector< CountClusterPair > sortedScores;
    std::copy(clusterQualityScores.begin(), clusterQualityScores.end(), std::back_inserter(sortedScores));
    ScoreComparator comparator;
    std::sort(sortedScores.begin(), sortedScores.end(), comparator);

    report("Scores:");
    for (int i = 0; i < sortedScores.size(); i++) {
        report(sortedScores[i].first << " clusters: " << sortedScores[i].second.getScore());
    }
    
    report("Clustering with highest score: ");
    report(util::Indents(2) << "cluster count: " << sortedScores[0].first);
    report(util::Indents(2) << "aggregate score: " << sortedScores[0].second.getScore());
    report(util::Indents(2) << "detected clusters:");
    for (auto it = sortedScores[0].second.getClusters().begin(); it != sortedScores[0].second.getClusters().end(); ++it) {
        const Cluster& cluster = *it;
        report(util::Indents(4) << "position = " << cluster.position << ", elements = " << cluster.data.size());
    }
    
    result = sortedScores[0].second;
}
开发者ID:wangbiaouestc,项目名称:clpeak,代码行数:30,代码来源:Clustering.cpp

示例3: main

int main(int argc, char *argv[]) {
  g_conf.number_of_feature = 3;
  g_conf.max_depth = 4;
  if (argc > 1) {
    g_conf.max_depth = boost::lexical_cast<int>(argv[1]);
  }

  DataVector d;
  bool r = LoadDataFromFile("../../data/train.dat", &d);
  assert(r);

  RegressionTree tree;

  tree.Fit(&d);
  std::ofstream model_output("../../data/model");
  model_output << tree.Save();

  RegressionTree tree2;
  tree2.Load(tree.Save());

  DataVector::iterator iter = d.begin();
  PredictVector predict;
  for ( ; iter != d.end(); ++iter) {
    std::cout << (*iter)->ToString() << std::endl;
    ValueType p = tree2.Predict(**iter);
    predict.push_back(p);
    std::cout << p << "," << tree.Predict(**iter) << std::endl;
  }

  std::cout << "rmse: " << RMSE(d, predict) << std::endl;

  CleanDataVector(&d);
  return 0;
}
开发者ID:mafeichao,项目名称:gbdt,代码行数:34,代码来源:tree_unittest.cpp

示例4:

uint8 RadialMenuManager::findNextId            (const DataVector & dv)
{
    uint8 id = 1;
    for (DataVector::const_iterator it = dv.begin (); it != dv.end (); ++it)
    {
        const ObjectMenuRequestData & data = *it;
        id = std::max (id, static_cast<uint8>(data.m_id + 1));
    }
    
    return id;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:11,代码来源:RadialMenuManager.cpp

示例5: squared_core_distance

    /** Finds the squared core distance of one given point.
     * @param p The point to be examined.
     * @param min_pts The minimum number of points to be found within an epsilon-neigborhood.
     * @param N_eps All points in the the epsilon-neighborhood of p, including p itself.
     * @return The squared core distance of p.
     */
    real squared_core_distance( const DataPoint* p, const unsigned int min_pts, DataVector& N_eps) {    
        assert( min_pts > 0 && "min_pts must be greater than 0");
        real ret( OPTICS::UNDEFINED);
    
        if( N_eps.size() > min_pts) {
            std::nth_element( N_eps.begin(), 
                              N_eps.begin()+min_pts, 
                              N_eps.end(), 
                              [p]( const DataPoint* a, const DataPoint* b){ return squared_distance( p, a) < squared_distance( p, b); } );

            ret = squared_distance( p, N_eps[min_pts]);
        }
        return ret;
    }
开发者ID:langenhagen,项目名称:Master-Thesis,代码行数:20,代码来源:optics.hpp

示例6: get_neighbors

    /** Retrieves all points in the epsilon-surrounding of the given data point, including the point itself.
     * @param p The datapoint which represents the center of the epsilon surrounding.
     * @param eps The epsilon value that represents the radius for the neigborhood search.
     * @param db The database consisting of all datapoints that are checked for neighborhood.
     * @param A vector of pointers to datapoints that lie within the epsilon-neighborhood 
     *        of the given point p, including p itself.
     */
    DataVector get_neighbors( const DataPoint* p, const real eps, DataVector& db) {
        assert( eps >= 0 && "eps must not be negative");
        DataVector ret;

        const real eps_sq = eps*eps;

        for( auto q_it=db.begin(); q_it!=db.end(); ++q_it) {
            DataPoint* q = *q_it;
            if( squared_distance( p, q) <= eps_sq) {
                ret.push_back( q);
            }
        }
        return ret;
    }
开发者ID:langenhagen,项目名称:Master-Thesis,代码行数:21,代码来源:optics.hpp

示例7: optics

    /** Performs the classic OPTICS algorithm.
     * @param db All data points that are to be considered by the algorithm. Changes their values.
     * @param eps The epsilon representing the radius of the epsilon-neighborhood.
     * @param min_pts The minimum number of points to be found within an epsilon-neigborhood.
     * @return Return the OPTICS ordered list of Data points with reachability-distances set.
     */
    DataVector optics( DataVector& db, const real eps, const unsigned int min_pts) {
        assert( eps >= 0 && "eps must not be negative");
        assert( min_pts > 0 && "min_pts must be greater than 0");
        DataVector ret;

        for( auto p_it = db.begin(); p_it != db.end(); ++p_it) {
            DataPoint* p = *p_it;
            
            if( p->is_processed())
                continue;
            
            expand_cluster_order( db, p, eps, min_pts, ret);
        }
        return ret;
    }
开发者ID:langenhagen,项目名称:Master-Thesis,代码行数:21,代码来源:optics.hpp

示例8: main

int main(int argc, char *argv[]) {
  UNUSED(argc);
  UNUSED(argv);
  std::string l = "0 2 0:10 1:100";
  g_conf.number_of_feature = 3;
  g_conf.max_depth = 4;
  g_conf.loss = LOG_LIKELIHOOD;

  Tuple *t = Tuple::FromString(l);

  std::cout << t->ToString() << std::endl;

  DataVector d;
  bool r = LoadDataFromFile("../../data/test.dat", &d);
  assert(r);
  DataVector::iterator iter = d.begin();
  for ( ; iter != d.end(); ++iter) {
    std::cout << (*iter)->ToString() << std::endl;
  }

  CleanDataVector(&d);
  return 0;
}
开发者ID:StevenLee-belief,项目名称:gbdt,代码行数:23,代码来源:data_unittest.cpp

示例9: copyState

void copyState( ESMoL::State inputState, ESMoL::State outputState ) {

    UdmEngine::copyState( inputState, outputState );

    TransStartVector transStartVector = inputState.TransStart_kind_children();
    for( TransStartVector::iterator tsvItr = transStartVector.begin() ; tsvItr != transStartVector.end() ; ++tsvItr ) {
        ESMoL::TransStart inputTransStart = *tsvItr;
        ESMoL::TransStart outputTransStart = ESMoL::TransStart::Create( outputState );
        getTransConnectorMap().insert(  std::make_pair( inputTransStart, outputTransStart )  );
    }

    DataVector dataVector = inputState.Data_kind_children();
    for( DataVector::iterator dtvItr = dataVector.begin() ; dtvItr != dataVector.end() ; ++dtvItr ) {
        copyData(  *dtvItr, ESMoL::Data::Create( outputState )  );
    }

    EventVector eventVector = inputState.Event_kind_children();
    for( EventVector::iterator envItr = eventVector.begin() ; envItr != eventVector.end() ; ++envItr ) {
        copyEvent(  *envItr, ESMoL::Event::Create( outputState )  );
    }

    JunctionVector junctionVector = inputState.Junction_kind_children();
    for( JunctionVector::iterator jnvItr = junctionVector.begin() ; jnvItr != junctionVector.end() ; ++jnvItr ) {
        ESMoL::Junction inputJunction = *jnvItr;
        ESMoL::Junction outputJunction = ESMoL::Junction::Create( outputState );
        getTransConnectorMap().insert(  std::make_pair( inputJunction, outputJunction )  );
    }

    StateVector stateVector = inputState.State_kind_children();
    for( StateVector::iterator stvItr = stateVector.begin() ; stvItr != stateVector.end() ; ++stvItr ) {
        ESMoL::State inputSubState = *stvItr;
        ESMoL::State outputSubState = ESMoL::State::Create( outputState );
        getTransConnectorMap().insert(  std::make_pair( inputSubState, outputSubState )  );
        copyState( inputSubState, outputSubState );
    }

    ConnectorRefVector connectorRefVector = inputState.ConnectorRef_kind_children();
    for( ConnectorRefVector::iterator jnvItr = connectorRefVector.begin() ; jnvItr != connectorRefVector.end() ; ++jnvItr ) {
        ESMoL::ConnectorRef inputConnectorRef = *jnvItr;
        ESMoL::ConnectorRef outputConnectorRef = ESMoL::ConnectorRef::Create( outputState );
        getTransConnectorMap().insert(  std::make_pair( inputConnectorRef, outputConnectorRef )  );
        getConnectorRefList().push_back( inputConnectorRef );
    }

    TransitionVector transitionVector = inputState.Transition_kind_children();
    for( TransitionVector::iterator trvItr = transitionVector.begin() ; trvItr != transitionVector.end() ; ++trvItr ) {
        ESMoL::Transition inputTransition = *trvItr;

        ESMoL::TransConnector inputSrcTransConnector = inputTransition.srcTransition_end();
        TransConnectorMap::iterator tcmItr = getTransConnectorMap().find( inputSrcTransConnector );
        if ( tcmItr == getTransConnectorMap().end() ) {
            std::cerr << "WARNING:  transconnector does not map to copy" << std::endl;
            continue;
        }
        ESMoL::TransConnector outputSrcTransConnector = tcmItr->second;

        ESMoL::TransConnector inputDstTransConnector = inputTransition.dstTransition_end();
        tcmItr = getTransConnectorMap().find( inputDstTransConnector );
        if ( tcmItr == getTransConnectorMap().end() ) {
            std::cerr << "WARNING:  transconnector does not map to copy" << std::endl;
            continue;
        }
        ESMoL::TransConnector outputDstTransConnector = tcmItr->second;

        ESMoL::Transition outputTransition = ESMoL::Transition::Create( outputState );
        UdmEngine::copyTransition( inputTransition, outputTransition );

        outputTransition.srcTransition_end() = outputSrcTransConnector;
        outputTransition.dstTransition_end() = outputDstTransConnector;
    }
}
开发者ID:pombreda,项目名称:metamorphosys-desktop,代码行数:71,代码来源:esmolflatten.cpp


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