I am building a CatBoost model to simulate the federated learning system at first I am training the local models on the same Catboost model using a for loop code:
for j in range(len(Train_Datasets)):
df_train= Train_Datasets[j]
df_test= Test_Datasets[j]
x_train = df_train.drop(['index', 'binary_attack'], axis=1)
x_test = df_test.drop(['index', 'binary_attack'], axis=1)
y_train = df_train['binary_attack']
y_test = df_test["binary_attack"]
local_model = CatBoostClassifier(**params)
local_model.fit(x_train, y_train)
Later I am appending all the local models and sum them using Sum_model function from the Catboost package:
models.append(local_model)
global_model = sum_models(models, weights=0.7)
global_model= to_classifier(global_model)
I am getting this error whenever I add the weights=0.7 parameter:
TypeError: object of type 'float' has no len()
However, I tried once the same code with adding the weights parameter, and it worked. Do you have any suggestions on what might be the problem?