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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""Atmosecure 2.0
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1x0I-yURUQrFwXE8cUwmTB4gLXN5FK2G_
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import torch
|
| 11 |
+
import torch.nn as nn
|
| 12 |
+
import torch.optim as optim
|
| 13 |
+
import numpy as np
|
| 14 |
+
import matplotlib.pyplot as plt
|
| 15 |
+
|
| 16 |
+
# Define wealth wave function
|
| 17 |
+
def wealth_wave(t, freq, phase_shift=0):
|
| 18 |
+
return torch.sin(2 * np.pi * freq * t + phase_shift)
|
| 19 |
+
|
| 20 |
+
# Neural Network class representing brain signals directed to nerves
|
| 21 |
+
class WealthBrainModel(nn.Module):
|
| 22 |
+
def __init__(self):
|
| 23 |
+
super(WealthBrainModel, self).__init__()
|
| 24 |
+
# Define layers of the network
|
| 25 |
+
self.fc1 = nn.Linear(1, 64) # Input layer (brain)
|
| 26 |
+
self.fc2 = nn.Linear(64, 64) # Hidden layer (signal propagation)
|
| 27 |
+
self.fc3 = nn.Linear(64, 64) # Storage layer (wealth data stored in nerves)
|
| 28 |
+
self.fc4 = nn.Linear(64, 1) # Pulse layer (output pulse representing stored data)
|
| 29 |
+
|
| 30 |
+
def forward(self, x):
|
| 31 |
+
# Wealth signal propagation through layers
|
| 32 |
+
x = torch.relu(self.fc1(x)) # Brain layer
|
| 33 |
+
x = torch.relu(self.fc2(x)) # Signal propagation layer
|
| 34 |
+
stored_data = torch.relu(self.fc3(x)) # Store data in the nerves
|
| 35 |
+
|
| 36 |
+
# Generate pulse signal based on stored data
|
| 37 |
+
pulse_signal = torch.sigmoid(self.fc4(stored_data))
|
| 38 |
+
return pulse_signal, stored_data
|
| 39 |
+
|
| 40 |
+
# Initialize the model
|
| 41 |
+
model = WealthBrainModel()
|
| 42 |
+
|
| 43 |
+
# Define optimizer and loss function
|
| 44 |
+
optimizer = optim.Adam(model.parameters(), lr=0.001)
|
| 45 |
+
criterion = nn.MSELoss()
|
| 46 |
+
|
| 47 |
+
# Time steps and frequencies for the wealth waves
|
| 48 |
+
time_steps = torch.linspace(0, 10, 1000)
|
| 49 |
+
freq_alpha = 10 # Alpha frequency (10 Hz)
|
| 50 |
+
freq_beta = 20 # Beta frequency (20 Hz)
|
| 51 |
+
freq_gamma = 40 # Gamma frequency (40 Hz)
|
| 52 |
+
|
| 53 |
+
# Simulate a continuous loop of wealth wave propagation
|
| 54 |
+
stored_data_all = []
|
| 55 |
+
for epoch in range(100): # Simulate over 100 epochs (continuous propagation)
|
| 56 |
+
model.train()
|
| 57 |
+
|
| 58 |
+
# Generate wealth waves with phase shifts
|
| 59 |
+
wealth_alpha = wealth_wave(time_steps, freq_alpha, phase_shift=epoch)
|
| 60 |
+
wealth_beta = wealth_wave(time_steps, freq_beta, phase_shift=epoch + 0.5)
|
| 61 |
+
wealth_gamma = wealth_wave(time_steps, freq_gamma, phase_shift=epoch + 1)
|
| 62 |
+
|
| 63 |
+
# Combine signals (multi-layered wealth wave)
|
| 64 |
+
wealth_input = wealth_alpha + wealth_beta + wealth_gamma
|
| 65 |
+
wealth_input = wealth_input.unsqueeze(1) # Reshape for model input
|
| 66 |
+
|
| 67 |
+
# Forward pass through the network (brain -> nerves -> stored pulse)
|
| 68 |
+
pulse_signal, stored_data = model(wealth_input)
|
| 69 |
+
|
| 70 |
+
# Store the data for analysis
|
| 71 |
+
stored_data_all.append(stored_data.detach().numpy())
|
| 72 |
+
|
| 73 |
+
# Compute loss (if needed, could be set up to simulate nerve response)
|
| 74 |
+
target = torch.zeros_like(pulse_signal) # Dummy target
|
| 75 |
+
loss = criterion(pulse_signal, target)
|
| 76 |
+
|
| 77 |
+
# Backpropagation
|
| 78 |
+
optimizer.zero_grad()
|
| 79 |
+
loss.backward()
|
| 80 |
+
optimizer.step()
|
| 81 |
+
|
| 82 |
+
# Plot the pulse signal at every few steps to visualize pulse storage
|
| 83 |
+
if epoch % 10 == 0:
|
| 84 |
+
plt.plot(time_steps.numpy(), pulse_signal.detach().numpy(), label=f'Epoch {epoch}')
|
| 85 |
+
|
| 86 |
+
plt.title("Wealth Data Stored as Pulse in Nerves")
|
| 87 |
+
plt.xlabel("Time")
|
| 88 |
+
plt.ylabel("Pulse Signal")
|
| 89 |
+
plt.legend()
|
| 90 |
+
plt.show()
|
| 91 |
+
|
| 92 |
+
# Visualize stored wealth data over time
|
| 93 |
+
#plt.imshow(np.array(stored_data_all).squeeze().T, aspect='auto', cmap='viridis') # Transpose the array to get the correct orientation
|
| 94 |
+
# The above line caused the error. We need to average across the 1000 data points.
|
| 95 |
+
plt.imshow(np.mean(np.array(stored_data_all), axis=1).T, aspect='auto', cmap='viridis') # Average across the first axis
|
| 96 |
+
plt.colorbar(label="Stored Wealth Data in Nerves")
|
| 97 |
+
plt.xlabel("Epochs")
|
| 98 |
+
plt.ylabel("Nerve Data Points")
|
| 99 |
+
plt.title("Stored Wealth Data in Nerves Over Time")
|
| 100 |
+
plt.show()
|
| 101 |
+
|
| 102 |
+
# Visualize stored wealth data over time
|
| 103 |
+
#plt.imshow(np.array(stored_data_all).squeeze().T, aspect='auto', cmap='viridis') # Transpose the array to get the correct orientation
|
| 104 |
+
# The above line caused the error. We need to average across the 1000 data points.
|
| 105 |
+
plt.imshow(np.mean(np.array(stored_data_all), axis=1).T, aspect='auto', cmap='viridis') # Average across the first axis
|
| 106 |
+
plt.colorbar(label="Stored Wealth Data in Nerves")
|
| 107 |
+
plt.xlabel("Epochs")
|
| 108 |
+
plt.ylabel("Nerve Data Points")
|
| 109 |
+
plt.title("Stored Wealth Data in Nerves Over Time")
|
| 110 |
+
plt.show()
|
| 111 |
+
|
| 112 |
+
import torch
|
| 113 |
+
import torch.nn as nn
|
| 114 |
+
import torch.optim as optim
|
| 115 |
+
import numpy as np
|
| 116 |
+
import matplotlib.pyplot as plt
|
| 117 |
+
|
| 118 |
+
# Define wealth wave function
|
| 119 |
+
def wealth_wave(t, freq, phase_shift=0):
|
| 120 |
+
return torch.sin(2 * np.pi * freq * t + phase_shift)
|
| 121 |
+
|
| 122 |
+
# Neural Network class representing brain signals directed to nerves
|
| 123 |
+
class WealthBrainModel(nn.Module):
|
| 124 |
+
def __init__(self):
|
| 125 |
+
super(WealthBrainModel, self).__init__()
|
| 126 |
+
# Define layers of the network
|
| 127 |
+
self.fc1 = nn.Linear(1, 64) # Input layer (brain)
|
| 128 |
+
self.fc2 = nn.Linear(64, 64) # Hidden layer (signal propagation)
|
| 129 |
+
self.fc3 = nn.Linear(64, 64) # Storage layer (wealth data stored in nerves)
|
| 130 |
+
self.fc4 = nn.Linear(64, 1) # Pulse layer (output pulse representing stored data)
|
| 131 |
+
|
| 132 |
+
def forward(self, x):
|
| 133 |
+
# Wealth signal propagation through layers
|
| 134 |
+
x = torch.relu(self.fc1(x)) # Brain layer
|
| 135 |
+
x = torch.relu(self.fc2(x)) # Signal propagation layer
|
| 136 |
+
stored_data = torch.relu(self.fc3(x)) # Store data in the nerves
|
| 137 |
+
|
| 138 |
+
# Generate pulse signal based on stored data
|
| 139 |
+
pulse_signal = torch.sigmoid(self.fc4(stored_data))
|
| 140 |
+
return pulse_signal, stored_data
|
| 141 |
+
|
| 142 |
+
# Initialize the model
|
| 143 |
+
model = WealthBrainModel()
|
| 144 |
+
|
| 145 |
+
# Define optimizer and loss function
|
| 146 |
+
optimizer = optim.Adam(model.parameters(), lr=0.001)
|
| 147 |
+
criterion = nn.MSELoss()
|
| 148 |
+
|
| 149 |
+
# Time steps and frequencies for the wealth waves
|
| 150 |
+
time_steps = torch.linspace(0, 10, 1000)
|
| 151 |
+
freq_alpha = 10 # Alpha frequency (10 Hz)
|
| 152 |
+
freq_beta = 20 # Beta frequency (20 Hz)
|
| 153 |
+
freq_gamma = 40 # Gamma frequency (40 Hz)
|
| 154 |
+
|
| 155 |
+
# Simulate a continuous loop of wealth wave propagation
|
| 156 |
+
stored_data_all = []
|
| 157 |
+
for epoch in range(100): # Simulate over 100 epochs (continuous propagation)
|
| 158 |
+
model.train()
|
| 159 |
+
|
| 160 |
+
# Generate wealth waves with phase shifts
|
| 161 |
+
wealth_alpha = wealth_wave(time_steps, freq_alpha, phase_shift=epoch)
|
| 162 |
+
wealth_beta = wealth_wave(time_steps, freq_beta, phase_shift=epoch + 0.5)
|
| 163 |
+
wealth_gamma = wealth_wave(time_steps, freq_gamma, phase_shift=epoch + 1)
|
| 164 |
+
|
| 165 |
+
# Combine signals (multi-layered wealth wave)
|
| 166 |
+
wealth_input = wealth_alpha + wealth_beta + wealth_gamma
|
| 167 |
+
wealth_input = wealth_input.unsqueeze(1) # Reshape for model input
|
| 168 |
+
|
| 169 |
+
# Forward pass through the network (brain -> nerves -> stored pulse)
|
| 170 |
+
pulse_signal, stored_data = model(wealth_input)
|
| 171 |
+
|
| 172 |
+
# Store the data for analysis
|
| 173 |
+
stored_data_all.append(stored_data.detach().numpy())
|
| 174 |
+
|
| 175 |
+
# Compute loss (if needed, could be set up to simulate nerve response)
|
| 176 |
+
target = torch.zeros_like(pulse_signal) # Dummy target
|
| 177 |
+
loss = criterion(pulse_signal, target)
|
| 178 |
+
|
| 179 |
+
# Backpropagation
|
| 180 |
+
optimizer.zero_grad()
|
| 181 |
+
loss.backward()
|
| 182 |
+
optimizer.step()
|
| 183 |
+
|
| 184 |
+
# Plot the pulse signal at every few steps to visualize pulse storage
|
| 185 |
+
if epoch % 10 == 0:
|
| 186 |
+
plt.plot(time_steps.numpy(), pulse_signal.detach().numpy(), label=f'Epoch {epoch}')
|
| 187 |
+
|
| 188 |
+
plt.title("Wealth Data Stored as Pulse in Nerves")
|
| 189 |
+
plt.xlabel("Time")
|
| 190 |
+
plt.ylabel("Pulse Signal")
|
| 191 |
+
plt.legend()
|
| 192 |
+
plt.show()
|
| 193 |
+
|
| 194 |
+
# Visualize stored wealth data over time
|
| 195 |
+
#plt.imshow(np.array(stored_data_all).squeeze().T, aspect='auto', cmap='viridis') # Transpose the array to get the correct orientation
|
| 196 |
+
# The above line caused the error. We need to average across the 1000 data points.
|
| 197 |
+
plt.imshow(np.mean(np.array(stored_data_all), axis=1).T, aspect='auto', cmap='viridis') # Average across the first axis
|
| 198 |
+
plt.colorbar(label="Stored Wealth Data in Nerves")
|
| 199 |
+
plt.xlabel("Epochs")
|
| 200 |
+
plt.ylabel("Nerve Data Points")
|
| 201 |
+
plt.title("Stored Wealth Data in Nerves Over Time")
|
| 202 |
+
plt.show()
|
| 203 |
+
|
| 204 |
+
import torch
|
| 205 |
+
import torch.nn as nn
|
| 206 |
+
import torch.optim as optim
|
| 207 |
+
import numpy as np
|
| 208 |
+
import matplotlib.pyplot as plt
|
| 209 |
+
|
| 210 |
+
# Define wealth wave function
|
| 211 |
+
def wealth_wave(t, freq, phase_shift=0):
|
| 212 |
+
return torch.sin(2 * np.pi * freq * t + phase_shift)
|
| 213 |
+
|
| 214 |
+
# Neural Network class representing brain signals directed to nerves with VPN protection
|
| 215 |
+
class WealthBrainModel(nn.Module):
|
| 216 |
+
def __init__(self):
|
| 217 |
+
super(WealthBrainModel, self).__init__()
|
| 218 |
+
# Define layers of the network
|
| 219 |
+
self.fc1 = nn.Linear(1, 64) # Input layer (brain)
|
| 220 |
+
self.fc2 = nn.Linear(64, 64) # Hidden layer (signal propagation)
|
| 221 |
+
self.fc3 = nn.Linear(64, 64) # Storage layer (wealth data stored in nerves)
|
| 222 |
+
self.fc_vpn = nn.Linear(64, 64) # VPN protection layer
|
| 223 |
+
self.fc4 = nn.Linear(64, 1) # Pulse layer (output pulse representing stored data)
|
| 224 |
+
|
| 225 |
+
def forward(self, x):
|
| 226 |
+
# Wealth signal propagation through layers
|
| 227 |
+
x = torch.relu(self.fc1(x)) # Brain layer
|
| 228 |
+
x = torch.relu(self.fc2(x)) # Signal propagation layer
|
| 229 |
+
stored_data = torch.relu(self.fc3(x)) # Store data in the nerves
|
| 230 |
+
|
| 231 |
+
# VPN protection layer: Protect the stored wealth data
|
| 232 |
+
protected_data = torch.relu(self.fc_vpn(stored_data)) # Data is encrypted and protected here
|
| 233 |
+
|
| 234 |
+
# Generate pulse signal based on protected data
|
| 235 |
+
pulse_signal = torch.sigmoid(self.fc4(protected_data))
|
| 236 |
+
return pulse_signal, protected_data
|
| 237 |
+
|
| 238 |
+
# Initialize the model
|
| 239 |
+
model = WealthBrainModel()
|
| 240 |
+
|
| 241 |
+
# Define optimizer and loss function
|
| 242 |
+
optimizer = optim.Adam(model.parameters(), lr=0.001)
|
| 243 |
+
criterion = nn.MSELoss()
|
| 244 |
+
|
| 245 |
+
# Time steps and frequencies for the wealth waves
|
| 246 |
+
time_steps = torch.linspace(0, 10, 1000)
|
| 247 |
+
freq_alpha = 10 # Alpha frequency (10 Hz)
|
| 248 |
+
freq_beta = 20 # Beta frequency (20 Hz)
|
| 249 |
+
freq_gamma = 40 # Gamma frequency (40 Hz)
|
| 250 |
+
|
| 251 |
+
# Simulate a continuous loop of wealth wave propagation
|
| 252 |
+
stored_data_all = []
|
| 253 |
+
for epoch in range(100): # Simulate over 100 epochs (continuous propagation)
|
| 254 |
+
model.train()
|
| 255 |
+
|
| 256 |
+
# Generate wealth waves with phase shifts
|
| 257 |
+
wealth_alpha = wealth_wave(time_steps, freq_alpha, phase_shift=epoch)
|
| 258 |
+
wealth_beta = wealth_wave(time_steps, freq_beta, phase_shift=epoch + 0.5)
|
| 259 |
+
wealth_gamma = wealth_wave(time_steps, freq_gamma, phase_shift=epoch + 1)
|
| 260 |
+
|
| 261 |
+
# Combine signals (multi-layered wealth wave)
|
| 262 |
+
wealth_input = wealth_alpha + wealth_beta + wealth_gamma
|
| 263 |
+
wealth_input = wealth_input.unsqueeze(1) # Reshape for model input
|
| 264 |
+
|
| 265 |
+
# Forward pass through the network (brain -> nerves -> VPN -> stored pulse)
|
| 266 |
+
pulse_signal, protected_data = model(wealth_input)
|
| 267 |
+
|
| 268 |
+
# Store the protected data for analysis
|
| 269 |
+
stored_data_all.append(protected_data.detach().numpy())
|
| 270 |
+
|
| 271 |
+
# Simulate intruders (random noise) trying to tamper with the data
|
| 272 |
+
intruder_noise = torch.randn_like(pulse_signal) * 0.1 # Small noise signal
|
| 273 |
+
corrupted_pulse = pulse_signal + intruder_noise # Intruder tries to corrupt the pulse
|
| 274 |
+
|
| 275 |
+
# Compute loss based on how well the VPN layer protects from noise
|
| 276 |
+
loss = criterion(corrupted_pulse, pulse_signal) # Aim to protect pulse from noise
|
| 277 |
+
|
| 278 |
+
# Backpropagation
|
| 279 |
+
optimizer.zero_grad()
|
| 280 |
+
loss.backward()
|
| 281 |
+
optimizer.step()
|
| 282 |
+
|
| 283 |
+
# Plot the pulse signal at every few steps to visualize protection
|
| 284 |
+
if epoch % 10 == 0:
|
| 285 |
+
plt.plot(time_steps.numpy(), pulse_signal.detach().numpy(), label=f'Epoch {epoch}')
|
| 286 |
+
|
| 287 |
+
plt.title("Wealth Data Protected by VPN Layer")
|
| 288 |
+
plt.xlabel("Time")
|
| 289 |
+
plt.ylabel("Pulse Signal")
|
| 290 |
+
plt.legend()
|
| 291 |
+
plt.show()
|
| 292 |
+
|
| 293 |
+
# Visualize protected wealth data over time
|
| 294 |
+
plt.imshow(np.mean(np.array(stored_data_all), axis=0), aspect='auto', cmap='viridis') # Average across the first axis to get a 2D array
|
| 295 |
+
plt.colorbar(label="Protected Wealth Data in Nerves")
|
| 296 |
+
plt.xlabel("Epochs")
|
| 297 |
+
plt.ylabel("Nerve Data Points")
|
| 298 |
+
plt.title("Protected Wealth Data in Nerves Over Time")
|
| 299 |
+
plt.show()
|
| 300 |
+
|
| 301 |
+
import torch
|
| 302 |
+
import torch.nn as nn
|
| 303 |
+
import torch.optim as optim
|
| 304 |
+
import numpy as np
|
| 305 |
+
import matplotlib.pyplot as plt
|
| 306 |
+
|
| 307 |
+
# Define wealth wave function
|
| 308 |
+
def wealth_wave(t, freq, phase_shift=0):
|
| 309 |
+
return torch.sin(2 * np.pi * freq * t + phase_shift)
|
| 310 |
+
|
| 311 |
+
# Neural Network class representing brain signals directed to nerves with VPN protection
|
| 312 |
+
class WealthBrainModel(nn.Module):
|
| 313 |
+
def __init__(self):
|
| 314 |
+
super(WealthBrainModel, self).__init__()
|
| 315 |
+
# Define layers of the network
|
| 316 |
+
self.fc1 = nn.Linear(1, 64) # Input layer (brain)
|
| 317 |
+
self.fc2 = nn.Linear(64, 64) # Hidden layer (signal propagation)
|
| 318 |
+
self.fc3 = nn.Linear(64, 64) # Storage layer (wealth data stored in nerves)
|
| 319 |
+
self.fc_vpn = nn.Linear(64, 64) # VPN protection layer
|
| 320 |
+
self.fc4 = nn.Linear(64, 1) # Pulse layer (output pulse representing stored data)
|
| 321 |
+
|
| 322 |
+
def forward(self, x):
|
| 323 |
+
# Wealth signal propagation through layers
|
| 324 |
+
x = torch.relu(self.fc1(x)) # Brain layer
|
| 325 |
+
x = torch.relu(self.fc2(x)) # Signal propagation layer
|
| 326 |
+
stored_data = torch.relu(self.fc3(x)) # Store data in the nerves
|
| 327 |
+
|
| 328 |
+
# VPN protection layer: Protect the stored wealth data
|
| 329 |
+
protected_data = torch.relu(self.fc_vpn(stored_data)) # Data is encrypted and protected here
|
| 330 |
+
|
| 331 |
+
# Generate pulse signal based on protected data
|
| 332 |
+
pulse_signal = torch.sigmoid(self.fc4(protected_data))
|
| 333 |
+
return pulse_signal, protected_data
|
| 334 |
+
|
| 335 |
+
# Initialize the model
|
| 336 |
+
model = WealthBrainModel()
|
| 337 |
+
|
| 338 |
+
# Define optimizer and loss function
|
| 339 |
+
optimizer = optim.Adam(model.parameters(), lr=0.001)
|
| 340 |
+
criterion = nn.MSELoss()
|
| 341 |
+
|
| 342 |
+
# Time steps and frequencies for the wealth waves
|
| 343 |
+
time_steps = torch.linspace(0, 10, 1000)
|
| 344 |
+
freq_alpha = 10 # Alpha frequency (10 Hz)
|
| 345 |
+
freq_beta = 20 # Beta frequency (20 Hz)
|
| 346 |
+
freq_gamma = 40 # Gamma frequency (40 Hz)
|
| 347 |
+
|
| 348 |
+
# Simulate a continuous loop of wealth wave propagation
|
| 349 |
+
stored_data_all = []
|
| 350 |
+
for epoch in range(100): # Simulate over 100 epochs (continuous propagation)
|
| 351 |
+
model.train()
|
| 352 |
+
|
| 353 |
+
# Generate wealth waves with phase shifts
|
| 354 |
+
wealth_alpha = wealth_wave(time_steps, freq_alpha, phase_shift=epoch)
|
| 355 |
+
wealth_beta = wealth_wave(time_steps, freq_beta, phase_shift=epoch + 0.5)
|
| 356 |
+
wealth_gamma = wealth_wave(time_steps, freq_gamma, phase_shift=epoch + 1)
|
| 357 |
+
|
| 358 |
+
# Combine signals (multi-layered wealth wave)
|
| 359 |
+
wealth_input = wealth_alpha + wealth_beta + wealth_gamma
|
| 360 |
+
wealth_input = wealth_input.unsqueeze(1) # Reshape for model input
|
| 361 |
+
|
| 362 |
+
# Forward pass through the network (brain -> nerves -> VPN -> stored pulse)
|
| 363 |
+
pulse_signal, protected_data = model(wealth_input)
|
| 364 |
+
|
| 365 |
+
# Store the protected data for analysis
|
| 366 |
+
stored_data_all.append(protected_data.detach().numpy())
|
| 367 |
+
|
| 368 |
+
# Simulate intruders (random noise) trying to tamper with the data
|
| 369 |
+
intruder_noise = torch.randn_like(pulse_signal) * 0.1 # Small noise signal
|
| 370 |
+
corrupted_pulse = pulse_signal + intruder_noise # Intruder tries to corrupt the pulse
|
| 371 |
+
|
| 372 |
+
# Compute loss based on how well the VPN layer protects from noise
|
| 373 |
+
loss = criterion(corrupted_pulse, pulse_signal) # Aim to protect pulse from noise
|
| 374 |
+
|
| 375 |
+
# Backpropagation
|
| 376 |
+
optimizer.zero_grad()
|
| 377 |
+
loss.backward()
|
| 378 |
+
optimizer.step()
|
| 379 |
+
|
| 380 |
+
# Plot the pulse signal at every few steps to visualize protection
|
| 381 |
+
if epoch % 10 == 0:
|
| 382 |
+
plt.plot(time_steps.numpy(), pulse_signal.detach().numpy(), label=f'Epoch {epoch}')
|
| 383 |
+
|
| 384 |
+
plt.title("Wealth Data Protected by VPN Layer")
|
| 385 |
+
plt.xlabel("Time")
|
| 386 |
+
plt.ylabel("Pulse Signal")
|
| 387 |
+
plt.legend()
|
| 388 |
+
plt.show()
|
| 389 |
+
|
| 390 |
+
# Visualize protected wealth data over time
|
| 391 |
+
plt.imshow(np.mean(np.array(stored_data_all), axis=0), aspect='auto', cmap='viridis') # Average across the first axis to get a 2D array
|
| 392 |
+
plt.colorbar(label="Protected Wealth Data in Nerves")
|
| 393 |
+
plt.xlabel("Epochs")
|
| 394 |
+
plt.ylabel("Nerve Data Points")
|
| 395 |
+
plt.title("Protected Wealth Data in Nerves Over Time")
|
| 396 |
+
plt.show()
|