ValueError в CoreMLTools при преобразовании модели sklearn в coreml - PullRequest
0 голосов
/ 28 августа 2018

coremltools sklearn converter при преобразовании модели логистической регрессии, которую он дает

ValueError: Все метки класса должны иметь тип int или все строки типа.

Вот код из раздела coremltools

coreml_model = coremltools.converters.sklearn.convert(clf_rgb,
    ["h","Cr","Cb","A","U","V","B"],"skin")

Полная трассировка стека

--------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-80-2ea49666c38c> in <module>()
----> 1 coreml_model = coremltools.converters.sklearn.convert(clf_rgb,["h","Cr","Cb","A","U","V","B"],"skin")

/usr/local/lib/python3.6/site-packages/coremltools/converters/sklearn/_converter.py in convert(sk_obj, input_features, output_feature_names)
    144     from ._converter_internal import _convert_sklearn_model
    145     spec = _convert_sklearn_model(
--> 146             sk_obj, input_features, output_feature_names, class_labels = None)
    147 
    148     return MLModel(spec)

/usr/local/lib/python3.6/site-packages/coremltools/converters/sklearn/_converter_internal.py in _convert_sklearn_model(input_sk_obj, input_features, output_feature_names, class_labels)
    270 
    271         output_features = _fm.process_or_validate_classifier_output_features(
--> 272                 output_feature_names, class_labels, supports_output_scores)
    273 
    274     elif overall_mode == "regressor":

/usr/local/lib/python3.6/site-packages/coremltools/models/_feature_management.py in process_or_validate_classifier_output_features(output_features, class_labels, supports_class_scores)
     42 
     43     else:
---> 44         raise ValueError('Class labels must be all of type int or all of type string.')
     45 
     46     if output_features is None:

ValueError: Class labels must be all of type int or all of type string.
...