MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / Get

Method Get

src/treelearner/feature_histogram.hpp:770–793  ·  view source on GitHub ↗

! * \brief Get data for the specific index * \param idx which index want to get * \param out output data will store into this * \return True if this index is in the pool, False if this index is not in the pool */

Source from the content-addressed store, hash-verified

768 * \return True if this index is in the pool, False if this index is not in the pool
769 */
770 bool Get(int idx, FeatureHistogram** out) {
771 if (is_enough_) {
772 *out = pool_[idx].get();
773 return true;
774 } else if (mapper_[idx] >= 0) {
775 int slot = mapper_[idx];
776 *out = pool_[slot].get();
777 last_used_time_[slot] = ++cur_time_;
778 return true;
779 } else {
780 // choose the least used slot
781 int slot = static_cast<int>(ArrayArgs<int>::ArgMin(last_used_time_));
782 *out = pool_[slot].get();
783 last_used_time_[slot] = ++cur_time_;
784
785 // reset previous mapper
786 if (inverse_mapper_[slot] >= 0) mapper_[inverse_mapper_[slot]] = -1;
787
788 // update current mapper
789 mapper_[idx] = slot;
790 inverse_mapper_[slot] = idx;
791 return false;
792 }
793 }
794
795 /*!
796 * \brief Move data from one index to another index

Callers 2

BeforeFindBestSplitMethod · 0.45
BeforeFindBestSplitMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected