MCPcopy
hub / github.com/trevorstephens/gplearn / raw_fitness

Method raw_fitness

gplearn/_program.py:441–467  ·  view source on GitHub ↗

Evaluate the raw fitness of the program according to X, y. Parameters ---------- X : {array-like}, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-

(self, X, y, sample_weight)

Source from the content-addressed store, hash-verified

439 return self.get_all_indices()[0]
440
441 def raw_fitness(self, X, y, sample_weight):
442 """Evaluate the raw fitness of the program according to X, y.
443
444 Parameters
445 ----------
446 X : {array-like}, shape = [n_samples, n_features]
447 Training vectors, where n_samples is the number of samples and
448 n_features is the number of features.
449
450 y : array-like, shape = [n_samples]
451 Target values.
452
453 sample_weight : array-like, shape = [n_samples]
454 Weights applied to individual samples.
455
456 Returns
457 -------
458 raw_fitness : float
459 The raw fitness of the program.
460
461 """
462 y_pred = self.execute(X)
463 if self.transformer:
464 y_pred = self.transformer(y_pred)
465 raw_fitness = self.metric(y, y_pred, sample_weight)
466
467 return raw_fitness
468
469 def fitness(self, parsimony_coefficient=None):
470 """Evaluate the penalized fitness of the program according to X, y.

Callers 2

_parallel_evolveFunction · 0.80
test_all_metricsFunction · 0.80

Calls 1

executeMethod · 0.95

Tested by 1

test_all_metricsFunction · 0.64