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
I'm trying to use SelectFromModel with RadomForestClassifier. There is support for that on ScickitLearn in Julia?
using RDatasets: dataset
using ScikitLearn, DecisionTree
iris =dataset("datasets", "iris")
X =convert(Array, iris[[:SepalLength, :SepalWidth, :PetalLength, :PetalWidth]])
y =convert(Array, iris[:Species])
@sk_import ensemble: RandomForestClassifier
@sk_import feature_selection: SelectFromModel
rfc =RandomForestClassifier(n_subfeatures=30, n_trees=350, partial_sampling =0.4, min_purity_increase =0.001)
sfm =SelectFromModel(rfc)
fit!(sfm, X, y)
I get the following error:
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("Cannot clone object '<PyCall.jlwrap RandomForestClassifier\nn_trees: 350\nn_subfeatures: 30\npartial_sampling: 0.4\nmax_depth: -1\nmin_samples_leaf: 1\nmin_samples_split: 2\nmin_purity_increase: 0.001\nclasses: ensemble: >' (type <class 'PyCall.jlwrap'>): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.")
File "/home/tas/.julia/conda/3/lib/python3.7/site-packages/sklearn/feature_selection/from_model.py", line 195, in fit
self.estimator_ = clone(self.estimator)
File "/home/tas/.julia/conda/3/lib/python3.7/site-packages/sklearn/base.py", line 60, in clone
% (repr(estimator), type(estimator)))
Stacktrace:
[1] pyerr_check at /home/tas/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/tas/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
[3] macro expansion at /home/tas/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Array{Float64,2},Array{String,1}}, ::Int64, ::Ptr{Nothing}) at /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
[6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Array{Float64,2},Array{String,1}}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11
[7] #call#111(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::PyCall.PyObject, ::Array{Float64,2}, ::Vararg{Any,N} where N) at /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
[8] (::PyCall.PyObject)(::Array{Float64,2}, ::Vararg{Any,N} where N) at /home/tas/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
[9] #fit!#31(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::PyCall.PyObject, ::Array{Float64,2}, ::Vararg{Any,N} where N) at /home/tas/.julia/packages/ScikitLearn/bo2Pt/src/Skcore.jl:100
[10] fit!(::PyCall.PyObject, ::Array{Float64,2}, ::Array{String,1}) at /home/tas/.julia/packages/ScikitLearn/bo2Pt/src/Skcore.jl:100
[11] top-level scope at none:0
PS: There is no issue if I use RandomForestClassifier from ScikitLearn.
The text was updated successfully, but these errors were encountered:
I'm trying to use SelectFromModel with RadomForestClassifier. There is support for that on ScickitLearn in Julia?
I get the following error:
PS: There is no issue if I use RandomForestClassifier from ScikitLearn.
The text was updated successfully, but these errors were encountered: