Machine Learning – Key Idea – Iteration With model(rnge()) Where rnge() Is A Sorted List Of Numbers

When I want to solve something with machine learning. Like the Three Body Problem or something like that. I use a model( rnge() ) where

def rnge():
return 1e-5*np.linspace(0,1,100).reshape(1,100).astype(np.float32)

So the idea is that the model adapts with the ?whole number line as input. Or at least a part of it. So here I scaled it down so that the model() would have time to adapt

My model() does not need to be very deep or many units for iterations to work. Just

class Model(chainer.Chain):
def __init__(self, n_hidden,n_out):
super(Model, self).__init__()
with self.init_scope():
self.l1 = L.Linear(None, n_hidden)
self.l2 = L.Linear(None, n_hidden*2)
self.l3 = L.Linear(None, n_out)
def __call__(self, x):
x = F.relu(self.l1(x))
x = -F.relu(self.l2(-x))
x = self.l3(x)
return x

#end of class description

hidden = 15
model00 = Model(hidden,1)
optimizer00 = chainer.optimizers.Adam()

Then in the loop you just add a = model(rnge()) and some loss = F.mean_square_error( 0 , eq(a) ). That is. Your equation that needs to be solved and then loss.backward() and then update the model with the optimizer.update().