| |
| """ |
| Quick demonstration of Algebraic Neural Networks |
| |
| Run this script to see the basic functionality of algebraic neural networks. |
| """ |
|
|
| import numpy as np |
| from algebraic_neural_network import create_sample_network, create_uncomputable_network |
|
|
| def main(): |
| print("๐งฎ Algebraic Neural Network Quick Demo") |
| print("="*50) |
| |
| |
| print("1. Creating algebraic neural network...") |
| network = create_sample_network() |
| print(" โ Network created with polynomial, group theory, and geometric algebra layers") |
| |
| |
| print("\n2. Generating sample data...") |
| np.random.seed(42) |
| sample_data = np.random.randn(3, 4) |
| print(f" โ Generated {sample_data.shape[0]} samples with {sample_data.shape[1]} features each") |
| |
| |
| print("\n3. Processing data through algebraic transformations...") |
| predictions = network.predict(sample_data) |
| print(f" โ Output shape: {predictions.shape}") |
| print(f" โ Output range: [{np.min(predictions):.3f}, {np.max(predictions):.3f}]") |
| |
| |
| print("\n4. Results:") |
| print(" Input data:") |
| for i, sample in enumerate(sample_data): |
| print(f" Sample {i+1}: [{sample[0]:6.3f}, {sample[1]:6.3f}, {sample[2]:6.3f}, {sample[3]:6.3f}]") |
| |
| print("\n Algebraic neural network output:") |
| for i, output in enumerate(predictions): |
| print(f" Output {i+1}: [{output[0]:8.3f}, {output[1]:8.3f}]") |
| |
| |
| print("\n5. Demonstrating deterministic behavior...") |
| predictions2 = network.predict(sample_data) |
| difference = np.linalg.norm(predictions - predictions2) |
| print(f" โ Difference between runs: {difference:.10f} (should be 0)") |
| |
| print("\n" + "="*50) |
| print("โ
Demo completed! Algebraic neural networks work without training.") |
| |
| |
| print("\n๐ฌ Bonus: Uncomputable Neural Network Quick Demo") |
| print("="*50) |
| |
| print("1. Creating uncomputable neural network...") |
| uncomputable_network = create_uncomputable_network() |
| print(" โ Network created with halting oracle, Kolmogorov complexity, Busy Beaver, and non-recursive layers") |
| |
| print("\n2. Processing same data through uncomputable transformations...") |
| uncomputable_predictions = uncomputable_network.predict(sample_data) |
| print(f" โ Output shape: {uncomputable_predictions.shape}") |
| print(f" โ Output range: [{np.min(uncomputable_predictions):.3f}, {np.max(uncomputable_predictions):.3f}]") |
| |
| print("\n Uncomputable neural network output:") |
| for i, output in enumerate(uncomputable_predictions): |
| print(f" Output {i+1}: [{output[0]:6.3f}, {output[1]:6.3f}]") |
| |
| print("\n" + "="*50) |
| print("๐ฏ Both networks operate without training but explore different mathematical domains!") |
| print("๐ See theory/ and examples/ directories for more details.") |
|
|
| if __name__ == "__main__": |
| main() |