b+树,learning index

上传者: wang15939630104 | 上传时间: 2021-09-03 13:57:46 | 文件大小: 402KB | 文件类型: ZIP
## A C++11 implementation of the B-Tree part of "The Case for Learned Index Structures" A research **proof of concept** that implements the B-Tree section of [The Case for Learned Index Structures](https://arxiv.org/pdf/1712.01208.pdf) paper in C++. The general design is to have a single lookup structure that you can parameterize with a KeyType and a ValueType, and an overflow list that keeps new inserts until you retrain. There is a value in the constructor of the RMI that triggers a retrain when the overflow array reaches a certain size. The basic API: ```c++ // [first/second]StageParams are network parameters int maxAllowedError = 256; int maxBufferBeforeRetrain = 10001; auto modelIndex = RecursiveModelIndex recursiveModelIndex(firstStageParams, secondStageParams, maxAllowedError, maxBufferBeforeRetrain); for (int ii = 0; ii < 10000; ++ii) { modelIndex.insert(ii, ii * 2); } // Since we still have one more insert before retraining, retrain before searching... modelIndex.train(); auto result = modelIndex.find(5); if (result) { std::cout << "Yay! We got: " << result.get().first << ", " << result.get().second << std::endl; } else { std::cout << "Value not found." << std::endl; // This shouldn't happen in the above usage... } ``` See [src/main.cpp](src/main.cpp) for a usage example where it stores scaled log normal data. ### Dependencies - [nn_cpp](https://github.com/bcaine/nn_cpp) - Eigen based minimalistic C++ Neural Network library - [cpp-btree](https://code.google.com/archive/p/cpp-btree/) - A fast C++ implementation of a B+ Tree ### TODO: - Lots of code cleanup - Profiling of where the slowdowns are. On small tests, the cpp_btree lib beats it by 10-100x - Eigen::TensorFixed in nn_cpp would definitel

文件下载

资源详情

[{"title":"( 92 个子文件 402KB ) b+树,learning index","children":[{"title":"btree_test","children":[{"title":"Net.h <span style='color:#111;'> 4.72KB </span>","children":null,"spread":false},{"title":"utils","children":[{"title":"DataGenerators.h <span style='color:#111;'> 1.66KB </span>","children":null,"spread":false},{"title":"NetworkParameters.h <span style='color:#111;'> 653B </span>","children":null,"spread":false},{"title":"DataUtils.h <span style='color:#111;'> 1.23KB </span>","children":null,"spread":false}],"spread":true},{"title":"btree_test.pro.user <span style='color:#111;'> 23.46KB </span>","children":null,"spread":false},{"title":"SecondStageNode.h <span style='color:#111;'> 8.04KB </span>","children":null,"spread":false},{"title":"RecursiveModelIndex.h <span style='color:#111;'> 11.72KB </span>","children":null,"spread":false},{"title":"main.cpp <span style='color:#111;'> 2.78KB </span>","children":null,"spread":false},{"title":"nn_cpp","children":[{"title":"nn","children":[{"title":"loss","children":[{"title":"Losses.h <span style='color:#111;'> 280B </span>","children":null,"spread":false},{"title":"CrossEntropy.h <span style='color:#111;'> 3.62KB </span>","children":null,"spread":false},{"title":"HuberLoss.h <span style='color:#111;'> 3.65KB </span>","children":null,"spread":false},{"title":"MeanSquaredError.h <span style='color:#111;'> 2.25KB </span>","children":null,"spread":false}],"spread":true},{"title":"layers","children":[{"title":"Layer.h <span style='color:#111;'> 2.04KB </span>","children":null,"spread":false},{"title":"Layers.h <span style='color:#111;'> 291B </span>","children":null,"spread":false},{"title":"Relu.h <span style='color:#111;'> 2.48KB </span>","children":null,"spread":false},{"title":"Softmax.h <span style='color:#111;'> 3.14KB </span>","children":null,"spread":false},{"title":"Dense.h <span style='color:#111;'> 7.77KB </span>","children":null,"spread":false}],"spread":true},{"title":"utils","children":[{"title":"WeightInitializers.h <span style='color:#111;'> 3.82KB </span>","children":null,"spread":false}],"spread":true},{"title":"optimizers","children":[{"title":"AdamImpl.h <span style='color:#111;'> 4.12KB </span>","children":null,"spread":false},{"title":"StochasticGradientDescentImpl.h <span style='color:#111;'> 1.31KB </span>","children":null,"spread":false},{"title":"OptimizerImpl.h.autosave <span style='color:#111;'> 612B </span>","children":null,"spread":false},{"title":"Optimizers.h <span style='color:#111;'> 3.08KB </span>","children":null,"spread":false},{"title":"OptimizerImpl.h <span style='color:#111;'> 616B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"CMakeLists.txt <span style='color:#111;'> 1.33KB </span>","children":null,"spread":false},{"title":"examples","children":[{"title":"BasicMLP.cpp <span style='color:#111;'> 4.16KB </span>","children":null,"spread":false},{"title":"IrisTest.cpp <span style='color:#111;'> 3.59KB </span>","children":null,"spread":false},{"title":"data","children":[{"title":"iris_data.csv <span style='color:#111;'> 4.59KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"LICENSE <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"README.md <span style='color:#111;'> 2.48KB </span>","children":null,"spread":false},{"title":".git","children":[{"title":"logs","children":[{"title":"HEAD <span style='color:#111;'> 185B </span>","children":null,"spread":false},{"title":"refs","children":[{"title":"heads","children":[{"title":"master <span style='color:#111;'> 185B </span>","children":null,"spread":false}],"spread":false},{"title":"remotes","children":[{"title":"origin","children":[{"title":"HEAD <span style='color:#111;'> 185B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"packed-refs <span style='color:#111;'> 114B </span>","children":null,"spread":false},{"title":"info","children":[{"title":"exclude <span style='color:#111;'> 240B </span>","children":null,"spread":false}],"spread":false},{"title":"index <span style='color:#111;'> 2.33KB </span>","children":null,"spread":false},{"title":"objects","children":[{"title":"pack","children":[{"title":"pack-f4a10e9472fae3400fa2ee450ff83d6a59e14e22.idx <span style='color:#111;'> 8.10KB </span>","children":null,"spread":false},{"title":"pack-f4a10e9472fae3400fa2ee450ff83d6a59e14e22.pack <span style='color:#111;'> 47.90KB </span>","children":null,"spread":false}],"spread":false},{"title":"info","children":null,"spread":false}],"spread":false},{"title":"HEAD <span style='color:#111;'> 23B </span>","children":null,"spread":false},{"title":"config <span style='color:#111;'> 299B </span>","children":null,"spread":false},{"title":"refs","children":[{"title":"heads","children":[{"title":"master <span style='color:#111;'> 41B </span>","children":null,"spread":false}],"spread":false},{"title":"tags","children":null,"spread":false},{"title":"remotes","children":[{"title":"origin","children":[{"title":"HEAD <span style='color:#111;'> 32B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"hooks","children":[{"title":"pre-applypatch.sample <span style='color:#111;'> 424B </span>","children":null,"spread":false},{"title":"pre-push.sample <span style='color:#111;'> 1.32KB </span>","children":null,"spread":false},{"title":"commit-msg.sample <span style='color:#111;'> 896B </span>","children":null,"spread":false},{"title":"pre-commit.sample <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"applypatch-msg.sample <span style='color:#111;'> 478B </span>","children":null,"spread":false},{"title":"prepare-commit-msg.sample <span style='color:#111;'> 1.46KB </span>","children":null,"spread":false},{"title":"update.sample <span style='color:#111;'> 3.53KB </span>","children":null,"spread":false},{"title":"fsmonitor-watchman.sample <span style='color:#111;'> 3.25KB </span>","children":null,"spread":false},{"title":"post-update.sample <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"pre-rebase.sample <span style='color:#111;'> 4.78KB </span>","children":null,"spread":false},{"title":"pre-receive.sample <span style='color:#111;'> 544B </span>","children":null,"spread":false}],"spread":false},{"title":"description <span style='color:#111;'> 73B </span>","children":null,"spread":false}],"spread":true},{"title":"tests","children":[{"title":"LossTests.cpp <span style='color:#111;'> 3.34KB </span>","children":null,"spread":false},{"title":"NetTests.cpp <span style='color:#111;'> 6.30KB </span>","children":null,"spread":false}],"spread":false},{"title":".gitignore <span style='color:#111;'> 33B </span>","children":null,"spread":false}],"spread":true},{"title":"cpp-btree","children":[{"title":"btree_map.h <span style='color:#111;'> 4.45KB </span>","children":null,"spread":false},{"title":"COPYING <span style='color:#111;'> 11.29KB </span>","children":null,"spread":false},{"title":"safe_btree_set.h <span style='color:#111;'> 3.01KB </span>","children":null,"spread":false},{"title":"CMakeLists.txt <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"safe_btree.h <span style='color:#111;'> 12.66KB </span>","children":null,"spread":false},{"title":"btree.h <span style='color:#111;'> 82.54KB </span>","children":null,"spread":false},{"title":"btree_test.h <span style='color:#111;'> 30.36KB </span>","children":null,"spread":false},{"title":"safe_btree_map.h <span style='color:#111;'> 3.12KB </span>","children":null,"spread":false},{"title":".git","children":[{"title":"logs","children":[{"title":"HEAD <span style='color:#111;'> 197B </span>","children":null,"spread":false},{"title":"refs","children":[{"title":"heads","children":[{"title":"master <span style='color:#111;'> 197B </span>","children":null,"spread":false}],"spread":false},{"title":"remotes","children":[{"title":"origin","children":[{"title":"HEAD <span style='color:#111;'> 197B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"packed-refs <span style='color:#111;'> 114B </span>","children":null,"spread":false},{"title":"info","children":[{"title":"exclude <span style='color:#111;'> 240B </span>","children":null,"spread":false}],"spread":false},{"title":"index <span style='color:#111;'> 1.13KB </span>","children":null,"spread":false},{"title":"objects","children":[{"title":"pack","children":[{"title":"pack-9bfe266d1b6e641a8d920d7946d4c905072f898a.idx <span style='color:#111;'> 3.97KB </span>","children":null,"spread":false},{"title":"pack-9bfe266d1b6e641a8d920d7946d4c905072f898a.pack <span style='color:#111;'> 228.33KB </span>","children":null,"spread":false}],"spread":false},{"title":"info","children":null,"spread":false}],"spread":false},{"title":"HEAD <span style='color:#111;'> 23B </span>","children":null,"spread":false},{"title":"config <span style='color:#111;'> 311B </span>","children":null,"spread":false},{"title":"refs","children":[{"title":"heads","children":[{"title":"master <span style='color:#111;'> 41B </span>","children":null,"spread":false}],"spread":false},{"title":"tags","children":null,"spread":false},{"title":"remotes","children":[{"title":"origin","children":[{"title":"HEAD <span style='color:#111;'> 32B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"hooks","children":[{"title":"pre-applypatch.sample <span style='color:#111;'> 424B </span>","children":null,"spread":false},{"title":"pre-push.sample <span style='color:#111;'> 1.32KB </span>","children":null,"spread":false},{"title":"commit-msg.sample <span style='color:#111;'> 896B </span>","children":null,"spread":false},{"title":"pre-commit.sample <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"applypatch-msg.sample <span style='color:#111;'> 478B </span>","children":null,"spread":false},{"title":"prepare-commit-msg.sample <span style='color:#111;'> 1.46KB </span>","children":null,"spread":false},{"title":"update.sample <span style='color:#111;'> 3.53KB </span>","children":null,"spread":false},{"title":"fsmonitor-watchman.sample <span style='color:#111;'> 3.25KB </span>","children":null,"spread":false},{"title":"post-update.sample <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"pre-rebase.sample <span style='color:#111;'> 4.78KB </span>","children":null,"spread":false},{"title":"pre-receive.sample <span style='color:#111;'> 544B </span>","children":null,"spread":false}],"spread":false},{"title":"description <span style='color:#111;'> 73B </span>","children":null,"spread":false}],"spread":false},{"title":"README <span style='color:#111;'> 1007B </span>","children":null,"spread":false},{"title":"btree_container.h <span style='color:#111;'> 11.06KB </span>","children":null,"spread":false},{"title":"btree_set.h <span style='color:#111;'> 4.02KB </span>","children":null,"spread":false}],"spread":false},{"title":"btree_test.pro <span style='color:#111;'> 1.41KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明