@@ -198,6 +198,7 @@ from slim_gsgp.main_slim import slim # import the slim_gsgp library
198198from slim_gsgp.datasets.data_loader import load_ppb # import the loader for the dataset PPB
199199from slim_gsgp.utils.utils import train_test_split # import the train-test split function
200200from sklearn.metrics import accuracy_score
201+ from slim_gsgp.config.slim_config import fitness_function_options
201202
202203# Defining the new fitness function
203204def binarized_rmse (binarizer ):
@@ -214,7 +215,7 @@ def modified_sigmoid( scaling_factor):
214215 return ms
215216
216217binarizer = modified_sigmoid(1 )
217- fitness = binarized_rmse(binarizer )
218+ fitness_function_options[ ' binarized_rmse ' ] = binarized_rmse(binarized )
218219
219220
220221# Defining the converter for the final tree
@@ -246,7 +247,7 @@ X_val, X_test, y_val, y_test = train_test_split(X_test, y_test, p_test=0.5)
246247final_tree = slim(X_train = X_train, y_train = y_train,
247248 X_test = X_val, y_test = y_val,
248249 dataset_name = ' ppb' , slim_version = ' SLIM+ABS' , pop_size = 100 , n_iter = 100 ,
249- ms_lower = 0 , ms_upper = 1 , p_inflate = 0.5 , fitness_function = fitness )
250+ ms_lower = 0 , ms_upper = 1 , p_inflate = 0.5 , fitness_function = ' binarized_rmse ' )
250251
251252# Show the best individual structure at the last generation
252253final_tree.print_tree_representation()
0 commit comments