dotnet / dotnet/machinelearning

Change FastTree BinFinder to use floats and remove one data copy

Open
#1,648 0 comments 0 reactions 0 assignees View on GitHub
area-Trees Priority:2
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

See the conversation here: https://github.com/dotnet/machinelearning/pull/1580#discussion_r233672947

With the above change, I made it so the FastTree `BinFinder.FindDistinctCounts` was no longer destructive of the `values` VBuffer during `CalculateBins`.

Now that it no longer destroys the buffer, we no longer need to copy it here:

https://github.com/dotnet/machinelearning/blob/cb9effcd091c60fa291aad96cc18c14ddf841b6f/src/Microsoft.ML.FastTree/FastTree.cs#L1475-L1478

However, I couldn't easily remove this copy because doing the copy also changed the VBuffer from `float` to `double`. This should also be changed, as recognized by this `REVIEW` comment in the code:

https://github.com/dotnet/machinelearning/blob/cb9effcd091c60fa291aad96cc18c14ddf841b6f/src/Microsoft.ML.FastTree/FastTree.cs#L2408

This issue is to fix both of these things. First, change BinFinder to work on `float` instead of `double`. Then, we can remove this extra copy and just pass in the normal `VBuffer` to `BinFinder`, without worrying if it will destroy the buffer.

/cc @Zruty0 @TomFinley

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.