⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.c

📁 C-package of "Long Short-Term Memory" for Protein classification
💻 C
字号:
/* * $Id: test.c 1269 2007-05-09 07:49:08Z mhe $ */#include <stdio.h>#include <stdlib.h>#include <math.h>#include "lstm.h"#include "roc.h"#include "test.h"void nettest(){  FILE *fp;  int i,k,j;  element_t=0;  example_t=0;  epoch_err=0;  class_err=0;  classnon_err=0;  seq_cor=1;  seq_err=0;  dotest = 1;  while (dotest) {    /* executing the environment and setting the input */    execute_act_test();    /* forward pass */    if (prot_current_idx < test_size && dotest) {        forward_pass(0, element_t, inp_idx_t, inp_t);        if (targ) /* only if target for this input */ {        /* compute error */            for (k=cell_mod,j=0;k<ges_mod;k++,j++) {                error[0] =  target - Yk_new[k];            }            /* error */            if (target > targetvalue1) {                ispos = 1; // false negative (if an error occurs)            }            else {                ispos = 0; // false positive (if)            }            /* error */            comp_err(Yk_new[cell_mod], &sptest[prot_current_idx]);        }        for (i=0;i<ges_mod;i++) {            Yk_old[i] = Yk_new[i];        }        element_t++;    }  }  double roc = roctest(test_size);  double rocROCN = rocROCNtest(test_size);  double fnp = (positivetest) ? (double)class_err / (double)positivetest * 100: 0;  double fpp = (negativetest) ? (double)classnon_err / (double)negativetest * 100: 0;  printf("TEST  epoch: %d mse:%.6f fn:%.1f%% fp:%.1f%% roc:%.4f%% roc50:%.4f%%\n", epoch+1, epoch_err/test_size, fnp, fpp, roc, rocROCN);  double mse = epoch_err/(1.0*test_size);  fp=fopen(outfile, "a");  fprintf(fp,"TEST: epochs:%d sequences:%d\n",epoch+1,numb_seq);  fprintf(fp,"TEST: MSE:%.4f\n", mse);  //printf("test__ eperr: %f test_size: %d\n", epoch_err, test_size);  fprintf(fp,"TEST: false-negative:%d (out of %d positive test examples) %.1f%%\n",class_err,positivetest, fnp);  fprintf(fp,"TEST: false-positive:%d (out of %d negative test examples) %.1f%%\n",classnon_err,negativetest, fpp);  fprintf(fp,"TEST: roc:%.4f\n", roc);  fprintf(fp,"TEST: roc%d:%.4f\n", ROCN, rocROCN);  fprintf(fp,"\n");  fclose(fp);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -