Desafio Final - Ipynb - Colab
Desafio Final - Ipynb - Colab
Desafio Final - Ipynb - Colab
ipynb - Colab
Identificação:
Matrícula: 222008486
1. Objetivo
O objetivo deste desafio é introduzir a ideia do Autoencoder, mostrando-se uma aplicação na área de telecomunicações.
Nesta aplicação, será implementada uma rede Autoencoder para realizar a codificação de símbolos enviados em um canal com ruído branco
aditivo gaussiano (Additive White Gaussian Noise - AWGN), gerando uma constelação própria.
Ao final, os resultados obtidos utilizando-se o Autoencoder serão comparados com o desempenho do detector ótimo, com a finalidade de
equiparar a taxa de erro dos dois sistemas.
Antes de iniciarmos, precisa-se que algumas bibliotecas já estejam disponíveis. São elas:
Para configurar o ambiente, será necessário permitir o acesso ao seu Google Drive, de onde serão importados os datasets, além de outros
módulos adicionais.
A célula abaixo irá "montar" o drive dentro do Google Colaboratory, ou seja, conseguiremos acessar diretamente todos os conteúdos presentes
no Google drive, possibilitando a execução do Jupyter Notebook a partir, unicamente, da nuvem.
Mounted at /content/drive/
import sys
Com o acesso permitido ao drive e com o ambiente preparado, podemos iniciar a importação das bibliotecas de Python que serão utilizadas
no nosso código.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Lambda
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.losses import MeanSquaredError
# Definições gerais
https://colab.research.google.com/drive/1L11dwGKFVhDHn60bM8LWM-SkFZcWR7Kz#scrollTo=F_4VFGJcc__M&printMode=true 1/4
14/07/2024, 19:57 Desafio Final.ipynb - Colab
np.random.seed(42)
tf.random.set_seed(42)
https://colab.research.google.com/drive/1L11dwGKFVhDHn60bM8LWM-SkFZcWR7Kz#scrollTo=F_4VFGJcc__M&printMode=true 2/4
14/07/2024, 19:57 Desafio Final.ipynb - Colab
def get_training_parameters(n, k):
# Definir parâmetros específicos para cada exercício
if n == 1 and k == 2:
# Exemplo de definição de parâmetros
return 1000, 50 # número de símbolos, número de epochs
# Adicionar mais condições conforme necessário
# ...
return 1000, 50 # valores padrão
https://colab.research.google.com/drive/1L11dwGKFVhDHn60bM8LWM-SkFZcWR7Kz#scrollTo=F_4VFGJcc__M&printMode=true 3/4
14/07/2024, 19:57 Desafio Final.ipynb - Colab
Epoch 1/50
4/4 [==============================] - 4s 64ms/step - loss: 0.3255 - val_loss: 0.2890
Epoch 2/50
4/4 [==============================] - 0s 11ms/step - loss: 0.2796 - val_loss: 0.2429
Epoch 3/50
4/4 [==============================] - 0s 11ms/step - loss: 0.2311 - val_loss: 0.1879
Epoch 4/50
4/4 [==============================] - 0s 10ms/step - loss: 0.1745 - val_loss: 0.1286
Epoch 5/50
4/4 [==============================] - 0s 12ms/step - loss: 0.1159 - val_loss: 0.0770
Epoch 6/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0698 - val_loss: 0.0497
Epoch 7/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0524 - val_loss: 0.0545
Epoch 8/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0596 - val_loss: 0.0587
Epoch 9/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0589 - val_loss: 0.0490
Epoch 10/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0492 - val_loss: 0.0429
Epoch 11/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0448 - val_loss: 0.0417
Epoch 12/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0435 - val_loss: 0.0390
Epoch 13/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0400 - val_loss: 0.0341
Epoch 14/50
4/4 [==============================] - 0s 10ms/step - loss: 0.0349 - val_loss: 0.0292
Epoch 15/50
4/4 [==============================] - 0s 14ms/step - loss: 0.0298 - val_loss: 0.0240
Epoch 16/50
4/4 [==============================] - 0s 16ms/step - loss: 0.0243 - val_loss: 0.0192
Epoch 17/50
4/4 [==============================] - 0s 12ms/step - loss: 0.0195 - val_loss: 0.0147
Epoch 18/50
4/4 [==============================] - 0s 14ms/step - loss: 0.0145 - val_loss: 0.0100
Epoch 19/50
4/4 [==============================] - 0s 13ms/step - loss: 0.0099 - val_loss: 0.0073
Epoch 20/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0073 - val_loss: 0.0056
Epoch 21/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0056 - val_loss: 0.0044
Epoch 22/50
4/4 [==============================] - 0s 13ms/step - loss: 0.0043 - val_loss: 0.0036
Epoch 23/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0035 - val_loss: 0.0029
Epoch 24/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0028 - val_loss: 0.0021
Epoch 25/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0020 - val_loss: 0.0013
Epoch 26/50
4/4 [==============================] - 0s 11ms/step - loss: 0.0013 - val_loss: 8.7562e-04
Epoch 27/50
4/4 [==============================] - 0s 19ms/step - loss: 9.0893e-04 - val_loss: 6.0852e-04
Epoch 28/50
4/4 [==============================] - 0s 17ms/step - loss: 6.6561e-04 - val_loss: 4.9568e-04
Epoch 29/50
4/4 [==============================] - 0s 17ms/step - loss: 5.3173e-04 - val_loss: 3.8246e-04
Epoch 30/50
4/4 [==============================] - 0s 15ms/step - loss: 4.0697e-04 - val_loss: 3.0141e-04
Epoch 31/50
4/4 [==============================] - 0s 16ms/step - loss: 3.2740e-04 - val_loss: 2.5273e-04
Epoch 32/50
4/4 [==============================] - 0s 15ms/step - loss: 2.7002e-04 - val_loss: 2.1351e-04
Epoch 33/50
4/4 [==============================] - 0s 14ms/step - loss: 2.2444e-04 - val_loss: 1.8003e-04
Epoch 34/50
4/4 [==============================] - 0s 22ms/step - loss: 1.9270e-04 - val_loss: 1.5291e-04
Epoch 35/50
4/4 [==============================] - 0s 18ms/step - loss: 1.6887e-04 - val_loss: 1.3462e-04
Epoch 36/50
4/4 [==============================] - 0s 25ms/step - loss: 1.4458e-04 - val_loss: 1.1714e-04
Epoch 37/50
4/4 [==============================] - 0s 23ms/step - loss: 1.2794e-04 - val_loss: 1.0341e-04
Epoch 38/50
4/4 [==============================] - 0s 20ms/step - loss: 1.1231e-04 - val_loss: 9.4279e-05
Epoch 39/50
4/4 [==============================] - 0s 20ms/step - loss: 1.0037e-04 - val_loss: 8.4704e-05
Epoch 40/50
4/4 [==============================] - 0s 21ms/step - loss: 9.2787e-05 - val_loss: 7.4006e-05
Epoch 41/50
4/4 [==============================] - 0s 21ms/step - loss: 8.2322e-05 - val_loss: 6.6032e-05
Epoch 42/50
4/4 [==============================] - 0s 21ms/step - loss: 7.3379e-05 - val_loss: 6.2934e-05
Epoch 43/50
4/4 [==============================] - 0s 13ms/step - loss: 6.8597e-05 - val_loss: 5.8198e-05
Epoch 44/50
4/4 [==============================] - 0s 14ms/step - loss: 6.4155e-05 - val_loss: 5.4946e-05
Epoch 45/50
4/4 [==============================] - 0s 15ms/step - loss: 6.0452e-05 - val_loss: 4.9068e-05
https://colab.research.google.com/drive/1L11dwGKFVhDHn60bM8LWM-SkFZcWR7Kz#scrollTo=F_4VFGJcc__M&printMode=true 4/4