Network.evolve() crash at start: "TypeError: Cannot read property 'join' of undefined"
See original GitHub issueDescription
This may be pilot error, but I can’t figure out what’s going wrong.
Network.evolve() (v0.3.12+) crashes immediately with the error:
Trace: TypeError: Cannot read property ‘join’ of undefined at new c (/node_modules/@liquid-carrot/carrot/dist/carrot.commonjs2.min.js:36:128039) at p.evolve (/node_modules/@liquid-carrot/carrot/dist/carrot.commonjs2.min.js:36:92265)
Files
carrot.commonjs2.min.js (carrot.commonjs2.js)
To Reproduce
The confusing thing is that Network.evolve() will run the XOR example, even using the same options for when it fails. I include the XOR test in the same code as the failing evolve.
When it fails, it’s evolving a network of >1500 inputs and 3 outputs, as opposed to the XOR’s 2-in, 1-out.
An example of the options passed to evolve() is below. Note that the options are generated randomly, but still fails consistently:
EVOLVE OPTIONS ├─ activation: IDENTITY ├─ amount: 1 ├─ clear: true ├─ cost: BINARY ├─ efficient_mutation: true ├─ elitism: 2 ├─ equal: true ├─ error: 0.03 ├─ growth: 0.00009019971047429265 ├─ iterations: 10 ├─ log: 1 ├─ mutation: FFW ├─ mutation_amount: 1 ├─ mutation_rate: 0.5762620321953104 ├─ popsize: 50 ├─ population_size: 50 ├─ provenance: 0 ├─ schedule │ └─ iterations: 1 └─ threads: 1
Also note that activation, cost, mutation and schedule values are converted to the proper functions/array before evolve().
I’ve checked and double-checked the input data set for proper formatting and data types.
I don’t have this problem using 0.3.11.
I think the problem is in the TestWorker function:
function TestWorker (serialized_dataset, cost_function) {
// find out if in inspect mode. if so then run children in inspect mode as well
const argv = process.execArgv.join();
const is_debug = argv.includes('inspect') || argv.includes('debug');
if (is_debug) {
this.worker = cp.fork(path.join(__dirname, '/worker'), [], {
execArgv: ['--inspect=' + (fork_port++)],
});
} else {
this.worker = cp.fork(path.join(__dirname, '/worker'));
}
const cost_is_standard = cost_function.name in standard_cost_functions;
// send the initialization (ie 'constructor') info
this.worker.send({
serialized_dataset: serialized_dataset,
cost_function: cost_is_standard ? cost_function.name : cost_function.toString(),
cost_is_standard,
});
}
specifically:
const argv = process.execArgv.join();
where process.execArgv is undefined.
I notice that lots of restructuring happened from 0.3.11 to 0.3.12. Is there something that I need to do to make sure the module is (re)built?
Any help appreciated! Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
I’ll try the update. If it still fails, I’ll post some code.
Thanks for the quick reply!
Confirmed working as of
v0.3.16
using this test:Noting here that
carrot
is quite a bit slower thanneataptic
right now (converges in less generations though). The main culprit is likely Lodash’sdeepClone
method inside ofNetwork.clone
which used heavily in.evolve
– working on resolving this by solving https://github.com/liquidcarrot/carrot/issues/152The approach in https://github.com/liquidcarrot/carrot/issues/152#issuecomment-527934142 is the likely go-to