Hello everyone:
I am using neural networks to predict the relationship between pollutants and pollution sources. I found similar articles in the discussion forum, but because I have never learned scripts and don’t know how to search for precise keywords, I still have some editing difficulties. , Here to seek your help.
My idea is this: use different seed codes in order to execute the neural network, and then create a table, extract and record the "R² Training" and "R² Validation" (if 10 are executed, there will be 10 Record the required results) to find the best results.
In addition, is there a way not to display the neural network window every time it is executed? Because it is executed 10 times, 10 windows will be added.
If you have any suggestions or help, please correct me, thank you!
The following are the parts that I have written and can be executed normally (seed codes 1~10 in order):
For( i = 1, i <=10, i++,
Neural(
Y( :NH4 ),
X(
:aver_NH4_kg_per_day 2,
:num_livestock,
:weighted_NH4,
:weighted_num,
:Name( "2weighted_nh4" ),
:Name( "2weighted_num" )
),
Informative Missing( 0 ),
Validation Method( "KFold", 5 ),
Set Random Seed( i ) ,
Fit(NTanH( 3 ))
);
);
Here is a modification of your script that captures the two R2 that you are looking for.
names default to here(1);
dt = current data table();
dto = New Table("Output",
New Column("Training R2"),
New Column("Validation R2"),
Add Rows(10)
);
For( i = 1, i <= 10, i++,
neu = dt << Neural(
Y( :NH4 ),
X(
:aver_NH4_kg_per_day 2,
:num_livestock,
:weighted_NH4,
:weighted_num,
:Name( "2weighted_nh4" ),
:Name( "2weighted_num" )
),
Informative Missing( 0 ),
Validation Method( "KFold", 5 ),
Set Random Seed( i ),
Fit( NTanH( 3 ) )
);
dto:Training R2[i] = (report(neu)["Training"][NumberColBox(1)] << get)[1];
dto:Validation R2[i] = (report(neu)["Validation"][NumberColBox(1)] << get)[1];
neu(report)<<CLOSE window=""></CLOSE>
You need to study the above script and use the Scripting Guide and Scripting Index to help to understand what it is doing.