A quick and free library for MT4, much to the delight of neuralnetworkers - page 14

 

I have now tested the EA and caught this

2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:28 2009.09.04 13:00 n5_test EURUSD,H1: 1024
2009.12.24 23:04:27 2009.09.04 12:00 n5_test EURUSD,H1: 1023
2009.12.24 23:04:26 2009.09.04 11:00 n5_test EURUSD,H1: 1022


These numbers are what the code returns:

a = f2M_create_standard (nn_layer,nn_input,nn_hidden1,nn_hidden2,nn_output);
Print(a);

The grid ID thus increases to 1024 and then the system refuses to create a new grid

The f2M_destroy(ann[i]) function does not destroy any grids! This is the assumption...

 
Kharin писал(а) >>

However, function f2M_destroy(ann[i]) does not destroy any grids! That's the assumption...

Alexander, have you tried f2M_destroy_all_anns();

Maybe there will be a difference in the performance?

 

Yeah, tried it now, looks like one problem has been localised...

I. - I put static int AnnsNumber = 1027 in EA;

- I deleted everything from the ANN folder and cleaned the log.

- I can see from the log, networks with indices from 7 to 1024 are created.

- Networks are saved in files with numbers from .1017.net to .0.net.

I repeated this sequence several times and nothing changes.

I am attaching the log of the first variant.

.

===========================

II. I inserted f2M_destroy_all_anns(); at the beginning of init(); and the situation cardinally changed for the better, only one malfunction appeared at the end

22:44:41 2008.07.31 23:59 FANN-EA_tmp USDJPY,M5: f2M_save(1, E:\ANN\USDJPY-870.1.net) returned: 0
22:44:41 2008.07.31 23:59 FANN-EA_tmp USDJPY,M5: f2M_destroy(1) returned: 0
22:44:41 2008.07.31 23:59 FANN-EA_tmp USDJPY,M5: f2M_save(0, E:\ANN\USDJPY-870.0.net) returned: -1
22:44:41 2008.07.31 23:59 FANN-EA_tmp USDJPY,M5: f2M_destroy(0) returned: -1

The zero grid didn't save, while 1024.net did. But that's the little things )))

Files:
fanneea_tmp.zip  18 kb
 
Dali писал(а) >>

Someone has uncommented all the options. There are no such errors in the code from CVS.

Question: Who deployed FANN2MQL how?

By installer? By hand from official site? By any other means?

Maybe all of us are victims of an anti network conspiracy? )

 
Henry_White писал(а) >>

I'm going to add to the list of FANN oddities too...

For the sake of experiment, decided to train a committee of 46 nets of 30/N/N/1 dimension by bruteforcing (i.e. on each bar: ~300k).

Please clarify. Do each of the 46 nets have different outputs?

What is the range of scales?

If possible, attach a profile of one committee grid.

 
Kharin >> :

I have now tested the EA and caught this

2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:29 2009.09.04 14:00 n5_test EURUSD,H1: -1
2009.12.24 23:04:28 2009.09.04 13:00 n5_test EURUSD,H1: 1024
2009.12.24 23:04:27 2009.09.04 12:00 n5_test EURUSD,H1: 1023
2009.12.24 23:04:26 2009.09.04 11:00 n5_test EURUSD,H1: 1022


These numbers are what the code returns:

a = f2M_create_standard (nn_layer,nn_input,nn_hidden1,nn_hidden2,nn_output);
Print(a);

The network ID thus increases to 1024 and then the system refuses to create a new grid

The f2M_destroy(ann[i]) function does not destroy any grids! This is an assumption...

So it's defined in the library itself :


#ifdef FANN2MQL_EXPORTS
#define FANN2MQL_API __declspec(dllexport)
#else
#define FANN2MQL_API __declspec(dllimport)
#endif

/* maximum number of concurrently handled networks */
#define ANNMAX	1024

....................................................


/* array of FANN network structures */
extern struct fann *_fanns[ ANNMAX];
/* array of output values of networks */
extern double* _outputs[ ANNMAX];
/* index to last allocated network */
extern int _ann;
 
Kharin >> :


Function f2M_destroy(ann[i]) doesn't destroy any nets! Here is such an assumption...

The function itself :


DLLFUNC int __stdcall f2M_destroy(int ann)
{
	int i, last_null=_ann-1;

	/* this network is not allocated */
	if ( ann<0 || ann>_ann || _fanns[ ann]==NULL) return (-1);

	/* destroy */
	fann_destroy(_fanns[ ann]);

	/* clear the pointers */
	_fanns[ ann]=NULL;
	_outputs[ ann]=NULL;

	/* let reuse the handlers if last */
	if ( ann==_ann) {
		_ann--;

		/* look if we can recover any more handlers */
		for ( i=_ann; i>-1; i--) {
			if (_fanns[ i]==NULL) {
				_ann--;
			} else {
				break;
			}
		}
	}

	return 0;
}

The memory is released.

FANN_EXTERNAL void FANN_API fann_destroy(struct fann * ann)
{
	if( ann == NULL)
		return;
	fann_safe_free( ann-> weights);
	fann_safe_free( ann-> connections);
	fann_safe_free( ann-> first_layer-> first_neuron);
	fann_safe_free( ann-> first_layer);
	fann_safe_free( ann-> output);
	fann_safe_free( ann-> train_errors);
	fann_safe_free( ann-> train_slopes);
	fann_safe_free( ann-> prev_train_slopes);
	fann_safe_free( ann-> prev_steps);
	fann_safe_free( ann-> prev_weights_deltas);
	fann_safe_free( ann-> errstr);
	fann_safe_free( ann-> cascade_activation_functions);
	fann_safe_free( ann-> cascade_activation_steepnesses);
	fann_safe_free( ann);
}
#define fann_safe_free(x) {if(x) { free(x); x = NULL; }}

Good luck.

The problem may arise if you destroy nets in random order or from first to last. You need to destroy nets from last to last, i.e. in reverse order of how they were created.

 
VladislavVG писал(а) >>

The problem may arise if you destroy nets randomly or from first to last. It should be from last to last - that is, in reverse order of how the nets were created.

Let me add. Or in case of terminal crash. But the solution seems to have been found.

The question is different. Vladislav, I think you read C++ code without "intermediaries".

Could you comment on the problem with identical grid committee responses and correct initialization of weights values? (detailed here and also logs, and here a question on weights)

 

lasso and VladislavVG

Thank you very much

 
lasso >> :

Please clarify. Are the outputs of each of the 46 networks different?

What is the size range of the weights?

If possible, attach a profile of one committee grid.

Yes. The inputs are different for each grid, although this is not crucial. You can take a standard signal, e.g. the same RSI and one grid, and still get negative values on bruteforce for any inputs.

Initial initialisation of weights -1, 1.

About the profile... Do you mean the resulting file of the trained network?

Reason: