Tensorflow prediction model coordinates A to B to meters distance

Hi guys,

I am starting with the Deeplearning course for Developer on Tensorflow,

I am trying to do a project that consist on pass a latitute and longitude A and a latitute and longitude B on X and pass the distance on meters on B to fit the model…

The thing it’s I am stuck on the X axis cause I am not sure on how can I naturalize the data of this axis…

I try doing the following (latitude A - longitude A ) + (latitude B - longitude B ) as X and then passing distance on meters on Y.

When I try to fit the model return me errors based on there is multiple 0.

model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer=‘sgd’, loss=‘mean_squared_error’)
model.fit(xs, ys, epochs=10)

It’s so basic model I know but do you know guys where I should look into if I want to go throught this path?

Probably this is not the correct way to do this…

Thanks you in advance :smiley:

1 Like

From your description, I think your model is intended to take two lat/long pairs, and return the distance between them in meters?

But your description also implies that you’re doing the math yourself, rather than letting the NN learn to do the math.

You’ll need a fairly large database of examples to train for this, because the earth is a sphere and the relation between longitude and distance doesn’t vary linearly with the latitude.

Why not provide the two sets of latitude and longitude as four separate features in the “X” matrix, and the distance values as ‘y’, and let the NN figure out the weights that give the best fit?