Skip to content

Why regression used in apply_forest only if type of labels in model is Float64? #225

@xinadi

Description

@xinadi

Hi, I found that for regression algorithm in apply_forest function (mean) the labels type T of model should be exact Float64:

function apply_forest(forest::Ensemble{S, T}, features::AbstractVector{S}) where {S, T}
    n_trees = length(forest)
    votes = Array{T}(undef, n_trees)
    for i in 1:n_trees
        votes[i] = apply_tree(forest.trees[i], features)
    end
    if T <: Float64
        return mean(votes)
    else
        return majority_vote(votes)
    end
end

Is there any particular reason why condition is not T <: AbstractFloat? Also, the documentation noted that regression choosed when labels/targets of type Float, not Float64.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions