-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Public API for Tree predictors #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ourceCode, ICanSaveSummary, ICanSaveSummaryInKeyValuePairs, and ICanGetSummaryAsIRow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
…ntileValueMapper, IQuantileRegressionPredictor. Rename FastTreePredictionWrapper to TreeEnsembleModelParameters and all descendants to XyzModelParameters
docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs
Outdated
Show resolved
Hide resolved
@@ -467,12 +467,12 @@ private static VersionInfo GetVersionInfo() | |||
|
|||
protected override uint VerCategoricalSplitSerialized => 0x00010005; | |||
|
|||
internal FastTreeRegressionPredictor(IHostEnvironment env, TreeEnsemble trainedEnsemble, int featureCount, string innerArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal [](start = 8, length = 8)
i still think those should be internal. There is nothing else that can create the predictor/model params besides training..
Only the class needs to be public IMO.. but I won't block on it.. you can take it with Tom/Pete and potentially change on a later PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I'll keep these constructors public for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs
Outdated
Show resolved
Hide resolved
docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just some minor comments but please still address them before merging.
docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs
Outdated
Show resolved
Hide resolved
// Get the leaf and the leaf value for a row of data with Parity = 1, Induced = 1 in the first tree. | ||
var testRow = new VBuffer<float>(2, new[] { 1.0f, 1.0f }); | ||
List<int> path = default; | ||
var leaf = modelParams.GetLeaf(0, in testRow, ref path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var leaf = modelParams.GetLeaf(0, in testRow, ref path); [](start = 12, length = 56)
How many leaves you have in this tree?
If it's only few, can we actually read all leaf values, and also their relationship and drew small tree in comments?
like
(node 0, value: 1.1)
|(left)
|---->(leaf 0, value: 2.4)
|
|(right)
|---> (leaf 1,value: 3.5)
Fix #1701
Internalized and explicitly implemented the following interfaces implemented by
FastTreePredictionWrapper
:ICanSaveInIniFormat
ICanSaveInSourceCode
ICanSaveSummary
ICanSaveSummaryInKeyValuePairs
ICanGetSummaryAsIRow
IFeatureContributionMapper
IQuantileValueMapper
IQuantileRegressionPredictor
IValueMapperDist
Renamed
FastTreePredictionWrapper
toTreeEnsembleModelParameters
and descendants toXYZModelParameters
. Reduced public surface ofTreeEnsembleModelParameters
and descendants.Added public constructors for
TreeEnsembleModelParameters
and descendants.Added a sample showing
FastTreeRegressionModelParameters
operations.