ValueError when calling activity_classifier.create(...) method

64 Views Asked by At

I am using TuriCreate to create model to classify a human activity, but I get error when I try to run activity_classifier.create(...) method.


Code

This is what I did:

  1. Load all data:
train_sf = tc.SFrame("data/cleaned_train_sframe")
valid_sf = tc.SFrame("data/cleaned_valid_sframe")
test_sf = tc.SFrame("data/cleaned_test_sframe")
  1. Dividing the SFrame randomly into two smaller SFrames:
train, valid = tc.activity_classifier.util.random_split_by_session(train_sf, session_id='sessionId', fraction=0.9)
  1. Trying to build and train my model:
model = tc.activity_classifier.create(dataset=train_sf,
                                      session_id='sessionId',
                                      target='activity',
                                      features=["rotX", "rotY", "rotZ", "accelX", "accelY", "accelZ"],
                                      prediction_window=50,
                                      validation_set=valid_sf,
                                      max_iterations=20)

Error

The third step raise the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [34], in <cell line: 1>()
----> 1 model = tc.activity_classifier.create(dataset=train_sf,
      2                                       session_id='sessionId',
      3                                       target='activity',
      4                                       features=["rotX", "rotY", "rotZ", "accelX", "accelY", "accelZ"],
      5                                       prediction_window=50,
      6                                       validation_set=valid_sf,
      7                                       max_iterations=20)

File ~/Desktop/PFG/lib/python3.8/site-packages/turicreate/toolkits/activity_classifier/_activity_classifier.py:200, in create(dataset, session_id, target, features, prediction_window, validation_set, max_iterations, batch_size, verbose, random_seed)
    197 options["_show_loss"] = False
    198 options["random_seed"] = random_seed
--> 200 model.train(dataset, target, session_id, validation_set, options)
    201 return ActivityClassifier(model_proxy=model, name=name)

File ~/Desktop/PFG/lib/python3.8/site-packages/turicreate/extensions.py:305, in _ToolkitClass.__getattr__.<locals>.<lambda>(*args, **kwargs)
    302     return _wrap_function_return(self._tkclass.get_property(name))
    303 elif name in self._functions:
    304     # is it a function?
--> 305     ret = lambda *args, **kwargs: self.__run_class_function(name, args, kwargs)
    306     ret.__doc__ = (
    307         "Name: " + name + "\nParameters: " + str(self._functions[name]) + "\n"
    308     )
    309     try:

File ~/Desktop/PFG/lib/python3.8/site-packages/turicreate/extensions.py:290, in _ToolkitClass.__run_class_function(self, fnname, args, kwargs)
    288 # unwrap it
    289 try:
--> 290     ret = self._tkclass.call_function(fnname, argument_dict)
    291 except RuntimeError as exc:
    292     # Expose C++ exceptions using ToolkitError.
    293     raise _ToolkitError(exc)

File cy_model.pyx:35, in turicreate._cython.cy_model.UnityModel.call_function()

File cy_model.pyx:40, in turicreate._cython.cy_model.UnityModel.call_function()

ValueError: stod: no conversion

Does anyone know what the problem could be?

1

There are 1 best solutions below

0
On

You can get passed this issue by setting the validation_set to None.

This does mean that you have no validation, but at least you can create your model.