A package that demonstrates deep neural nets using unique Monte Carlo-type parameter training.
Project description
Monte-Carlo-Neural-Nets
Overview / Lore
A package made to see how well a basic architecture of neural nets could be. The nets can be created with custom input and output heights, as well as full customization of the hidden layers' sizes (height and count of layers) and activation functions that are applied at each space between the layers.
The basic operation of these nets is that they can be trained to some data set (or some score in an unsupervised case) by randomly 'tweaking' the different parameter weight values within the net. These weight values are clipped to be restrained to the range [-1, 1].
Some more examples and technicals can be found on the GitHub page: https://github.com/SciCapt/Monte-Carlo-Neural-Nets
Quickstart Example
Fitting various models to the function f(x) = x^0.5
Given below, this quick start code shows the syntax for creating a network, a few ways to write in the activation functions to be used, how to write the sizing (automatic input and output sizes to come soon), the included train-test split function, fitting the models, getting their predictions, and the plots of the resulting predictions.
''' import matplotlib.pyplot as plt import numpy as np
import mcnets as mc
Data to fit to (f(x) = x^0.5)
You can increase the number of samples by changing the X variable
X = np.random.rand(20)*2 # Gives domain of [0, 2) Y = X**0.5
Assemble a few models to test
net_atan = mc.AdvNet(1, [25], 1, 'atan') net_lin = mc.AdvNet(1, [25], 1) net_combo = mc.AdvNet(1, [25], 1, ['relu', 'elu', 'lin'])
An equal alternative definition for the ATAN model:
net_atan = AdvNet(1, [25], 1, ['atan', 'atan', 'atan'])
An equal alternative definition for the linear model (lin is default):
net_atan = AdvNet(1, [25], 1)
Train-Test Split (Taking only the train group)
x, y, _, _ = mc.TTSplit(X, Y, percentTrain=50)
Fit the models to the training data group
(Note that .Fit does NOT return in-place)
print("ATAN Model Training:") net_atan = net_atan.Fit(x, y)
print("\nLinear Model Training:") net_lin = net_lin.Fit(x, y)
print("\nCombo Model Training") net_combo = net_combo.Fit(x, y)
Get the models predictions to the full data set
ym_atan = net_atan.Predict(X) ym_lin = net_lin.Predict(X) ym_combo = net_combo.Predict(X)
Plot and compare the results of the models
print("\nPlotted Results:") plt.plot(Y, 'o') plt.plot(ym_atan, 'r--') plt.plot(ym_lin, 'g--') plt.plot(ym_combo, 'b--') plt.title(f"y=x^0.5 vs Networks of Various Activation Functions") plt.legend(["True Data", "ATAN Model", "Linear Model", "Combo Model"]) plt.show() '''
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
File details
Details for the file mcnets-1.3.0.tar.gz
.
File metadata
- Download URL: mcnets-1.3.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28dd981e97a2ae25479b9dfc6cc95728f190f99b286c2069d81fa82a18fe1d1 |
|
MD5 | 8707164918808fd66c3e242462b79ab0 |
|
BLAKE2b-256 | c7060878329c5cd24772ec0c7ed65a4be95cac6d42a637c0cabedfb709a86f2b |
File details
Details for the file mcnets-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: mcnets-1.3.0-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | debeb21338ebc66f9ac56436d3f90fdbb1398f4a2db7e82a1be2a2e31a26d941 |
|
MD5 | 69f48bfbeeea67bb88790011bf7f909d |
|
BLAKE2b-256 | 3f35a01b561741138fa35ad7ad094c78df66bb0f4f22180e73569df4a6677d24 |