indeed it works this way! thanks a lot!
I guess I was feeding in the wrong data types…
Here’s my code, and there are probably a lot of more than awkward things… If anyone has the time to comment on that, that would be much helpful. I was trying to use the iris dataset:
import tensorflow_decision_forests as tfdf
import pandas as pd
from sklearn.datasets import load_iris
data2 = load_iris(as_frame=True)
df = pd.DataFrame(data = data2.data)
allcol = df.columns
i = 0
for cn in allcol:
  df =df.rename(columns={cn:str(i)})
  i +=1

df_class = pd.DataFrame(data = data2.target)
complete_df = pd.concat([df, df_class], axis=1)
complete_df = complete_df.sample(frac=1)
train_df = complete_df[:100]
test_df = complete_df[100:]
train_ds = tfdf.keras.pd_dataframe_to_tf_dataset(train_df, label="target")
test_ds = tfdf.keras.pd_dataframe_to_tf_dataset(test_df, label="target")

model = tfdf.keras.RandomForestModel()
model.fit(train_ds)
Xtest = test_df.iloc[:,:4]
ytest = test_df.iloc[:,4]
y_hats = model.predict(Xtest)

Thanks a lot
Cristelle