A lightweight Python package for training neural networks to interpolate 5-dimensional numerical datasets
Project description
pydis_nn
A lightweight Python package for training and using neural networks to interpolate 5-dimensional numerical datasets. Built with TensorFlow/Keras and optimized for fast training and inference.
Features
- Data Handling: Load, validate, preprocess, and split 5D datasets (
.pklformat) - Neural Network: Configurable feedforward neural network with customizable architecture
- Training: Train models with optional validation data and early stopping
- Evaluation: Compute R² scores and MSE metrics on test sets
- Utilities: Generate synthetic 5D datasets for testing
Quick Start
Installation
pip install pydis_nn
Basic Usage
from pydis_nn import NeuralNetwork, load_and_preprocess
# Load and preprocess your dataset
data = load_and_preprocess('your_dataset.pkl', random_state=42)
# Create and train a neural network
model = NeuralNetwork(
hidden_sizes=[64, 32, 16], # 3 hidden layers
learning_rate=0.001,
max_iter=300,
random_state=42
)
model.fit(
data['X_train'],
data['y_train'],
X_val=data['X_val'],
y_val=data['y_val']
)
# Make predictions
predictions = model.predict(data['X_test'])
# Evaluate performance
r2_score = model.score(data['X_test'], data['y_test'])
print(f"R² Score: {r2_score:.4f}")
Documentation
📚 Full Documentation: Read the Docs
The documentation includes:
- API Reference
- User Guides (Installation, Usage, Dataset Format)
- Performance Profiling
- Testing Information
Requirements
- Python >= 3.10
- NumPy >= 1.24.0
- TensorFlow >= 2.13.0
- scikit-learn >= 1.3.0
- SciPy >= 1.10.0
Dataset Format
Your dataset should be a .pkl (pickle) file containing a dictionary:
{
'X': numpy.ndarray, # Shape: (n_samples, 5) - exactly 5 features
'y': numpy.ndarray # Shape: (n_samples,) - target values
}
Features in Detail
Data Module (pydis_nn.data)
load_dataset(): Load and validate 5D datasets from.pklfilessplit_data(): Split data into train/validation/test setsstandardize_features(): Standardize features using training statisticsload_and_preprocess(): Complete preprocessing pipeline
Neural Network Module (pydis_nn.neuralnetwork)
NeuralNetwork: Configurable neural network class- Customizable hidden layer sizes
- Adam optimizer with configurable learning rate
- Early stopping support
- Returns training history for visualization
Utilities (pydis_nn.utils)
generate_sample_dataset(): Generate synthetic 5D datasets for testing
Performance
The package is optimized for fast training:
- 10,000 samples train in under 32 seconds on a MacBook Air M2
- Peak memory usage: ~5 MB during training
- Efficient sub-linear scaling with dataset size
See the Performance Profiling documentation for detailed benchmarks.
License
MIT License - See LICENSE file for details.
Author
Harvey Bermingham
Links
- Documentation: https://pydis-nn.readthedocs.io/
- Source Code: https://github.com/harveydgb/full-stack-nn (or your repository URL)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydis_nn-1.0.1.tar.gz.
File metadata
- Download URL: pydis_nn-1.0.1.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a787919d070b6ac576dae90e145761754449923e927e8d399f5b69397703480b
|
|
| MD5 |
21acc620a67c1b4cb835269473460ed3
|
|
| BLAKE2b-256 |
e40ac525312ea3fc3cb42ba0f9a52277e9f3a8a85904291794cc3624c9684c9f
|
File details
Details for the file pydis_nn-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pydis_nn-1.0.1-py3-none-any.whl
- Upload date:
- Size: 38.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93c30f2d8f48aab0d10524a0c35771f5b1ca7549db416f520c7090c841d48d49
|
|
| MD5 |
95a657bfe2b6e5b51c50e6b8490863b5
|
|
| BLAKE2b-256 |
01420beebfcf6aaeb3564d861e73d9bd1a857798256f6b74c8f539bef2a0d0c3
|