JuliaML / MLDataUtils.jl

Utility package for generating, loading, splitting, and processing Machine Learning datasets
http://mldatautilsjl.readthedocs.io/
Other
102 stars 20 forks source link

syntax: extra token "LinearFunction" after end of expression #49

Open robwebbjr opened 5 years ago

robwebbjr commented 5 years ago

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 commented 5 years ago

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.