# Straight line fit under condition

``````# data
myinput = np.array([ [ 1,0 ],[ 1,1 ],[ 1,2 ],[ 1,3 ],[ 1,4 ],[ 1,5 ] ])
myotput = np.array([ [ 0 ],[ 1 ],[ 2 ],[ 3 ],[ 4 ],[ 5 ] ])
# model
model = Sequential()
model.compile(loss='mean_squared_error',
metrics=['accuracy'])
# train
model.fit(x=myinput, y=myotput, epochs=10000, verbose=0)
# check
print(model.predict(myinput))
``````

A straight line fit under condition “`1`” seems not feasible. Thanks!

To illustrate the question think of a spinning wheel of a certain size i.e. diameter or radius which is kept fixed at first (condition).

A relation between its velocity at the outer diamter, angular velocity and radius exists: velocity = omega (angular velocity) * radius.

If the angular velocity i.e. omega changes, then the outer velocity changes.

outer velocity (output) omega (input 2) fixed radius (input 1)
1 1 1
2 2 1
3 3 1
4 4 1
1

The ultimate goal is to retrieve velocities for different angular velocities and diameters, if the physical relation is not given. Let us keep the wheel diameter (condition) fixed for now.

It might be possible for a deep learning network to learn this function. You will need to generate thousands of training samples, which fully explore the function space.

Question 1: does

``````# 32 inner nodes, 2 input nodes
# 1 output node
``````

classify as a deep learning network, if not, how to modify it?

Question 2: like that:

``````myinput=[];myotput=[]
myinput[0] = np.array([ [ 1,0 ],[ 1,1 ],[ 1,2 ],[ 1,3 ],[ 1,4 ],[ 1,5 ] ])
myotput[0] = np.array([ [ 0 ],[ 1 ],[ 2 ],[ 3 ],[ 4 ],[ 5 ] ])
myinput[1] = np.array([ [ 1,0.5 ],[ 1,1.0 ],[ 1,1.5 ],[ 1,2.0 ],[ 1,2.5 ],[ 1,3.0 ] ])
myotput[1] = np.array([ [ 0.5],[ 1.0 ],[ 1.5 ],[ 2.0 ],[ 2.5 ],[ 3.0 ] ])
...
``````

Question 3: let us assume only a single data set exists, is it possible to train a network to reproduce just that?

#1 Yes, that is a deep learning network. It can learn to approximate a very simple function.
#2 This technology requires hundreds of unique training samples as a minimum.

1 Like