Skip to content

Commit

Permalink
generalize trees in PartitionTwoDimensionalBoosting
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbkoch committed Nov 5, 2024
1 parent 823e10a commit 8c9997f
Show file tree
Hide file tree
Showing 4 changed files with 422 additions and 141 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ We also build on top of many great packages. Please check them out!
- [Differentially Private Gradient Boosting on Linear Learners for Tabular Data Analysis](https://assets.amazon.science/fa/3a/a62ba73f4bbda1d880b678c39193/differentially-private-gradient-boosting-on-linear-learners-for-tabular-data-analysis.pdf)
- [Differentially private and explainable boosting machine with enhanced utility](https://www.sciencedirect.com/science/article/abs/pii/S0925231224011950)
- [Concrete compressive strength prediction using an explainable boosting machine model](https://www.sciencedirect.com/science/article/pii/S2214509523000244/pdfft?md5=171c275b6bcae8897cef03d931e908e2&pid=1-s2.0-S2214509523000244-main.pdf)
- [Proxy endpoints - bridging clinical trials and real world data](https://pdf.sciencedirectassets.com/272371/1-s2.0-S1532046424X00064/1-s2.0-S1532046424001412/main.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEIn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIBYgAN6aOVrDnvQ1932tPndUyJ0Dm1nHdMVLiekPVduQAiAzbYe7W%2Bd6Dj8ee42ZeZnQxJwEjEjuGdiUEPx0a2G43SqyBQgSEAUaDDA1OTAwMzU0Njg2NSIMyMkCUNFeDTCUCppMKo8FiVShykb8phR%2F8aWUGE9gfnE5y7X3Jj1ZA2CVldH13T67s536bdTBhjIMF18rV0YP9iMi6B5aGr%2F286ovIJl332fxZ6iQNBIOPTm8kXQDUqvZbknYldiZqUPs69kuC%2FcKnJd1BWnv2SEZwbRuX94rWnRDPDaSoJx%2FVS6o4qsbFjp9%2BMYZr%2BvJzWHKrXAI4W%2Fh9%2BsIa0yvlac3IMWzAeD23HzDNmF0nqjJ6BSZzmDN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us-east-1%2Fs3%2Faws4_request&X-Amz-Signature=15f8e40964e2c750ae15e43aa8e7f7c76eef6a76b792e41434d14bed42b31432&hash=d4a3e49b29443e5eea9e5a44c0dc11b3f30b21addbe6d6d20d523c68db23cd23&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S1532046424001412&tid=spdf-4fbabbd8-becb-4526-98d3-c7517914e457&sid=8ab2a095350fc74edc4b8765ecd8c0260edcgxrqa&type=client&tsoh=d3d3LnNjaWVuY2VkaXJlY3QuY29t&ua=0f165f0b050207505b0151&rr=8ddbc55a0d60a380&cc=us)
- [Machine Learning Model Reveals Determinators for Admission to Acute Mental Health Wards From Emergency Department Presentations](https://onlinelibrary.wiley.com/doi/epdf/10.1111/inm.13402)
- [Proposing an inherently interpretable machine learning model for shear strength prediction of reinforced concrete beams with stirrups](https://pdf.sciencedirectassets.com/287527/1-s2.0-S2214509523X00035/1-s2.0-S2214509524005011/main.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjECUaCXVzLWVhc3QtMSJGMEQCIB0r0KsYBZufOjbCVtUtozwn1QKMdLt2tbbfhuJKjWlXAiB5Dfr7p0yyj%2FSfypTLmjPL8WbjGAB3tRACFjyyqQbbfiq8BQiu%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAUaDDA1OTAwMzU0Njg2NSIMqBpZ2HmN91c%2BJPqpKpAFZtvqQjCScZa4FN%2FeubsPzOk5c%2B58LliO4Zr%2Bn1pm3vtW4I9I1vA29pkhT5was1N3ccPPIm2jNLwJ%2FHiZej7A2SmFv13Ro3sTvhqG%2F6A9Xx70Nx9jOlDPJUmCypKadKp0FGfuhZQuxeN0b%2F1QUUQZG4RpxC%2FXorRRHmb%2FrXcOWBwu4PmLZAkWmTKpncjDI7oj8eh8yBe6%2FA3JkJ14ZyBgR7JnPzR2ZqMdIhvlKoyMn6EnL1Azq2y3qwEMdzSCvz3wH3sT4pClc2vPs6ruQS4CdT3E7BHrf42Q0V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79aa03be1c292b58c67ce0215de36cbdb4&hash=46dd1da122f4cea242c6444a811fb16dde5cb8465e88552ac3eaeee97b975e9b&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S2214509524005011&tid=spdf-45c1c4d1-dd97-4c0d-a04f-c30843a79e78&sid=1fea53ed2d5cf1443e4a7c4-33f4bf6475e1gxrqa&type=client&tsoh=d3d3LnNjaWVuY2VkaXJlY3QuY29t&ua=0f155c5f060d565b01055d&rr=88eb49dd2a5f7688&cc=us)
- [Using explainable machine learning and fitbit data to investigate predictors of adolescent obesity](https://www.nature.com/articles/s41598-024-60811-2)
Expand Down
2 changes: 2 additions & 0 deletions shared/libebm/BoosterShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void BoosterShell::Free(BoosterShell* const pBoosterShell) {
AlignedFree(pBoosterShell->m_aMulticlassMidwayTemp);
AlignedFree(pBoosterShell->m_aSplitPositionsTemp);
AlignedFree(pBoosterShell->m_aTreeNodesTemp);
AlignedFree(pBoosterShell->m_aTemp1);
BoosterCore::Free(pBoosterShell->m_pBoosterCore);

// before we free our memory, indicate it was freed so if our higher level language attempts to use it we have
Expand Down Expand Up @@ -162,6 +163,7 @@ ErrorEbm BoosterShell::FillAllocations() {
if(nullptr == m_aTreeNodesTemp) {
goto failed_allocation;
}
m_cTreeNodesTempBytes = m_pBoosterCore->GetCountBytesTreeNodes();
}
}

Expand Down
21 changes: 21 additions & 0 deletions shared/libebm/BoosterShell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ class BoosterShell final {
// right?
void* m_aMulticlassMidwayTemp;

size_t m_cTemp1Bytes;
void* m_aTemp1;

size_t m_cTreeNodesTempBytes;
void* m_aTreeNodesTemp;

void* m_aSplitPositionsTemp;

#ifndef NDEBUG
Expand All @@ -70,6 +75,11 @@ class BoosterShell final {
m_aBoostingFastBinsTemp = nullptr;
m_aBoostingMainBins = nullptr;
m_aMulticlassMidwayTemp = nullptr;

m_cTemp1Bytes = 0;
m_aTemp1 = nullptr;

m_cTreeNodesTempBytes = 0;
m_aTreeNodesTemp = nullptr;
m_aSplitPositionsTemp = nullptr;
}
Expand Down Expand Up @@ -126,6 +136,17 @@ class BoosterShell final {
return static_cast<TreeNode<bHessian, cCompilerScores>*>(m_aTreeNodesTemp);
}

INLINE_ALWAYS void* GetTreeNodeMultiTemp() { return m_aTreeNodesTemp; }

INLINE_ALWAYS ErrorEbm ReserveTreeNodesTemp(const size_t cBytes) {
return AlignedGrow(static_cast<void**>(&m_aTreeNodesTemp), &m_cTreeNodesTempBytes, cBytes, EBM_FALSE);
}

INLINE_ALWAYS void* GetTemp1() { return m_aTemp1; }
INLINE_ALWAYS ErrorEbm ReserveTemp1(const size_t cBytes) {
return AlignedGrow(static_cast<void**>(&m_aTemp1), &m_cTemp1Bytes, cBytes, EBM_FALSE);
}

template<bool bHessian, size_t cCompilerScores = 1>
INLINE_ALWAYS SplitPosition<bHessian, cCompilerScores>* GetSplitPositionsTemp() {
return static_cast<SplitPosition<bHessian, cCompilerScores>*>(m_aSplitPositionsTemp);
Expand Down
Loading

0 comments on commit 8c9997f

Please sign in to comment.