slim_gsgp.algorithms.GSGP

slim_gsgp.algorithms.GSGP.gsgp

Geometric Semantic Genetic Programming (GSGP) module.

class slim_gsgp.algorithms.GSGP.gsgp.GSGP(pi_init, initializer, selector, mutator, ms, crossover, find_elit_func, p_m=0.8, p_xo=0.2, pop_size=100, seed=0, settings_dict=None)[source]

Bases: object

Geometric Semantic Genetic Programming class.

solve(X_train, X_test, y_train, y_test, curr_dataset, n_iter=20, elitism=True, log=0, verbose=0, test_elite=False, log_path=None, run_info=None, ffunction=None, reconstruct=False, n_elites=1, n_jobs=1)[source]

Execute the GSGP algorithm.

Parameters:
  • X_train (torch.Tensor) – Training data features.

  • X_test (torch.Tensor) – Test data features.

  • y_train (torch.Tensor) – Training data labels.

  • y_test (torch.Tensor) – Test data labels.

  • curr_dataset (str) – Current dataset name.

  • n_iter (int) – Number of iterations.

  • elitism (bool) – Whether to use elitism.

  • log (int) – Logging level. Default is 0.

  • verbose (int) – Verbosity level. Default is 0.

  • test_elite (bool) – Whether to evaluate elite individuals on test data. Default is False.

  • log_path (str) – Path to save logs. Default is None.

  • run_info (list) – Information about the current run. Default is None.

  • ffunction (callable) – Fitness function. Default is None.

  • reconstruct (bool) – Whether to reconstruct trees. Default is False.

  • n_elites (int) – Number of elites. Default is 1.

  • n_jobs (int) – The maximum number of jobs for parallel processing. Default is 1.