Changeset 217
 Timestamp:
 Dec 29, 2004, 10:37:24 AM (18 years ago)
 Location:
 trunk/test
 Files:

 1 added
 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test/Makefile.am
r210 r217 7 7 test_inputranker \ 8 8 test_kernel test_merge test_nni test_pca test_regression_linear \ 9 test_r nd test_roc \9 test_regression_local test_rnd test_roc \ 10 10 test_statistics test_svd test_svm test_vector 11 11 … … 46 46 $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB) 47 47 48 test_regression_local_SOURCES = test_regression_local.cc 49 test_regression_local_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \ 50 $(GSL_LIB) $(CBLAS_LIB) $(MATH_LIB) 51 48 52 test_rnd_SOURCES = test_rnd.cc 49 53 test_rnd_LDADD = @top_srcdir@/$(CPP_TOOLS_LIB_LOCATION)/$(CPP_TOOLS_LIB) \ 
trunk/test/test_regression_linear.cc
r212 r217 36 36 w(3)=0.4; 37 37 38 double c0, c1, cov00, cov01, cov11, chisq; 39 int n=4; 40 int i=4; 41 gsl_fit_wlinear(x.gsl_vector_pointer()>data, x.gsl_vector_pointer()>stride, 42 w.gsl_vector_pointer()>data, w.gsl_vector_pointer()>stride, 43 y.gsl_vector_pointer()>data, y.gsl_vector_pointer()>stride, 44 x.gsl_vector_pointer()>size, 45 &c0, &c1, 46 &cov00, &cov01, &cov11, &chisq); 38 theplu::statistics::RegressionLinear r; 39 r.fit_weighted(x,w,y); 40 printf("# best fit: Y = %g + %g X\n", r.m(), r.k()); 47 41 48 printf("# best fit: Y = %g + %g X\n", c0, c1); 49 printf("# covariance matrix:\n"); 50 printf("# [ %g, %g\n# %g, %g]\n", cov00, cov01, cov01, cov11); 51 printf("# chisq = %g\n", chisq); 52 53 for (i = 0; i < n; i++) 54 printf("data: %g %g %g\n", x[i], y[i], 1/sqrt(w[i])); 55 56 printf("\n"); 57 58 for (i = 30 ; i < 130 ; i++) 59 { 60 double xf = x[0] + (i/100.0) * (x[n1]  x[0]); 61 double yf, yf_err; 62 63 gsl_fit_linear_est (xf, c0, c1, cov00, cov01, cov11, &yf, &yf_err); 64 65 printf("fit: %g %g\n", xf, yf); 66 printf("hi : %g %g\n", xf, yf + yf_err); 67 printf("lo : %g %g\n", xf, yf  yf_err); 68 } 69 42 r.fit(x,y); 43 printf("# best fit: Y = %g + %g X\n", r.m(), r.k()); 70 44 71 45 if (ok)
Note: See TracChangeset
for help on using the changeset viewer.