├── figs ├── SNR0plot_20_parity1_vs_parity2.png ├── SNR1plot_20_parity1_vs_parity2.png ├── SNR-1plot_20_parity1_vs_parity2.png ├── SNR-1plot20_PhaseI_noise_vs_parity1.png ├── SNR-1plot20_PhaseI_noise_vs_parity2.png ├── SNR0plot20_PhaseI_noise_vs_parity1.png ├── SNR0plot20_PhaseI_noise_vs_parity2.png ├── SNR1plot20_PhaseI_noise_vs_parity1.png └── SNR1plot20_PhaseI_noise_vs_parity2.png ├── model ├── round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_-1.h5 ├── round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_0.h5 ├── round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_1.h5 ├── round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_2.h5 ├── round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_-3.0_0.h5 ├── round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_10.0_0.h5 ├── round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_20.0_0.h5 └── round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_3.0_0.h5 ├── README.md ├── meanvar ├── meanvar_51_20_1.pickle ├── meanvar_51_-3.0_0.pickle ├── meanvar_51_20.0_0.pickle ├── meanvar_51_20_0.pickle ├── meanvar_51_20_-1.pickle ├── meanvar_51_10.0_0.pickle ├── meanvar_51_3.0_0.pickle └── meanvar_51_20_2.pickle └── feedback_main.py /figs/SNR0plot_20_parity1_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR0plot_20_parity1_vs_parity2.png -------------------------------------------------------------------------------- /figs/SNR1plot_20_parity1_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR1plot_20_parity1_vs_parity2.png -------------------------------------------------------------------------------- /figs/SNR-1plot_20_parity1_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR-1plot_20_parity1_vs_parity2.png -------------------------------------------------------------------------------- /figs/SNR-1plot20_PhaseI_noise_vs_parity1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR-1plot20_PhaseI_noise_vs_parity1.png -------------------------------------------------------------------------------- /figs/SNR-1plot20_PhaseI_noise_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR-1plot20_PhaseI_noise_vs_parity2.png -------------------------------------------------------------------------------- /figs/SNR0plot20_PhaseI_noise_vs_parity1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR0plot20_PhaseI_noise_vs_parity1.png -------------------------------------------------------------------------------- /figs/SNR0plot20_PhaseI_noise_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR0plot20_PhaseI_noise_vs_parity2.png -------------------------------------------------------------------------------- /figs/SNR1plot20_PhaseI_noise_vs_parity1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR1plot20_PhaseI_noise_vs_parity1.png -------------------------------------------------------------------------------- /figs/SNR1plot20_PhaseI_noise_vs_parity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/figs/SNR1plot20_PhaseI_noise_vs_parity2.png -------------------------------------------------------------------------------- /model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_-1.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_-1.h5 -------------------------------------------------------------------------------- /model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_0.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_0.h5 -------------------------------------------------------------------------------- /model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_1.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_1.h5 -------------------------------------------------------------------------------- /model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_2.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_2.h5 -------------------------------------------------------------------------------- /model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_-3.0_0.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_-3.0_0.h5 -------------------------------------------------------------------------------- /model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_10.0_0.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_10.0_0.h5 -------------------------------------------------------------------------------- /model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_20.0_0.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_20.0_0.h5 -------------------------------------------------------------------------------- /model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_3.0_0.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyejikim1/Deepcode/HEAD/model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_3.0_0.h5 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deepcode 2 | 3 | Deepcode: Feedback Codes via Deep Learning, by Hyeji Kim, Yihan Jiang, Sreeram Kannan, Sewoong Oh, and Pramod Viswanath 4 | 5 | # Noiseless feedback 6 | 7 | python feedback_main.py -ns -1 : Forward SNR -1dB 8 | python feedback_main.py -ns 0 : Forward SNR 0dB 9 | python feedback_main.py -ns 1 : Forward SNR 1dB 10 | python feedback_main.py -ns 2 : Forward SNR 2dB 11 | 12 | 13 | # Noisy feedback 14 | 15 | python feedback_main.py -ns 0 -fs -3 : Forward SNR 0dB Feedback SNR -3dB 16 | python feedback_main.py -ns 0 -fs 3 : Forward SNR 0dB Feedback SNR 3dB 17 | python feedback_main.py -ns 0 -fs 10 : Forward SNR 0dB Feedback SNR 10dB 18 | python feedback_main.py -ns 0 -fs 20 : Forward SNR 0dB Feedback SNR 20dB 19 | 20 | 21 | # Normalization layer 22 | 23 | Mean and variance for normalization layer is saved in meanvar/meanvar_Blocklength_FeedbackSNR_ForwardSNR.pickle 24 | 25 | meanvar_51_20_-1.pickle : Blocklength 51 (50 + zero padding) Noiseless Feedback Forward SNR -1dB 26 | meanvar_51_20_0.pickle : Blocklength 51 (50 + zero padding) Noiseless Feedback Forward SNR 0dB 27 | meanvar_51_20_1.pickle : Blocklength 51 (50 + zero padding) Noiseless Feedback Forward SNR 1dB 28 | meanvar_51_20_2.pickle : Blocklength 51 (50 + zero padding) Noiseless Feedback Forward SNR 2dB 29 | 30 | meanvar_51_-3.0_0.pickle : Blocklength 51 (50 + zero padding) Feedback SNR -3dB Forward SNR 0dB 31 | meanvar_51_3.0_0.pickle : Blocklength 51 (50 + zero padding) Feedback SNR 3dB Forward SNR 0dB 32 | meanvar_51_10.0_0.pickle : Blocklength 51 (50 + zero padding) Feedback SNR 10dB Forward SNR 0dB 33 | meanvar_51_20.0_0.pickle : BLocklength 51 (50 + zero padding) Feedback SNR 20dB Forward SNR 0dB 34 | 35 | -------------------------------------------------------------------------------- /meanvar/meanvar_51_20_1.pickle: -------------------------------------------------------------------------------- 1 | (lp0 2 | cnumpy.core.multiarray 3 | _reconstruct 4 | p1 5 | (cnumpy 6 | ndarray 7 | p2 8 | (I0 9 | tp3 10 | S'b' 11 | p4 12 | tp5 13 | Rp6 14 | (I1 15 | (I51 16 | I2 17 | tp7 18 | cnumpy 19 | dtype 20 | p8 21 | (S'f4' 22 | p9 23 | I0 24 | I1 25 | tp10 26 | Rp11 27 | (I3 28 | S'<' 29 | p12 30 | NNNI-1 31 | I-1 32 | I0 33 | tp13 34 | bI00 35 | S'h\xa6\x08?\x80=\xe8>\x04\xbd\xec>\x9fs\xea>\xec\xad\xe0>\x9f\xb3\xfc>\x15A\xe4>\x93n\x00?\xa9o\xe4>o`\x00?\xd6 \xe4>\x8bG\x00?Y\x17\xe4>DL\x00?\xdc\x1b\xe4>\x97S\x00?f\x1a\xe4>\xdcF\x00?\'\x14\xe4>\x1aS\x00?+\x1b\xe4>\xeeO\x00?\xf1 \xe4>8K\x00?0!\xe4>\xcaM\x00?!"\xe4>\xb5H\x00?\xcb+\xe4>\xe0K\x00?\xe6"\xe4>\xa8R\x00?g!\xe4>\xe6G\x00?\\\x19\xe4>\x8aJ\x00?\xc2\x17\xe4>RK\x00?\x1c"\xe4>\xf3H\x00?\xb4\x19\xe4>\xdcP\x00?\x92\x1b\xe4>\xedL\x00?5%\xe4>\xf1I\x00?\xfa*\xe4>zI\x00?\x04\r\xe4>\xe7U\x00?\xd8\x13\xe4>\xebM\x00?\x88\x10\xe4>WL\x00?\xbd\x1a\xe4>lP\x00?\xe8\x1a\xe4>\x08O\x00?1!\xe4>\x04J\x00?:\x1b\xe4>\xc4J\x00?5\x18\xe4>.H\x00?$\'\xe4>\xe2K\x00?\x00"\xe4>\xe1K\x00?\x98 \xe4>\xc1T\x00?\xdb\x16\xe4>\x86P\x00?<\x17\xe4>\xabJ\x00?h\x15\xe4>\x92P\x00?\x91%\xe4>\x8fI\x00?\x15\'\xe4>\x0cM\x00?0\x1a\xe4>\x14R\x00?<\x16\xe4>\xfbS\x00?\x1d\x17\xe4>\xaaM\x00?I\x17\xe4>\x82M\x00?"#\xe4>\xb7L\x00?8#\xe4>5M\x00?C%\xe4>:J\x00?\x8a#\xe4>/K\x00?\xc5\x19\xe4>)T\x00?n\x0e\xe4>zS\x00?n\xfb\xe9>g\\\xf8>' 36 | p14 37 | tp15 38 | bag1 39 | (g2 40 | (I0 41 | tp16 42 | g4 43 | tp17 44 | Rp18 45 | (I1 46 | (I51 47 | I2 48 | tp19 49 | g11 50 | I00 51 | S'\x88]\xa7:\xe8\xc3^;\xf7\n\x87;\xf9^\x17;\xbf\xcen:?\xa7Y:\xb6\x1d<:I\x0bC:\xe8\xae2:\x84uA:\x1271:C\x8f>:,\xaa0:\xdc{@:_\xbc1:3|@:V\x8e0:U\x99@:\xede2:R[A:f`3:\n\xb4@:\xcaM2:N\x85@:\x9f\xf82:$\xabB:\x88\r2:\x8c\x91A:\x0ch2:&\x8d@:\xc5\xb82:\x8e\x90@:\xcd41:\xc2\x0cB:\xf9f3:\xef\xc5A:\xf4y2:O\xb9?:.\x832:\xb5\x06A:Xm0:?\xc9@:\xc2\xf60:/\xc3A:\xc1\xfd1:\x89\xcfA:j\xf42:\x1eqA:\xfc\x8c4:\xc2\xa0?:\xf4\x8d2:\xba\xba@:\xb2\x082:\xf3\x04A:\x9d^3:\x14+A:\xbb\x002:bFB:{\xfe1:\x07iA:\xb2\x8d1:{\x97A:\xfbN2:\x9f\xbb@:\xa7s0:\x95\x92A:\xe4_1:T-A:"\xcf2:\xbdRA:\xa1\x142:\xcaU@:\xb7\x8c3:>\x95@:0\xf20:\x85\x07A:\x81y1:\xe2\x1bA:t\x063:,8A:\x13\xcf1:K\tA:f\x942:\xa4\x96A:\xcf\x1c2:\x9e\tA:\x15\xcc3:\x05\xa6B:6\xc82:ZwA:\xf1S3:\x96\x9fB:V{2:`\rA:\xe8\xdf1:L\xedB:\x1e\x962:\x8f\xaaA:l\x132:\xfd\xd9@:J\xda\x0e:\xa3\xce\xf59' 52 | p20 53 | tp21 54 | ba. -------------------------------------------------------------------------------- /meanvar/meanvar_51_-3.0_0.pickle: -------------------------------------------------------------------------------- 1 | (lp0 2 | cnumpy.core.multiarray 3 | _reconstruct 4 | p1 5 | (cnumpy 6 | ndarray 7 | p2 8 | (I0 9 | tp3 10 | S'b' 11 | p4 12 | tp5 13 | Rp6 14 | (I1 15 | (I51 16 | I2 17 | tp7 18 | cnumpy 19 | dtype 20 | p8 21 | (S'f4' 22 | p9 23 | I0 24 | I1 25 | tp10 26 | Rp11 27 | (I3 28 | S'<' 29 | p12 30 | NNNI-1 31 | I-1 32 | I0 33 | tp13 34 | bI00 35 | S"V\xf3!?6\xdb\x10?\xd3&\x0c?3\xd8\x02?\xe3o\x08?\x1c\xa1\x03?|\x0c\x08?o\x17\x04?83\x08?gS\x04?\x9e\x1a\x08?yL\x04?\xcd\x1a\x08?VY\x04?\xa7\x14\x08?\x9eL\x04?q \x08?X8\x04?Q.\x08?\xfaZ\x04?|\x14\x08?0M\x04?\xd9\x0c\x08?\x18Y\x04?x\x17\x08?\\'\x04?\xed=\x08?\xddB\x04??2\x08?\x10D\x04?\x94$\x08?9V\x04?\x16\x10\x08?^e\x04?\xf5\x04\x08?qC\x04?\x8f$\x08?yA\x04?\x02)\x08?LW\x04?\xbe\x15\x08?EB\x04?4\x1d\x08?\xa8Z\x04?\x94\x0b\x08?VT\x04?\xcf\x13\x08?\x19h\x04?\xb2\x08\x08?,U\x04?\xdb\x05\x08?vg\x04?0\xff\x07?NL\x04?Q\x18\x08?\xffG\x04?\xe0\x1e\x08?\xebe\x04?\xe9\x08\x08?UB\x04?\x14\x13\x08?\xebg\x04?\xbb\x0f\x08?\x90#\x04?\x0e=\x08?\x17Z\x04?n\x11\x08?+M\x04?f\x18\x08?Re\x04?\xf8\x0b\x08?\xfaS\x04?\xff\x08\x08?\x1cF\x04?f\x1f\x08?\xbdN\x04?\xfe\x16\x08?(Q\x04?\x11'\x08?\xc38\x04?\x7f.\x08?Q`\x04?Y\x1b\x08?\xfc(\x04?\\1\x08?m`\x04? \x1c\x08?\xff)\x04?{5\x08?\xaf<\x04?\x077\x08?s;\x04?\x96.\x08?\xb2M\x04?}\x1d\x08?\xdd[\x04?&\x1a\x08?\xcbB\x04?\xa9$\x08?\xc4K\x04?\x0f\x19\x0e?$^\xd7>" 36 | p14 37 | tp15 38 | bag1 39 | (g2 40 | (I0 41 | tp16 42 | g4 43 | tp17 44 | Rp18 45 | (I1 46 | (I51 47 | I2 48 | tp19 49 | g11 50 | I00 51 | S'\xad\xdc\x8c;\x9dH\x90<\x054a<\x98Gj<\x01!\x17<\x8en3<\x92\xfa\r<+\x9e.<\xa2\xfd\x0b<\xd9\xef/<\x06&\r<{\x1a0\t\x90\xfc>\xcc\xeb\xcc>\xe1\x8f\xf4>H\xcd\xd1>\xc2t\xf5>.|\xd2>I.\xf5>\x15C\xd2>\x92\xf1\xf4>\x976\xd2>\x02\x0c\xf5>\xfeM\xd2>3\n\xf5>\x92E\xd2>\xea\x18\xf5>\x9e?\xd2>\x96\x1b\xf5>-B\xd2>E\x1d\xf5>w=\xd2>\xc3\x17\xf5>7P\xd2>\x9f\x1f\xf5>bA\xd2>\xfb\x06\xf5>OU\xd2>_\x18\xf5>\x847\xd2>4\x1f\xf5>\xf9I\xd2>\x98\x16\xf5>\xd9H\xd2>\x07+\xf5>XB\xd2>\x9a\x0e\xf5>\xa3L\xd2>\xaa5\xf5>\x114\xd2>\r\x1c\xf5>\xeeJ\xd2>=\x14\xf5>\xd9A\xd2>\x0f\x1b\xf5>\x818\xd2>\xc3\x05\xf5>\x1dP\xd2>\xe5\x0b\xf5>^G\xd2>\x87\x10\xf5>-E\xd2>\x8f \xf5>OM\xd2>\xa9\x04\xf5>\xd4M\xd2>\xdd\x1e\xf5>,E\xd2>\xcb,\xf5>!7\xd2>\x94+\xf5>\xd7@\xd2>\xcc\x1a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f6\xe4>\\6\xcf>\xa4\xe7\xe4>\x96;\xcf>\x8f\xf6\xe4>\x1c6\xcf>\xe9\xf7\xe4>MM\xcf>_\xf4\xe4>\xa38\xcf>\x04\xd6\xec>\xcc`\xc6>' 36 | p14 37 | tp15 38 | bag1 39 | (g2 40 | (I0 41 | tp16 42 | g4 43 | tp17 44 | Rp18 45 | (I1 46 | (I51 47 | I2 48 | tp19 49 | g11 50 | I00 51 | S"\xa07u:\x08\xb2];\xd3Q(;\x98$\xe0:\x96\xc4\xbe:\x19\xcdv:\xa8R\xaf:!\x1cm:\x1a\xd6\xad:\xa72l:\xc8\x81\xae:\x06$l:o\xfe\xaf:B\x11l:PR\xb1:|zm:\xc2\xe3\xae:\xc0\xf1k:\xf3r\xaf:\xc1\xa9k:\x0b\xfc\xad:\xb2Hk:\x94\x83\xaf:\xc7\xe0k:\xed\xe3\xae:\x0bum:\xf3{\xae:'\x14k:{m\xae:\x8c\xe9l:A\xd5\xae:\xf2\xfcl:\x9d@\xae:g\x87l:\xd8(\xaf:h\xa8m:\xf2`\xaf:\x1aKo:\xfdw\xaf:f\x90m:\x97\xec\xaf:\x1aIn:\xca5\xaf:\xa2\xafl:\x1f>\xae:L1\xdc\x01?\xc6\xf6\xfb>\xcd_\xfb>\x8b\x91\x00?\xbc\'\xfa>1\xaf\xfe>\x9dc\xfe>\\\xbc\xfc>y*\x00?\xe9\xf8\xfc>\x9d&\x00?\r\xed\xfc>NF\x00?\xa4\xb5\xfc>\x01C\x00?]\xa7\xfc>\xf68\x00?E\xad\xfc>PN\x00?\x13\xb5\xfc>\x999\x00?9\x9c\xfc>wE\x00??\x92\xfc>\x96P\x00?\xef|\xfc>\xbe?\x00?\x00\x90\xfc>4R\x00?F\x91\xfc>~=\x00?V\xaa\xfc>hX\x00?2\xac\xfc>\xa9D\x00?h\x9e\xfc>\xe5N\x00?\xa0\x96\xfc>XO\x00?S\xa0\xfc>\x86L\x00?|\x9d\xfc>\x0fH\x00?h\xb0\xfc>\x04O\x00?O\x9b\xfc>\xfdD\x00?"\xad\xfc>\xf0]\x00?\x96\xa8\xfc>\xd4H\x00?\xf6\xa1\xfc>bB\x00?\xf5\xaa\xfc>\x19?\x00?j\xa4\xfc>gC\x00?|\xa1\xfc>\xf3J\x00?\xa1\xa8\xfc>OT\x00?\xa4\xa8\xfc>,H\x00?\x00\xbf\xfc>jS\x00?\xbc\x98\xfc>\x973\x00?\xa3\xa3\xfc>mM\x00?\xcf\x99\xfc>\xb5F\x00?3\x8a\xfc>\x88H\x00?\xe8\x99\xfc>6P\x00?f\xa3\xfc>\xd9=\x00?I\xa7\xfc>5G\x00?<\x90\xfc>#@\x00?U\x9e\xfc>\xc1C\x00?\xbc\x93\xfc>"C\x00?W\xb0\xfc>GM\x00?\xaa\xa0\xfc>\\F\x00?Q\xab\xfc>"R\x00?~\xa8\xfc>BO\x00?G\x97\xfc>FS\x00?\x96\x9f\xfc>\'M\x00?\xeb\x99\xfc>\xccB\x00?\x10\x8c\xf0>\xfd\x0f\xf5>' 36 | p14 37 | tp15 38 | bag1 39 | (g2 40 | (I0 41 | tp16 42 | g4 43 | tp17 44 | Rp18 45 | (I1 46 | (I51 47 | I2 48 | tp19 49 | g11 50 | I00 51 | S'\xd8\xaf\x18;\xfbI\xb1;\x97\xab\x1b;\xea\x1f9;u3\r;\xf3\xe0\x01;\xa6\xba\x18;5\xcc\x06;S\xa8\x18;9O\x0c;\x15[\x18;\xaa\xcf\x0e;\xdbd\x16;\x92F\x0f;\xc1\xfe\x15;\x01`\r;T\x0f\x16;(\xa9\r;\xc7\x06\x16;\x86\xb3\x0e;X\x00\x16;X|\r;\x0c\xda\x17;1\x19\x0f;\xac\xd6\x16;\xbc\xca\x0e;\xef\xf3\x16;\x1bd\x0f;7\xba\x16;b\xb6\x0f;O\x16\x16;\x0e\x7f\x0e;\xa3H\x16;\xee\xe4\r;0\x90\x16;\xd2\xbc\r;\xe2O\x17;Wv\x0e;l\xd6\x16;\x87@\x10;\tP\x16;\xf3a\x0e;\x13\xea\x16;y0\x0e;\xf4\xac\x15;\x8bS\x0e;\x1c\xce\x15;\x03\x16\x0e;\x8c1\x15;N\x9e\x0e;\xe7\x10\x16;Of\x0e;td\x15;\x01\x08\x0e;\xa0\xbf\x16;\xf1\xe3\r;\xd9\x15\x16;\xe7Z\x0e;\xfd~\x16;u\xd0\x0e;U\xd6\x15;\xcd\x81\x0e;\x19\xda\x16;\xca\x9a\x0e;\x83\x9f\x16;\xd5\x89\x0e;\xcb\xd8\x16;{,\x0f;`\x80\x15;"t\x0e;\xdbo\x15;\xd1\xe7\x0e;\xed*\x16;"\x7f\x0e;\xaa\xec\x16;\xc5_\x0f;\xe0\xdd\x16;F\xc2\x0f;L\x0e\x16;\xaa%\x0f;S)\x16;\xaet\x0e;\xa9\xbb\x15;\xf4\xc7\r;J\xaa\x15;W}\x0e;\x8f2\x16;\x91\xed\x0e;\xb2\xbd\x15;\x98m\x0e;\x82\xcb\x14;\xad\x8c\r;T\xfa\x15;`\xf8\r;\x7f,\x16;(\xc4\x0e;\xa9\x1f\x17;&o\x0e;C\xf0\x16;\xc7g\x0f;\xd0\xea\xe5:\xb9\r\xda:' 52 | p20 53 | tp21 54 | ba. -------------------------------------------------------------------------------- /meanvar/meanvar_51_10.0_0.pickle: -------------------------------------------------------------------------------- 1 | (lp0 2 | cnumpy.core.multiarray 3 | _reconstruct 4 | p1 5 | (cnumpy 6 | ndarray 7 | p2 8 | (I0 9 | tp3 10 | S'b' 11 | p4 12 | tp5 13 | Rp6 14 | (I1 15 | (I51 16 | I2 17 | tp7 18 | cnumpy 19 | dtype 20 | p8 21 | (S'f4' 22 | p9 23 | I0 24 | I1 25 | tp10 26 | Rp11 27 | (I3 28 | S'<' 29 | p12 30 | NNNI-1 31 | I-1 32 | I0 33 | tp13 34 | bI00 35 | S'C\xec\x1a?\xfbm\x00?(8\x03?}V\xd6>\xc1#\xfd>>}\xd1>i*\xfc>HF\xd0>\xb7<\xfb>\xa5\xd7\xcf>P\xf0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 52 | p20 53 | tp21 54 | ba. -------------------------------------------------------------------------------- /meanvar/meanvar_51_3.0_0.pickle: -------------------------------------------------------------------------------- 1 | (lp0 2 | cnumpy.core.multiarray 3 | _reconstruct 4 | p1 5 | (cnumpy 6 | ndarray 7 | p2 8 | (I0 9 | tp3 10 | S'b' 11 | p4 12 | tp5 13 | Rp6 14 | (I1 15 | (I51 16 | I2 17 | tp7 18 | cnumpy 19 | dtype 20 | p8 21 | (S'f4' 22 | p9 23 | I0 24 | I1 25 | tp10 26 | Rp11 27 | (I3 28 | S'<' 29 | p12 30 | NNNI-1 31 | I-1 32 | I0 33 | tp13 34 | bI00 35 | S'x\xa3\x13?P\x94\x00?\xba\xd2\x02?\xef\x9f\xdb>\xc6\xf1\x03?\x00\xb1\xe9>8\x91\x00?\xef\xeb\xe6>\xb7\x87\x01?\x90\x0b\xe8>\x0c\xfb\x00?E\x15\xe7>D-\x01?.\x89\xe7>\xc2\x11\x01?\xc3f\xe7>\xd0\x15\x01?\xda6\xe7>\xd6,\x01?g\\\xe7>\xec,\x01?\xccq\xe7>l\x16\x01?\x19\x87\xe7>\x8d&\x01?\xe6,\xe7>;$\x01?\xebP\xe7>\xc4:\x01?aV\xe7>>%\x01?\xa7[\xe7>U0\x01?\x9fV\xe7>\xb2\x18\x01?ct\xe7>\xd7$\x01?,D\xe7>\x9f#\x01?\xd0Q\xe7>\x010\x01?rl\xe7>C\x1d\x01?/i\xe7>\x9a%\x01?\x04<\xe7>M\x18\x01?\x92n\xe7>>-\x01?\x1a>\xe7>_\x1c\x01?\xa7^\xe7>\x984\x01?\x05C\xe7>\x04\x1a\x01?\x80e\xe7>.*\x01?\x8fc\xe7>\x96\x17\x01?\x96I\xe7>\xfa%\x01?\xd2\x89\xe7>!\x1d\x01?\xfcm\xe7>\x8c\x1b\x01?q=\xe7>\xdd/\x01?\x0bX\xe7>\xc7*\x01?\xec]\xe7>\x00\'\x01?\xafZ\xe7>\xd2*\x01?|Z\xe7>P$\x01?\xaad\x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da\xf9>2\x97\x1a?\x13\xe9\xf9>\x9a\x89\x1a?\x07\xce\xf9>\xb8\x92\x1a?5\xd6\xf9>\x19\x8e\x1a?\xb6\xd1\xf9>\x90\x9b\x1a?p\xdc\xf9>o\x94\x1a?\x8d\xdf\xf9>\x03\x8a\x1a?o\xd2\xf9>\t\x90\x1a?\xd2\xe2\xf9>\x01\x83\x1a?\xe0\xc9\xf9>[\x90\x1a?&\xe3\xf9>\x86\x8c\x1a?h\xd1\xf9>v\x90\x1a?<\xd8\xf9>U\x8c\x1a?m\xdc\xf9>\xbe\x81\x1a?\n\xd7\xf9>\xd8\x8f\x1a?\xd8\xd3\xf9>\x1f\x96\x1a?\xf8\xd9\xf9>\x88\x96\x1a?\r\xcc\xf9>\xae\x9b\x1a?6\xea\xf9>K\x95\x1a?\xd6\x92\xef>;\x1f"?' 36 | p14 37 | tp15 38 | bag1 39 | (g2 40 | (I0 41 | tp16 42 | g4 43 | tp17 44 | Rp18 45 | (I1 46 | (I51 47 | I2 48 | tp19 49 | g11 50 | I00 51 | S'\x1c\x15P<\xbe\x9fG<[\xcbM<\xd2\xb2h<\x8b\\";l\x82n;;\xa9\xba:\xd3\xe9%;\xe91\xac:\xc4N\x1d;6)\xac:y\xf7\x1c;\xe5\xdd\xac:\x1a\xc6\x1d;\xfa\x15\xad:9\xe7\x1e;\xd4\xd5\xac:\xa4\x87\x1d;\xa1F\xad:\xcc\x80\x1e;\x02\n\xae:\xf6t\x1e;X\x9c\xad:\xdf\x81\x1e;&\xc0\xac:\x9a\xfd\x1d;\xff\xe9\xac:\xd3\xd9\x1d;\xd5h\xac:\xe3\xd6\x1c;\xf2\xd1\xac:,\x00\x1d;\x9f\xa6\xad:\xceX\x1e;\xcdn\xad:l6\x1d;*\xa9\xab:\xe4\x84\x1d;\x192\xad:\x89v\x1d;F\x1b\xac:\xbdm\x1d;M\x87\xad:\xe1N\x1e;\xb6.\xad:w(\x1e;\x1e]\xac:\xad\x16\x1e;%m\xad:\x192\x1e;nI\xad:\xf4\x15\x1e;\x02\x89\xac:\xb1\xd9\x1d;e]\xad:\xc2d\x1d;H\x00\xad:\x14\x1b\x1f;\x8e\xfe\xad:1\x19\x1e;J%\xad:\xe6K\x1e;\ry\xac:\x82\x8b\x1d;\x0e\xa8\xad:\xd41\x1e;\x07\x98\xad:G\x07\x1e;\tQ\xad:D\xac\x1d;\xa3\xd2\xac:I\x92\x1d;\xe3\x86\xad:\xaa4\x1e;\xa2\x88\xad:k\xf6\x1d;\x9d0\xad:QC\x1d;\x81\x05\xad:i\x94\x1e;\xab\xb1\xac:`\xbc\x1c;\x10`\xac:5V\x1d;\xd0\xf5\xad:\x8b\xaa\x1e;L^\xae:y\x19\x1f;\x8c\x93\xae:]g\x1e;I\x87\xac:\xea\x8e\x1d;\xd3\xf3\xab:%b\x1d;?a\xac:w\xe5\x1c;\x96\x0f\xae:T\x89\x1d;\'\xd2\xac:\xd7\x1c\x1e;E\x87\x86:E\xfe\xd3:' 52 | p20 53 | tp21 54 | ba. -------------------------------------------------------------------------------- /feedback_main.py: -------------------------------------------------------------------------------- 1 | __author__ = 'hyejikim' 2 | 3 | # Deepcode simulation. 4 | import numpy as np 5 | import tensorflow as tf 6 | import keras 7 | from keras.models import Sequential, Model 8 | from keras.layers import Dense, Input 9 | from keras.layers.normalization import BatchNormalization 10 | from keras.layers.core import Lambda 11 | from keras.layers import TimeDistributed 12 | from keras.layers import LSTM, GRU, SimpleRNN 13 | from keras.layers.wrappers import Bidirectional 14 | from keras import regularizers 15 | from keras.engine.topology import Layer 16 | import matplotlib 17 | matplotlib.use('pdf') 18 | import matplotlib.pyplot as plt 19 | from keras import backend as K 20 | from keras.engine import Layer 21 | import scipy.io as sio 22 | import matplotlib, h5py, pickle, sys, time 23 | 24 | 25 | ################################ 26 | # GPU memory allocation 27 | from keras.backend.tensorflow_backend import set_session 28 | config = tf.ConfigProto() 29 | config.gpu_options.per_process_gpu_memory_fraction = 0.6 30 | set_session(tf.Session(config=config)) 31 | print '[Test][Warining] Restrict GPU memory usage to 60%' 32 | 33 | ################################ 34 | # Arguments 35 | n_inp = sys.argv[1:] 36 | 37 | if '-coderate' in n_inp: 38 | ind1 = n_inp.index('-coderate') 39 | coderate = int(n_inp[ind1+1]) 40 | else: 41 | coderate = 3 42 | 43 | if '-tx' in n_inp: 44 | ind1 = n_inp.index('-tx') 45 | num_hunit_rnn_tx = int(n_inp[ind1+1]) 46 | else: 47 | num_hunit_rnn_tx = 50 48 | if '-rx' in n_inp: 49 | ind1 = n_inp.index('-rx') 50 | num_hunit_rnn_rx = int(n_inp[ind1+1]) 51 | else: 52 | num_hunit_rnn_rx = 50 53 | print 'Tx hidden nodes:', num_hunit_rnn_tx 54 | print 'Rx hidden nodes:', num_hunit_rnn_rx 55 | 56 | 57 | if '-len' in n_inp: 58 | ind1 = n_inp.index('-len') 59 | bit_length = int(n_inp[ind1+1]) 60 | else: 61 | bit_length = 51 # Number of bits including one (for zero padding) 62 | print 'Block length: ', bit_length 63 | 64 | if '-fs' in n_inp: # Noisy feedback 65 | ind1 = n_inp.index('-fs') 66 | fsSNR = float(n_inp[ind1+1]) 67 | feedback_sigma = 10**(-fsSNR*1.0/20) 68 | else: 69 | fsSNR = 20 # fsSNR = 20 means noiseless feedback 70 | feedback_sigma = 0 71 | 72 | if '-ns' in n_inp: 73 | ind1 = n_inp.index('-ns') 74 | nsSNR = int(n_inp[ind1+1]) 75 | noise_sigma = 10**(-nsSNR*1.0/20) 76 | else: 77 | nsSNR = 0 78 | noise_sigma = 10**(-nsSNR*1.0/20) 79 | print 'SNR of forward channel: ', nsSNR 80 | print 'SNR of feedback channel: ', fsSNR 81 | 82 | 83 | if '-k' in n_inp: 84 | ind1 = n_inp.index('-k') 85 | k = int(n_inp[ind1+1]) 86 | else: 87 | k = bit_length*200000 # length of total message bits for testing. 88 | print 'Total number of bits for testing: ', k 89 | 90 | if '-noncausal' in n_inp: 91 | causal = False 92 | else: 93 | causal = True 94 | print 'Causality: ', causal 95 | 96 | 97 | class ScaledLayer(Layer): # Power Allocation Layer 98 | def __init__(self, **kwargs): 99 | super(ScaledLayer, self).__init__(**kwargs) 100 | def build(self, input_shape): 101 | self.output_dim = input_shape[1] 102 | self.W = self.add_weight(name = 'power_weight', shape=(1,), # Power allocation for information bit stream 103 | initializer='ones', trainable=True) 104 | self.W2 = self.add_weight(name = 'power_weight1', shape=(1,), # Power allocation for parity 1 stream 105 | initializer='ones', trainable=True) 106 | self.W3 = self.add_weight(name = 'power_weight2', shape=(1,), # Power allocation for parity 2 stream 107 | initializer='ones', trainable=True) 108 | 109 | self.b1 = self.add_weight(name = 'b1', shape=(1,), 110 | initializer='ones', trainable=True) # Power allocation for last-4 bit 111 | self.b2 = self.add_weight(name = 'b2', shape=(1,), 112 | initializer='ones', trainable=True) # Power allocation for last-3 bit 113 | self.b3 = self.add_weight(name = 'b3', shape=(1,), 114 | initializer='ones', trainable=True) # Power allocation for last-2 bit 115 | self.b4 = self.add_weight(name = 'b4', shape=(1,), 116 | initializer='ones', trainable=True) # Power allocation for last-1 bit 117 | self.b5 = self.add_weight(name = 'b5', shape=(1,), 118 | initializer='ones', trainable=True) # Power allocation for last bit 119 | 120 | self.g1 = self.add_weight(name = 'g1', shape=(1,), 121 | initializer='ones', trainable=True) # Power allocation for 1st bit 122 | self.g2 = self.add_weight(name = 'g2', shape=(1,), 123 | initializer='ones', trainable=True) # Power allocation for 2nd bit 124 | self.g3 = self.add_weight(name = 'g3', shape=(1,), 125 | initializer='ones', trainable=True) # Power allocation for 3rd bit 126 | self.g4 = self.add_weight(name = 'g4', shape=(1,), 127 | initializer='ones', trainable=True) # Power allocation for 4th bit 128 | 129 | 130 | super(ScaledLayer, self).build(input_shape) 131 | def call(self, x, mask=None): 132 | sys = tf.reshape(tf.multiply(x[:,:,0], self.W),[tf.shape(x)[0],tf.shape(x)[1],1]) 133 | par1 = tf.reshape(tf.multiply(x[:,:,1], self.W2),[tf.shape(x)[0],tf.shape(x)[1],1]) 134 | par2 = tf.reshape(tf.multiply(x[:,:,2], self.W3),[tf.shape(x)[0],tf.shape(x)[1],1]) 135 | 136 | cats = K.concatenate([K.concatenate([tf.expand_dims(tf.multiply(self.g1,sys[:,0,:]),1),tf.expand_dims(tf.multiply(self.g1,par1[:,0,:]),1),tf.expand_dims(tf.multiply(self.g1,par2[:,0,:]),1)],axis=2), 137 | K.concatenate([tf.expand_dims(tf.multiply(self.g2,sys[:,1,:]),1),tf.expand_dims(tf.multiply(self.g2,par1[:,1,:]),1),tf.expand_dims(tf.multiply(self.g2,par2[:,1,:]),1)],axis=2), 138 | K.concatenate([tf.expand_dims(tf.multiply(self.g3,sys[:,2,:]),1),tf.expand_dims(tf.multiply(self.g3,par1[:,2,:]),1),tf.expand_dims(tf.multiply(self.g3,par2[:,2,:]),1)],axis=2), 139 | K.concatenate([tf.expand_dims(tf.multiply(self.g4,sys[:,3,:]),1),tf.expand_dims(tf.multiply(self.g4,par1[:,3,:]),1),tf.expand_dims(tf.multiply(self.g4,par2[:,3,:]),1)],axis=2), 140 | K.concatenate([sys[:,4:bit_length-5,:],par1[:,4:bit_length-5,:],par2[:,4:bit_length-5,:]],axis=2), 141 | K.concatenate([tf.expand_dims(tf.multiply(self.b1,sys[:,bit_length-5,:]),1),tf.expand_dims(tf.multiply(self.b1,par1[:,bit_length-5,:]),1),tf.expand_dims(tf.multiply(self.b1,par2[:,bit_length-5,:]),1)],axis=2), 142 | K.concatenate([tf.expand_dims(tf.multiply(self.b2,sys[:,bit_length-4,:]),1),tf.expand_dims(tf.multiply(self.b2,par1[:,bit_length-4,:]),1),tf.expand_dims(tf.multiply(self.b2,par2[:,bit_length-4,:]),1)],axis=2), 143 | K.concatenate([tf.expand_dims(tf.multiply(self.b3,sys[:,bit_length-3,:]),1),tf.expand_dims(tf.multiply(self.b3,par1[:,bit_length-3,:]),1),tf.expand_dims(tf.multiply(self.b3,par2[:,bit_length-3,:]),1)],axis=2), 144 | K.concatenate([tf.expand_dims(tf.multiply(self.b4,sys[:,bit_length-2,:]),1),tf.expand_dims(tf.multiply(self.b4,par1[:,bit_length-2,:]),1),tf.expand_dims(tf.multiply(self.b4,par2[:,bit_length-2,:]),1)],axis=2), 145 | K.concatenate([tf.expand_dims(tf.multiply(self.b5,sys[:,bit_length-1,:]),1),tf.expand_dims(tf.multiply(self.b5,par1[:,bit_length-1,:]),1),tf.expand_dims(tf.multiply(self.b5,par2[:,bit_length-1,:]),1)],axis=2), 146 | ], axis=1) 147 | 148 | cats_mean, cats_var = tf.nn.moments(cats,[0]) 149 | rem = bit_length-9.0 150 | 151 | adj = bit_length*1.0/(bit_length) 152 | den = (rem + self.g1**2 + self.g2**2 + self.g3**2 + self.g4**2 + self.b1**2 + self.b2**2 + self.b3**2 + self.b4**2 + self.b5**2)*(self.W**2+self.W2**2+self.W3**2) 153 | return tf.sqrt(3.0*bit_length/den)*cats 154 | 155 | def get_output_shape_for(self, input_shape): 156 | a_shape = input_shape 157 | return (a_shape[0], a_shape[1], a_shape[2]) 158 | 159 | def compute_output_shape(self, input_shape): 160 | a_shape = input_shape 161 | return (a_shape[0], a_shape[1], a_shape[2]) 162 | 163 | 164 | # Encoder. Single Directional. One layer RNN 165 | f1 = SimpleRNN(name='simple_rnn_1', units=num_hunit_rnn_tx, activation='tanh', return_sequences=True, dropout=1.0) 166 | f3 = TimeDistributed(Dense(coderate-1, activation='sigmoid'),name = 'time_distributed_0') 167 | 168 | # Decoder. Bidirectional. Two Layered GRU with batch normalization. 169 | f4 = Bidirectional(GRU(name='bidirectional_1', units=num_hunit_rnn_rx, activation='tanh', return_sequences=True, dropout=1.0)) 170 | f5 = BatchNormalization(name='batch_normalization_1') 171 | f6 = Bidirectional(GRU(name='bidirectional_2', units=num_hunit_rnn_rx, activation='tanh', return_sequences=True, dropout=1.0)) 172 | f7 = BatchNormalization(name='batch_normalization_2') 173 | f8 = TimeDistributed(Dense(1, activation='sigmoid'), name='time_distributed_1') 174 | 175 | 176 | # Loss used for training: Binary crossentropy over all bits except for the zero padding 177 | def customLoss(y_true,y_pred): 178 | y_true_50 = y_true[:,0:bit_length-1,:] 179 | y_pred_50 = y_pred[:,0:bit_length-1,:] 180 | return K.binary_crossentropy(y_true_50, y_pred_50) 181 | 182 | # Errors used for training: ignoring the error on the zero padded bits 183 | def errors(y_true, y_pred): 184 | y_true_50 = y_true[:,0:bit_length-1,:] 185 | y_pred_50 = y_pred[:,0:bit_length-1,:] 186 | myOtherTensor = K.not_equal(y_true_50, K.round(y_pred_50)) 187 | return K.mean(tf.cast(myOtherTensor, tf.float32)) 188 | 189 | # Normalization layer of the encoder 190 | def normalize(x): 191 | if causal == False: # Average over batches 192 | x_mean, x_var = tf.nn.moments(x,[0]) 193 | else: # Load pre-computed mean/variance for normalization 194 | id = str(bit_length)+'_'+str(fsSNR)+'_'+str(nsSNR) 195 | with open('meanvar/meanvar_'+id+'.pickle') as g: # Python 3: open(..., 'wb') 196 | mean1, var1 = pickle.load(g) 197 | x_mean = tf.Variable(mean1, tf.float32) 198 | x_var = tf.Variable(var1, tf.float32) 199 | 200 | x = (x-x_mean)*1.0/tf.sqrt(x_var) 201 | return x 202 | 203 | # coderate. takeNoise 204 | def takeNoise(x): 205 | return tf.reshape(x[:,:,coderate+1:2*coderate+1],[tf.shape(x[:,:,0])[0],bit_length,coderate]) # 4 - N_i // 5 - M_i // 6 - O_i 206 | # takeBit. BPSK modulation 207 | def takeBit(x): 208 | return tf.reshape(2*x[:,:,0]-1,[tf.shape(x[:,:,0])[0],bit_length,1]) 209 | 210 | def concat(x): 211 | return K.concatenate(x) 212 | 213 | inputs = Input(shape=(bit_length, 2*coderate+1)) 214 | x = inputs 215 | 216 | # Take input for parity generation 217 | def split_data_input_noisedelay(x): 218 | x1 = x[:,:,0:coderate+1] # E.g., for coderate=3: 0 - b_i // 1 - N_i in Phase I // 2 - M_{i-1} in Phase II // 3 - O_{i-1} in Phase II. 219 | return x1 220 | 221 | parity = f3(f1(Lambda(split_data_input_noisedelay)(x))) # Generate parity based on message bits and Phase I noise and delayed Phase II noise 222 | norm_parity = Lambda(normalize)(parity) # Normalize the parity 223 | codeword = Lambda(concat)([Lambda(takeBit)(x),norm_parity]) # Codeword: raw bits and normalized parity 224 | powerd_codeword = ScaledLayer(name='noload_abr')(codeword) # Codeword after Power Allocation 225 | 226 | noise = Lambda(takeNoise)(x) 227 | noisy_received = keras.layers.add([powerd_codeword,noise]) # Received value: Sum of noise & codeword 228 | predictions = f8(f7(f6(f5(f4(noisy_received))))) # Decoder output 229 | 230 | # output of model_cw is encoder's power allocated codeword 231 | model_cw = Model(inputs=inputs, outputs=powerd_codeword) 232 | optimizer= keras.optimizers.adam(lr=0.02,clipnorm=1.) 233 | model_cw.compile(optimizer=optimizer,loss=customLoss, metrics=[errors]) 234 | 235 | # output of model is decoder's estimate 236 | model = Model(inputs=inputs, outputs=predictions) 237 | optimizer= keras.optimizers.adam(lr=0.02,clipnorm=1.) 238 | model.compile(optimizer=optimizer,loss=customLoss, metrics=[errors]) 239 | 240 | id = str(bit_length)+'_'+str(fsSNR)+'_'+str(nsSNR) 241 | 242 | # Load model 243 | if '-fs' in n_inp: 244 | model.load_weights('model/round3_powerabr_new_noisy_nettype_rnnrate3tx_50_rx_50_len_51_'+str(fsSNR)+'_0.h5',by_name=True) 245 | print 'model noise', str(fsSNR),'dB' 246 | else: 247 | model.load_weights('model/round4_powerabr_new_nettype_rnnrate3tx_50_rx_50_len_51_20_'+str(nsSNR)+'.h5',by_name=True) 248 | print 'model', str(nsSNR),'dB' 249 | 250 | 251 | # Generate test examples: X_train (X_test) is true label. X_train_noise (X_test_noise) is input to the neural network 252 | # Generate test examples: information bits X_train (X_test) 253 | print 'Generate test examples' 254 | X_train_raw = np.random.randint(0,2,k) 255 | X_test_raw = np.random.randint(0,2,k) 256 | X_train = X_train_raw.reshape((k/bit_length, bit_length, 1)) 257 | X_test = X_test_raw.reshape((k/bit_length, bit_length, 1)) 258 | 259 | # Generate test examples: input to the neural network X_train_noise (X_test_noise) 260 | # Input to neural network: message bits and noise sequence in Phase I(n_1,...,n_bitlength) and Phase II (m_1, o_1, m_2, o_2, ..., m_bitlength, o_bitlength) 261 | # Form the input as: X_train_noise[batch_index,i,:] = [b_i, n_i, m_{i-1}, o_{i-1}, n_i, m_i, o_i] for i = 1:bitlength 262 | 263 | X_train_noise = np.zeros([k/bit_length, bit_length, 2*coderate+1]) 264 | X_train_noise[:,:,0] = X_train[:,:,0] # True message bits 265 | X_train_noise[:,bit_length-1,0] = np.zeros(X_train_noise[:,bit_length-1,0].shape) # Set the last Bit to be 0. 266 | 267 | for inx in range(1,coderate+1): 268 | X_train_noise[:,:,coderate+inx] = noise_sigma * np.random.standard_normal(X_train_noise[:,:,coderate+inx].shape) # Noise 269 | if inx == 1: 270 | X_train_noise[:,:,inx] = np.roll(X_train_noise[:,:,coderate+inx], 0, axis=1) + feedback_sigma * np.random.standard_normal(X_train_noise[:,:,3].shape) # Delayed Noise 271 | else: 272 | X_train_noise[:,:,inx] = np.roll(X_train_noise[:,:,coderate+inx], 1, axis=1) + feedback_sigma * np.random.standard_normal(X_train_noise[:,:,4].shape) # Delayed Noise 273 | X_train_noise[:,0,inx] = 0 274 | 275 | X_test_noise = np.zeros([k/bit_length, bit_length,2*coderate+1]) 276 | X_test_noise[:,:,0] = X_test[:,:,0] # True message bits 277 | X_test_noise[:,bit_length-1,0] = np.zeros(X_test_noise[:,bit_length-1,0].shape) # Set the last Bit to be 0. 278 | for inx in range(1,coderate+1): 279 | X_test_noise[:,:,coderate+inx] = noise_sigma * np.random.standard_normal(X_test_noise[:,:,coderate+inx].shape) # Noise 280 | if inx == 1: 281 | X_test_noise[:,:,inx] = np.roll(X_test_noise[:,:,coderate+inx], 0, axis=1) + feedback_sigma * np.random.standard_normal(X_test_noise[:,:,3].shape) # Delayed Noise 282 | else: 283 | X_test_noise[:,:,inx] = np.roll(X_test_noise[:,:,coderate+inx], 1, axis=1) + feedback_sigma * np.random.standard_normal(X_test_noise[:,:,4].shape) # Delayed Noise 284 | X_test_noise[:,0,inx] = 0 285 | 286 | 287 | print '-------Evaluation start-------' 288 | test_batch_size = 200 289 | codewords = model_cw.predict(X_test_noise, batch_size=test_batch_size) 290 | print 'power of codewords: ', np.var(codewords) 291 | print 'mean of codewords: ', np.mean(codewords) 292 | 293 | predicted = np.round(model.predict(X_test_noise, batch_size=test_batch_size)) 294 | predicted = predicted[:,0:bit_length-1,:] # Ignore the last bit (zero padding) 295 | target = X_test[:,0:bit_length-1,:].reshape([X_test.shape[0],X_test.shape[1]-1,1]) # Ignore the last bit (zero padding) 296 | 297 | # BER 298 | c_ber = 1- sum(sum(predicted == target))*\ 299 | 1.0/(target.shape[0] * target.shape[1] *target.shape[2]) 300 | # BLER 301 | tp0 = (abs(np.round(predicted)-target)).reshape([target.shape[0],target.shape[1]]) 302 | bler = sum(np.sum(tp0,axis=1)>0)*1.0/(target.shape[0]) 303 | 304 | print 'BER of decoder estimate: ', c_ber[0] 305 | print 'BLER of decoder estimate: ', bler 306 | 307 | # Interpret: generate Figure 5 308 | interpret = True 309 | 310 | if interpret == True: 311 | 312 | r1 = X_test_noise[:,:,0] # b_i 313 | n1 = X_test_noise[:,:,1] # N_i 314 | n2 = X_test_noise[:,:,2] # M_{i-1} 315 | n3 = X_test_noise[:,:,3] # O_{i-1} 316 | p1 = codewords[:,:,1] # Parity1_i 317 | p2 = codewords[:,:,2] # Parity2_i 318 | 319 | num_sample_points = 20 # Number of sample points 320 | rr1 = r1[0:num_sample_points,:] # b_i 321 | nn1 = n1[0:num_sample_points,:] # N_i 322 | nn2 = n2[0:num_sample_points,:] # M_{i-1} 323 | nn3 = n3[0:num_sample_points,:] # O_{i-1} 324 | pp1 = p1[0:num_sample_points,:] # Parity1_i 325 | pp2 = p2[0:num_sample_points,:] # Parity2_i 326 | 327 | plt.close() 328 | plt.plot(nn1[rr1==0],pp1[rr1==0],'r.') 329 | plt.plot(nn1[rr1==1],pp1[rr1==1],'bx') 330 | plt.savefig('figs/SNR'+str(nsSNR)+'plot'+str(num_sample_points)+'_PhaseI_noise_vs_parity1.png') 331 | 332 | plt.close() 333 | plt.plot(nn1[rr1==0],pp2[rr1==0],'r.') 334 | plt.plot(nn1[rr1==1],pp2[rr1==1],'bx') 335 | plt.savefig('figs/SNR'+str(nsSNR)+'plot'+str(num_sample_points)+'_PhaseI_noise_vs_parity2.png') 336 | 337 | plt.close() 338 | plt.plot(pp1[rr1==0],pp2[rr1==0],'r.') 339 | plt.plot(pp1[rr1==1],pp2[rr1==1],'bx') 340 | plt.savefig('figs/SNR'+str(nsSNR)+'plot_'+str(num_sample_points)+'_parity1_vs_parity2.png') 341 | 342 | 343 | 344 | 345 | 346 | --------------------------------------------------------------------------------