greenlearning package
- class greenlearning.Model(G_network, U_hom_network)[source]
Bases:
object
Create a model to learn Green’s function from input-output data with deep learning.
Example:
# Construct neural networks for G and homogeneous solution G_network = gl.matrix_networks([2] + [50] * 4 + [1], "rational", (2,2)) U_hom_network = gl.matrix_networks([1] + [50] * 4 + [1], "rational", (2,)) # Define the model model = gl.Model(G_network, U_hom_network) # Train the model on the selected dataset in the path "examples/datasets/" model.train("examples/datasets/", "ODE_system") # Plot the results model.plot_results() # Close the session model.sess.close()
- class greenlearning.NeuralNetwork(layers, activation_name)[source]
Bases:
object
Create a fully connected neural network with given number of layers and activation function.
Example:
gl.NeuralNetwork([2] + [50] * 4 + [1], "rational")
creates a rational neural network with 4 hidden layers of 50 neurons.
- greenlearning.matrix_networks(layers, activation, shape)[source]
Create a matrix of neural networks with the given parameters.
Example:
gl.matrix_networks([2] + [50] * 4 + [1], "rational", (2,1))
creates a matrix size 2 x 1 of rational networks with 4 hidden layers of 50 neurons.
Subpackages
- greenlearning.utils package
- Submodules
- greenlearning.utils.backend module
- greenlearning.utils.config module
- greenlearning.utils.external_optimizer module
- greenlearning.utils.load_data module
- greenlearning.utils.plotting module
- greenlearning.utils.print_weights module
- greenlearning.utils.real module
- greenlearning.utils.save_results module
- greenlearning.utils.tf_session module
- greenlearning.utils.visualization module
Submodules
greenlearning.activations module
greenlearning.loss_function module
- class greenlearning.loss_function.loss_function(G, N)[source]
Bases:
object
Loss function for learning Green’s functions and homogeneous solutions.
Inputs: matrices of neural networks G and N.
- feed_dict(inputs_xU, inputs_xF, inputs_f, inputs_u, weights_x, weights_y)[source]
Construct a feed_dict to feed values to TensorFlow placeholders.
- property outputs
greenlearning.matrix_networks module
greenlearning.model module
- class greenlearning.model.Model(G_network, U_hom_network)[source]
Bases:
object
Create a model to learn Green’s function from input-output data with deep learning.
Example:
# Construct neural networks for G and homogeneous solution G_network = gl.matrix_networks([2] + [50] * 4 + [1], "rational", (2,2)) U_hom_network = gl.matrix_networks([1] + [50] * 4 + [1], "rational", (2,)) # Define the model model = gl.Model(G_network, U_hom_network) # Train the model on the selected dataset in the path "examples/datasets/" model.train("examples/datasets/", "ODE_system") # Plot the results model.plot_results() # Close the session model.sess.close()
greenlearning.neural_network module
- class greenlearning.neural_network.NeuralNetwork(layers, activation_name)[source]
Bases:
object
Create a fully connected neural network with given number of layers and activation function.
Example:
gl.NeuralNetwork([2] + [50] * 4 + [1], "rational")
creates a rational neural network with 4 hidden layers of 50 neurons.
greenlearning.quadrature_weights module
- greenlearning.quadrature_weights.get_weights(identifier, x)[source]
Get the type of quadrature weights associated to the numpy array x.