Passing Parameter Values using a dictionary

question

#1

I am trying to use a DecisionTree classifer and have specified the parameter value using a dicitonary. See below. An error is thrown when i try to do that

# build a classifier
dtclf = DecisionTree.DecisionTreeClassifier()

# run randomized search
nfold=5
dt_search = RandomizedSearchCV(dtclf, param_grid, n_iter=n_iters,cv=nfold, scoring=scorer,
                random_state=MersenneTwister(123));
DecisionTree.fit!(dt_search, X_train0, y_train0)
dict=dt_search.best_params_
model=DecisionTreeClassifier(dict)

MethodError: no method matching DecisionTreeClassifier(::Dict{Symbol,Any})
Closest candidates are:
  DecisionTreeClassifier(; pruning_purity_threshold, max_depth, min_samples_leaf, min_samples_split, min_purity_increase, n_subfeatures, rng, root, classes) at C:\Users\chatura\.julia\packages\DecisionTree\wpdwP\src\scikitlearnAPI.jl:42

Stacktrace:
 [1] top-level scope at In[152]:1

#2

I could serach the approach on web. It work likes this.

model2=DecisionTreeClassifier(;dict...)