Skip to content

Commit 3fb6c4d

Browse files
committed
Revert "Use threads and views when evaluating classifier."
This reverts commit 39a7acc.
1 parent 4328f6b commit 3fb6c4d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/classification/main.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function stack_function_results(row_fun::Function, X::Matrix)
2727
N = size(X, 1)
2828
N_cols = length(row_fun(X[1, :])) # gets the number of columns
2929
out = Array{Float64}(undef, N, N_cols)
30-
Threads.@threads for i in 1:N
31-
out[i, :] = row_fun(@view X[i, :])
30+
for i in 1:N
31+
out[i, :] = row_fun(X[i, :])
3232
end
3333
return out
3434
end
@@ -137,9 +137,9 @@ function prune_tree(tree::LeafOrNode{S, T}, purity_thresh=1.0) where {S, T}
137137
end
138138

139139

140-
apply_tree(leaf::Leaf{T}, feature::AbstractVector{S}) where {S, T} = leaf.majority
140+
apply_tree(leaf::Leaf{T}, feature::Vector{S}) where {S, T} = leaf.majority
141141

142-
function apply_tree(tree::Node{S, T}, features::AbstractVector{S}) where {S, T}
142+
function apply_tree(tree::Node{S, T}, features::Vector{S}) where {S, T}
143143
if features[tree.featid] < tree.featval
144144
return apply_tree(tree.left, features)
145145
else
@@ -266,7 +266,7 @@ n_labels` matrix of probabilities, each row summing up to 1.
266266
`col_labels` is a vector containing the distinct labels
267267
(eg. ["versicolor", "virginica", "setosa"]). It specifies the column ordering
268268
of the output matrix. """
269-
function apply_forest_proba(forest::Ensemble{S, T}, features::AbstractVector{S}, labels) where {S, T}
269+
function apply_forest_proba(forest::Ensemble{S, T}, features::Vector{S}, labels) where {S, T}
270270
votes = [apply_tree(tree, features) for tree in forest.trees]
271271
return compute_probabilities(labels, votes)
272272
end

0 commit comments

Comments
 (0)