Skip to content

Commit

Permalink
Merge pull request #141 from Evovest/perf
Browse files Browse the repository at this point in the history
Perf
  • Loading branch information
jeremiedb authored Mar 24, 2022
2 parents cecc06c + 66c140a commit 80a4cba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EvoTrees"
uuid = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
authors = ["jeremiedb <[email protected]>"]
version = "0.9.5"
version = "0.9.6"

[deps]
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![Build Status](https://travis-ci.org/Evovest/EvoTrees.jl.svg?branch=master)](https://travis-ci.org/Evovest/EvoTrees.jl)
[![Build status](https://github.com/Evovest/EvoTrees.jl/workflows/CI/badge.svg)](https://github.com/Evovest/EvoTrees.jl/actions)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://Evovest.github.io/EvoTrees.jl/dev)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://Evovest.github.io/EvoTrees.jl/stable)
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://Evovest.github.io/EvoTrees.jl/dev)

A Julia implementation of boosted trees with CPU and GPU support.
Efficient histogram based algorithms with support for multiple loss functions (notably multi-target objectives such as max likelihood methods).
Expand Down
13 changes: 8 additions & 5 deletions src/find_split.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#############################################
# Get the braking points
#############################################
function get_edges(X::AbstractMatrix{T}, nbins = 250) where {T}
function get_edges(X::AbstractMatrix{T}, nbins) where {T}
Random.seed!(123)
nobs = min(size(X, 1), 1000 * nbins)
obs = rand(1:size(X, 1), nobs)
edges = Vector{Vector{T}}(undef, size(X, 2))
@threads for i = 1:size(X, 2)
edges[i] = quantile(view(X, :, i), (1:nbins) / nbins)
edges[i] = quantile(view(X, obs, i), (1:nbins) / nbins)
if length(edges[i]) == 0
edges[i] = [minimum(view(X, :, i))]
edges[i] = [minimum(view(X, obs, i))]
end
end
return edges
Expand All @@ -18,9 +21,9 @@ end
function binarize(X, edges)
X_bin = zeros(UInt8, size(X))
@threads for i = 1:size(X, 2)
X_bin[:, i] = searchsortedlast.(Ref(edges[i][1:end-1]), view(X, :, i)) .+ 1
X_bin[:, i] .= searchsortedlast.(Ref(edges[i][1:end-1]), view(X, :, i)) .+ 1
end
X_bin
return X_bin
end

"""
Expand Down

2 comments on commit 80a4cba

@jeremiedb
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/57270

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.6 -m "<description of version>" 80a4cbad8fb3ef1f3d3c405bf052f7af6682f3ce
git push origin v0.9.6

Please sign in to comment.