-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anastasios Zouzias
committed
Oct 20, 2019
1 parent
d5d5a91
commit 604b31b
Showing
21 changed files
with
671 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3' | ||
|
||
services: | ||
microgbt: | ||
image: microgbt:0.0.1 | ||
build: | ||
dockerfile: docker/Dockerfile | ||
context: ./ | ||
volumes: | ||
- .:/home/ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM zouzias/boost:1.71.0 | ||
|
||
RUN apt-get -yq update && apt-get -yq install vim cmake python3-pip libeigen3-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
import microgbtpy | ||
from math import sqrt | ||
import logging.config | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
import microgbtpy | ||
import logging.config | ||
import numpy as np | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,4 @@ namespace microgbt { | |
} | ||
}; | ||
|
||
} // namespace microgbt | ||
} // namespace microgbt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#pragma once | ||
|
||
#include <set> | ||
|
||
namespace microgbt { | ||
|
||
using NodeId = long; | ||
|
||
/** | ||
* ClassList | ||
*/ | ||
class ClassList { | ||
|
||
Vector _gradients; | ||
Vector _hessians; | ||
std::vector<NodeId> _nodeIds; | ||
|
||
// Node index to set of left subtree candidate samples | ||
std::map<NodeId, std::set<long>> _leftCandidateSamples; | ||
|
||
public: | ||
|
||
explicit ClassList(const Vector &gradients, const Vector &hessians): | ||
_gradients(gradients), _hessians(hessians), | ||
_nodeIds(gradients.size()){ | ||
std::fill(_nodeIds.begin(), _nodeIds.end(), 0); | ||
} | ||
|
||
void clean() { | ||
_leftCandidateSamples.clear(); | ||
} | ||
|
||
NodeId nodeAt(long index) const { | ||
return _nodeIds[index]; | ||
} | ||
|
||
void appendSampleToLeftSubTree(NodeId nodeId, long index) { | ||
_leftCandidateSamples[nodeId].insert(index); | ||
} | ||
|
||
void updateNodeId(long sampleIndex, NodeId newNodeId) { | ||
_nodeIds[sampleIndex] = newNodeId; | ||
} | ||
|
||
std::set<long> getLeft(NodeId nodeId) { | ||
return _leftCandidateSamples[nodeId]; | ||
} | ||
|
||
long getLeftSize(NodeId nodeId) { | ||
return _leftCandidateSamples[nodeId].size(); | ||
} | ||
|
||
long getRightSize(NodeId nodeId) { | ||
return (long)_gradients.size() - (long)_leftCandidateSamples[nodeId].size(); | ||
} | ||
|
||
}; | ||
} // namespace microgbt |
Oops, something went wrong.