lar*_*ara 4 export decision-tree julia
我使用DecisionTree模块在Julia中训练了一个修剪过的决策树模型.我现在想要保存此模型以便稍后在其他数据集上使用.
我已经尝试使用writetable()将模型转换为数据数组以便导出,并且我尝试使用writedlm()进行导出,但这些都不起作用.当我查看模型的类型时,我发现它是DecisionTree.Node类型.我不知道如何使用它,无法导出/保存.
In:DataFrame(PrunedModel)
Out:LoadError: MethodError: `convert` has no method matching convert(::Type{DataFrames.DataFrame}, ::DecisionTree.Node)
This may have arisen from a call to the constructor DataFrames.DataFrame(...),
since type constructors fall back to convert methods.
Closest candidates are:
call{T}(::Type{T}, ::Any)
convert(::Type{DataFrames.DataFrame}, !Matched::Array{T,2})
convert(::Type{DataFrames.DataFrame}, !Matched::Dict{K,V})
...
while loading In[22], in expression starting on line 1
in call at essentials.jl:56
In:typeof(PrunedModel)
Out:DecisionTree.Node
Run Code Online (Sandbox Code Playgroud)
我有什么想法可以保存这个模型以供日后使用?
如果我正确理解这是一个Julia对象,您应该尝试使用JLD.jl包将对象保存到磁盘并重新加载,保留类型信息.
| 归档时间: |
|
| 查看次数: |
156 次 |
| 最近记录: |