MLDataUtils.jl icon indicating copy to clipboard operation
MLDataUtils.jl copied to clipboard

syntax: extra token "LinearFunction" after end of expression

Open robwebbjr opened this issue 5 years ago • 1 comments

Hi. I'm following the Getting Started tutorial and the following code for defining the Iris classifying model returns the error shown in the title. I'm new to Julia, and a brief search of the docs seems to indicate that I should not use "immutable" when defining an object. Please let me know what the solution is. Thanks.

immutable LinearFunction θ::Vector{Float64} end

(h::LinearFunction)(x::AbstractVector) = dot(x, h.θ)

EDIT TO ADD: Also, there is no definition for the 'dot()' function, so I get an UndefVarError when I run

h(getobs(X, 1))

I am going to assume that dot() is supposed to be an inner product, so I will try to define the function myself; this is just my guess, as I am just learning ML.

robwebbjr avatar Sep 10 '19 21:09 robwebbjr

OK, so it looks like I just need to use the 'struct' keyword instead of 'immutable' and also run 'using LinearAlgebra' to rectify the original issues. Please modify the tutorial to address these issues. I will not open new issues if I find more like this, so maybe when you have time you could do a general review of the tutorial material for accuracy; it's extra difficult to learn an already difficult subject when the training materials are inaccurate. None the less, thank you for making MLDataUtils, I do appreciate all the hard work that goes into making awesome software. I will close the issue after hearing back from you.

robwebbjr avatar Sep 10 '19 21:09 robwebbjr