Error in Array

ERROR: TypeError: fitdbm: in typeassert, expected Array{Int64,1}, got Array{Int64,2}
in trainpartdbm

function trainpartdbm(mat;partitions::Array{Array{Int64,1},1}=[collect(1:size(mat)[2])],
nhiddens::Array{Int64,1}=[size(mat)[2],div(size(mat)[2],10)],
epochs::Int64=20,
nparticles::Int64=100,
learningrate::Float64=0.005)

partDBMS = Vector{BoltzmannMachines.BasicDBM}()
nhiddensmat = partitionhiddens(partitions,nhiddens)
println(nhiddensmat)
 for i=1:length(partitions)
    partx = mat[:,partitions[i]]
    
    pdbm = BoltzmannMachines.fitdbm(partx,
                                    nhiddens=nhiddensmat[i,:],
                                    epochs =epochs,
                                    nparticles=nparticles,
                                    learningrate=learningrate
                                    )
    push!(partDBMS,pdbm)
end
jointdbm = BoltzmannMachines.joindbms(partDBMS,partitions)
jointdbm,partDBMS

end
end

Kinsly suggest me how to solve it. Thanks in advance

expected Array{Int64,1}, got Array{Int64,2}

This means that you are passing a matrix (an Array{Int64, 2} which is the same as a Matrix{Int64}) to a function which expects a vector (an Array{Int64, 1} which is the same as a Vector{Int64}).

However, without being able to see the full inputs or error message, it’s difficult to say how to fix it. Please take a look at Please read: make it easier to help you

3 Likes