0

When I enter df.dtypes, this is the output I get. All of the 5 variables are numbers, though I get another dtype at the bottom that says object. Could someone pls tell me what is happening here and why I get that dtype as an object?

When I feed this to a regression NN, with the x variables being doc and feed to predict the hardness and ra, I get an error saying that the y value provided is not an int type, but an object.

feed        float64
doc           int64
hardness    float64
temp        float64
ra          float64
dtype: object

i have tried all of convering this df into ints and yet, the dtype at the bottom is always an object.

This is the exact error;

TypeError: in user code:

c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\engine\training.py:571 train_function  *
    outputs = self.distribute_strategy.run(
c:\users\offic\venv\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:951 run  **
    return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
c:\users\offic\venv\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2290 call_for_each_replica
    return self._call_for_each_replica(fn, args, kwargs)
c:\users\offic\venv\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2649 _call_for_each_replica
    return fn(*args, **kwargs)
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\engine\training.py:532 train_step  **
    loss = self.compiled_loss(
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:205 __call__
    loss_value = loss_obj(y_t, y_p, sample_weight=sw)
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\losses.py:143 __call__
    losses = self.call(y_true, y_pred)
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\losses.py:246 call
    return self.fn(y_true, y_pred, **self._fn_kwargs)
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\losses.py:433 __init__
    super(MeanAbsolutePercentageError, self).__init__(
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\losses.py:229 __init__
    super(LossFunctionWrapper, self).__init__(reduction=reduction, name=name)
c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\losses.py:94 __init__
    losses_utils.ReductionV2.validate(reduction)
c:\users\offic\venv\lib\site-packages\tensorflow\python\ops\losses\loss_reduction.py:67 validate
    if key not in cls.all():
c:\users\offic\venv\lib\site-packages\tensorflow\python\ops\math_ops.py:1491 tensor_equals
    return gen_math_ops.equal(self, other, incompatible_shape_error=False)
c:\users\offic\venv\lib\site-packages\tensorflow\python\ops\gen_math_ops.py:3222 equal
    _, _, _op, _outputs = _op_def_library._apply_op_helper(
c:\users\offic\venv\lib\site-packages\tensorflow\python\framework\op_def_library.py:475 _apply_op_helper
    raise TypeError(

TypeError: Expected float32 passed to parameter 'y' of op 'Equal', got 'auto' of type 'str' instead. Error: Expected float32, got 'auto' of type 'str' instead.
Akshay Ram
  • 25
  • 9

0 Answers0