Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure fnProsesTest(st : Boolean = False);
- var ii, jj, kk, nn, i, xx: integer;
- CT, Y2, net, D2, deltaB2, MSEchek, Denorm, y: Double;
- error, sumError, PE, sumPE, aa, bb, MAPE: Double;
- CP, Y1, D1, deltaW1, deltaW2, deltaB1, D1_net: array of array of Double;
- Baris, Kolom: Word;
- themp: array of array of Double;
- jmlParam, minus : Integer;
- SQLAdd : String;
- begin
- if st then begin
- //fnSetData(True);
- fnLoadBW;
- end;
- if sTest then
- Exit;
- sTest := True;
- try
- SetLength(Y2akhirTest, tUji, 2);
- for kk:= 0 to tUji - 1 do begin
- SetLength(CP, 1, nodeInput);
- for Kolom:= 0 to nodeInput - 1 do
- CP[0, Kolom]:= dtUjiNorm[kk, Kolom];
- CT:= dtUjiNorm[kk, kolTarget-1];
- SetLength(themp, 1, nodeInput);
- SetLength(Y1, 1, nodeHidden);
- for ii:= 0 to nodeHidden-1 do begin
- net:= 0;
- for kolom:= 0 to nodeInput - 1 do
- begin
- themp[0, Kolom]:= CP[0, Kolom] * w1[ii, Kolom];
- net:= net + themp[0, Kolom];
- end;
- net:= net + b1[ii, 0];
- Y1[0, ii]:= 1/(1+exp(-net));
- end;
- SetLength(themp, 1, nodeHidden);
- for ii:= 0 to nodeOutput - 1 do
- begin
- net:= 0;
- for Kolom:= 0 to nodeHidden - 1 do
- begin
- themp[0, Kolom]:= Y1[0, Kolom] * w2[ii, Kolom];
- net:= net + themp[0, Kolom];
- end;
- net:= net + b2;
- Y2:= 1/(1+exp(-net));
- end;
- Y2akhirTest[kk, 0]:= CT;
- Y2akhirTest[kk, 1]:= Y2;
- end;
- if st then begin
- try
- DM.Conn.StartTransaction;
- for i := 0 to tUji - 1 do begin
- Denorm := Y2akhirTest[i, 1];
- Denorm := (((Denorm - 0.1) * (vMax - vMin)) + (0.8 * vMin)) / 0.8;
- if Denorm < 0.5 then
- SQLAdd := 'Tidak Pesan'
- else
- SQLAdd := 'Pesan';
- SQLAdd :=
- Format(
- 'INSERT INTO tbl_prediksi (id_parameter, id_data, status) VALUES (%s, %s, %s)',
- [
- QuotedStr(transIDCheck),
- QuotedStr(arrID[i]),
- QuotedStr(SQLAdd)
- ]
- );
- fnSQLAdd(DM.QTemp1, SQLAdd, True);
- fnExecSQL(DM.QTemp1);
- end;
- DM.Conn.Commit;
- except
- DM.Conn.Rollback;
- end;
- end;
- finally
- sTest := False;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement