You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using RDatasets, LIBLINEAR
# Load Fisher's classic iris data
iris =dataset("datasets", "iris")
# LIBSVM handles multi-class data automatically using a one-against-one strategy
labels =convert(Vector, iris[:Species])
# First dimension of input data is features; second is instances
inst =convert(Matrix, iris[:, 1:4])'
wei =unique(labels[1:2:end])
model =linear_train(labels[1:2:end], inst[:, 1:2:end]; weights=Dict(wei[1]=>0.5, wei[2]=>1., wei[3] =>3.), verbose=true)
output:
ERROR: MethodError: no method matching grp2idx(::Type{Int32}, ::Base.KeySet{CategoricalString{UInt8},Dict{CategoricalString{UInt8},Float64}}, ::Dict{CategoricalString{UInt8},Int32}, ::Array{CategoricalString{UInt8},1})
Closest candidates are:
grp2idx(::Type{S<:Real}, ::AbstractArray{T,1} where T, ::Dict{T,Int32}, ::Array{T,1}) where {T, S<:Real} at /home/tas/.julia/packages/LIBLINEAR/xcSKN/src/LIBLINEAR.jl:115
Stacktrace:
[1] indices_and_weights(::Array{CategoricalString{UInt8},1}, ::Array{Float64,2}, ::Dict{CategoricalString{UInt8},Float64}) at /home/tas/.julia/packages/LIBLINEAR/xcSKN/src/LIBLINEAR.jl:149
[2] #linear_train#1(::Dict{CategoricalString{UInt8},Float64}, ::Int32, ::Float64, ::Float64, ::Float64, ::Ptr{Float64}, ::Float64, ::Bool, ::typeof(linear_train), ::Array{CategoricalString{UInt8},1}, ::Array{Float64,2}) at /home/tas/.julia/packages/LIBLINEAR/xcSKN/src/LIBLINEAR.jl:235
[3] (::getfield(LIBLINEAR, Symbol("#kw##linear_train")))(::NamedTuple{(:weights, :verbose),Tuple{Dict{CategoricalString{UInt8},Float64},Bool}}, ::typeof(linear_train), ::Array{CategoricalString{UInt8},1}, ::Array{Float64,2}) at ./none:0
[4] top-level scope at none:0
The text was updated successfully, but these errors were encountered:
The weights key on linear_train is not working.
output:
The text was updated successfully, but these errors were encountered: