JuliaAI / JuliaAI/DecisionTree.jl

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

Open
#225 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
364
Forks
100
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the apply_forest function shown in the issue and inspect how label types select regression versus classification. Compare the Float64 condition with the documentation's claim about Float labels; done means the implementation and documentation consistently describe and handle the supported regression label types.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.