On Sat, 2016-11-19 at 12:46, Sebastian <
in...@quandbee.com> wrote:
> I am new to julia so i might ask a strange question.
> So far i've been programming quite smoothly, but type managing leads me
> astray.
Good to have you on board! Note that most discussion has moved to
https://discourse.julialang.org/, better post there in the future.
> I have 1d arrays i want to apply a confusion matrix function to from the
> MLBase library.
>
http://mlbasejl.readthedocs.io/en/latest/perfeval.html
>
> However i have unmatching types.
>
> typeof(y1)
>
> Array{String,1}:
>
> typeof(y2)
> Array{Any,1}
>
>
> When i apply the confusion matrix on those variables:
>
> k=4
> confusmat(k, y1, y2)
>
>
> i get:
>
> LoadError: MethodError: no method matching confusmat(::Int64,
> ::Array{String,1}, ::Array{Any,1})
> Closest candidates are:
>
>
>
> So now i probably need to convert y2 to a Array{String,1}
> I can't find out how to convert y2 to Array{String,1}
> Can anyone please help?
julia> Any["dasf"]
1-element Array{Any,1}:
"dasf"
julia> convert(Vector{String}, ans)
1-element Array{String,1}:
"dasf"
But probably you should make sure that y2 is Vector{String} from the
start. (Note Vector{String}==Array{String,1})