PureBytes Links
Trading Reference Links
|
Thanks for the reply Matt. No I am not using AFL code and in my opinion it
should make no difference if I am using MSVC++ or Bloodshed's Dev-C++. Any
way, in case you have time to finish the FANN version for the AB plugin
please put the result on this Forum ...
Regards, Ton.
----- Original Message -----
From: "Matt Busigin" <mbusigin-yahoo@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, February 19, 2008 1:52 PM
Subject: Re: [amibroker] NEURAL ANALYSIS IN AMIBROKER
> This code is not AFL - it is C code, and the header files are C headers
> (with the exception of iostream, which is a C++ header). The only way
> you will get this to work is by using a C compiler (Microsoft Visual C++
> or GNU C are most common, both which can be had for free -
> http://www.microsoft.com/express/vc/).
>
> I have written a neural net plugin for AB based on the well regarded
> FANN library which I was planning on atleast partially releasing, but
> time constraints on me from my day job and having higher priorities on
> my family have retarded the polishing and release process...
>
>
>
> Regards,
> Matt
>
>
> Ton Sieverding wrote:
> >
> > Correct Prashanth. That's more or less where I left this AFL a year
> > ago. Missing all kinds of .h includes to run it. I've tried to find
> > the includes in my C++ stuff but failed ... Perhaps I should give it
> > another try on the www ...
> >
> > Regards, Ton.
> >
> >
> >
> >
> > > > #include <math.h>
> > > > #include <stdlib.h>
> > > > #include <iostream>
> > > > double input_hidden_weights[5][6]=
> > > > {
> > > > {9.40985654649721e-001, 9.23136985641824e+000, -
> > > > 2.86994950445746e+000, -1.26803931926022e+000, -
> > > > 7.70008830456271e+000, 1.25421731000059e+000 },
> > > > {3.08886279182467e+000, 5.78057919510794e+000,
> > > > 1.10741139003555e+001, -3.65436515636221e+000, -
> > > > 1.46817775035674e+001, 2.22520984659718e+001 },
> > > > {1.69160825877441e-001, -9.91646811530742e+000, -
> > > > 1.05635083282757e+001, 4.25517810226395e+000,
> > 2.50631134577816e+000, -
> > > > 2.91169885599088e+000 },
> > > > {-6.47564626574024e-001, -6.79555863835188e+000, -
> > > > 4.77495170169956e+000, 1.35029793165373e+000,
> > 2.78079262918906e+000, -
> > > > 1.90795645602409e+000 },
> > > > {1.43573516935369e+000, 7.90014107622549e+000,
> > > > 1.34639286162717e+000, -4.87454998380292e-001, -
> > > > 5.75300672778634e+000, 2.44385407464775e+000 }
> > > > };
> > > > double hidden_bias[5]={ -1.72504436049218e+000, -
> > > > 1.12353474266980e+001, 1.05782985606737e+001,
> > 6.38618458656671e+000, -
> > > > 4.76099367812151e+000 };
> > > > double hidden_output_wts[1][5]=
> > > > {
> > > > {4.85655076789677e+000, 5.85365165791789e-001,
> > > > 3.11879288899187e+000, -8.48772823147294e+000, -
> > > > 9.35987517826960e+000 }
> > > > };
> > > > double output_bias[1]={ 5.51616000361064e+000 };
> > > > double max_input[6]={ 3.02200000000000e-001,
> > 6.05400000000000e-001,
> > > > 1.81400000000000e-001, 1.59000000000000e-002,
> > 6.06600000000000e-001,
> > > > 2.43900000000000e-001 };
> > > > double min_input[6]={ -2.82000000000000e-001,
> > -8.46700000000000e-
> > > > 001, -1.95700000000000e-001, -9.70000000000000e-003, -
> > > > 5.52700000000000e-001, -2.45100000000000e-001 };
> > > > double max_target[1]={ 1.35100000000000e-001 };
> > > > double min_target[1]={ -1.50800000000000e-001 };
> > > > double input[6];
> > > > double hidden[5];
> > > > double output[1];
> > > > void FindMax(double* vec, double* max, long*
> > maxIndex,int len)
> > > > {
> > > > long i;
> > > > *max = vec[0];
> > > > *maxIndex = 0;
> > > > for(i=1; i<len; i++)
> > > > {
> > > > if(vec[i]>*max)
> > > > {
> > > > *max = vec[i];
> > > > *maxIndex = i;
> > > > }
> > > > }
> > > > }
> > > > void FindMin(double* vec, double* min, long*
> > minIndex,int len)
> > > > {
> > > > long i;
> > > > *min = vec[0];
> > > > *minIndex = 0;
> > > > for(i=1; i<len; i++)
> > > > {
> > > > if(vec[i]<*min)
> > > > {
> > > > *min = vec[i];
> > > > *minIndex = i;
> > > > }
> > > > }
> > > > }
> > > > void ScaleInputs(double* input, double min, double
> > max, int size)
> > > > {
> > > > double delta;
> > > > long i;
> > > > for(i=0; i<size; i++)
> > > > {
> > > > delta = (max-min)/(max_input[i]-min_input[i]);
> > > > input[i] = min - delta*min_input[i]+ delta*input[i];
> > > > }
> > > > }
> > > > void UnscaleTargets(double* output, double min, double
> > max, int size)
> > > > {
> > > > double delta;
> > > > long i;
> > > > for(i=0; i<size; i++)
> > > > {
> > > > delta = (max-min)/(max_target[i]-min_target[i]);
> > > > output[i] = (output[i] - min +
delta*min_target[i])/delta;
> > > > }
> > > > }
> > > > double logistic(double x)
> > > > {
> > > > if(x > 100.0) x = 1.0;
> > > > else if (x < -100.0) x = 0.0;
> > > > else x = 1.0/(1.0+exp(-x));
> > > > return x;
> > > > }
> > > > void ComputeFeedForwardSignals(double*
> > MAT_INOUT,double* V_IN,double*
> > > > V_OUT, double* V_BIAS,int size1,int size2,int layer)
> > > > {
> > > > int row,col;
> > > > for(row=0;row < size2; row++)
> > > > {
> > > > V_OUT[row]=0.0;
> > > >
> >
for(col=0;col<size1;col++)V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)
> > > > *V_IN[col]);
> > > > V_OUT[row]+=V_BIAS[row];
> > > > if(layer==0) V_OUT[row] = logistic(V_OUT[row]);
> > > > if(layer==1) V_OUT[row] = tanh(V_OUT[row]);
> > > > }
> > > > }
> > > > void RunNeuralNet_Regression ()
> > > > {
> > > > ComputeFeedForwardSignals((double*)
> > > > input_hidden_weights,input,hidden,hidden_bias,6, 5,0);
> > > > ComputeFeedForwardSignals((double*)
> > > > hidden_output_wts,hidden,output,output_bias,5, 1,1);
> > > > }
> >
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
>
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|