MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / selectFittest

Function selectFittest

examples/machine_learning/geneticalgorithm.cpp:24–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24array selectFittest(const array& sampleZ, const int nSamples,
25 const float topFit = DefaultTopFittest) {
26 // pick top fittest
27 array indices, values;
28 sort(values, indices, sampleZ);
29 int topFitElem = topFit * nSamples;
30 int n = indices.elements();
31 return (n > topFitElem) ? indices(seq(n - topFitElem, n - 1)) : indices;
32}
33
34void reproduce(array& searchSpace, array& sampleX, array& sampleY,
35 array& sampleZ, const int nSamples, const int n) {

Callers 1

reproduceFunction · 0.85

Calls 3

seqClass · 0.85
sortFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected