Dear all,

I am using Scikit-Learn library and I want to weight all training samples
(according to unbalanced data). According to the tutorial and what I found
in the web, I should use this method:

search = RandomizedSearchCV(estimator, param_distributions,
n_iter=args.iterations, scoring=mae_scorer,n_jobs=1, refit=True,
cv=KFold(X_train.shape[0],
10, shuffle=True, random_state=args.seed), verbose=1,
random_state=args.seed, fit_params={'sample_weight': weights_array})

search.fit(X_trains, y_train)

where "wights_array" is an array containing the weight of each training
sample. After running the code, I was stopped with the following exception:

ValueError: operands could not be broadcast together with shapes (1118,)
(1006,) (1118,)

It is worth noting that the size of "X_trains", "y_train", and
"weights_array" are equal to 1118.

When I changed the number of folds from 10 to 2, the exception was changed
to this one:

ValueError: operands could not be broadcast together with shapes (1118,)
(559,) (1118,)

Do you know what is the problem? I guess the problem is with "KFold"
method. Any idea is appreciated.

Kind Regards,
Hamed
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to