1 /* ///////////////////////////////////////////////////////////////////////
2 * File: pca_mixed_network_test.h
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
12 #ifndef EXTL_INTELLIGENCE_ANN_PCA_MIXED_NETWORK_TEST_H
13 #define EXTL_INTELLIGENCE_ANN_PCA_MIXED_NETWORK_TEST_H
15 /* ///////////////////////////////////////////////////////////////////////
18 EXTL_INTELLIGENCE_BEGIN_WHOLE_NAMESPACE
19 EXTL_TEST_NAME_BEGIN_NAMESPACE(pca_mixed_network_test
)
21 /* ///////////////////////////////////////////////////////////////////////
24 static int pca_mixed_network_test()
26 /* ///////////////////////////////////////////////////////////////////////
34 EXTL_TEST_TRACE(_T("pca_mixed_network_test: train xor\n"));
35 typedef bp_network
< 2, 1
36 , sample_selector
<2, 1>::float_sample_type
38 typedef xor_bp_type::layers_type xor_layers_type
;
39 typedef ghia_network
<2, 2> xor_pca_type
;
40 typedef pca_mixed_network
<xor_pca_type
, xor_bp_type
> xor_pca_mixed_type
;
41 xor_pca_mixed_type
xor_pca_mixed(xor_pca_type(), xor_bp_type(xor_layers_type(10), 0.5));
42 EXTL_NS_TEST(xor_tester
)<xor_pca_mixed_type
> xtr
;
43 xtr
.test(xor_pca_mixed
, 50);
45 /* ///////////////////////////////////////////////////////////////////////
53 EXTL_TEST_TRACE(_T("pca_mixed_network_test: train not\n"));
54 typedef bp_network
< 2, 2
55 , sample_selector
<2, 2>::float_sample_type
57 typedef not_bp_type::layers_type not_layers_type
;
58 typedef ghia_network
<2, 2> not_pca_type
;
59 typedef pca_mixed_network
<not_pca_type
, not_bp_type
> not_pca_mixed_type
;
60 not_pca_mixed_type
not_pca_mixed(not_pca_type(), not_bp_type(not_layers_type(10), 0.5));
61 EXTL_NS_TEST(not_tester
)<not_pca_mixed_type
> ntr
;
62 ntr
.test(not_pca_mixed
, 50);
64 /* ///////////////////////////////////////////////////////////////////////
68 EXTL_TEST_TRACE(_T("pca_mixed_network_test: train sin(0, 2 * pi)\n"));
69 typedef bp_network
< 4, 8
70 , sample_selector
<4, 8>::float_sample_type
72 typedef sin_bp_type::layers_type sin_layers_type
;
73 typedef ghia_network
<8, 4> sin_pca_type
;
74 typedef pca_mixed_network
<sin_pca_type
, sin_bp_type
> sin_pca_mixed_type
;
75 sin_pca_mixed_type
sin_pca_mixed(sin_pca_type(), sin_bp_type(sin_layers_type(10), 0.5));
76 EXTL_NS_TEST(sin_tester
)<sin_pca_mixed_type
> str
;
80 str
.test(sin_pca_mixed
, 100);
82 printf("%d\n", t
.ms());
86 int pca_mixed_network_test_ret
= pca_mixed_network_test();
88 /* ///////////////////////////////////////////////////////////////////////
89 * ::unit_test namespace
91 EXTL_TEST_NAME_END_NAMESPACE(pca_mixed_network_test
)
92 EXTL_INTELLIGENCE_END_WHOLE_NAMESPACE
93 /* //////////////////////////////////////////////////////////////////// */
94 #endif /* EXTL_INTELLIGENCE_ANN_PCA_MIXED_NETWORK_TEST_H */
95 /* //////////////////////////////////////////////////////////////////// */