0
$\begingroup$

I am trying to improve a model for predicting the roots of a polynomial. The data set consists of integers arrays that represents the coefficients of a polynomial and the roots.Inputs are zeropadded for which polynomials of lower than the highest degree. I could not come up with another idea yet.

An example data set is as follows

[[       0.          0.          0.          1.         81.78     1597.3 ]
[       0.          0.          1.         -0.64     -446.88    -3372.03]
[       0.          1.        -29.88      -28.05     2700.11     1057.81]
[       1.          4.24    -2807.77   -22044.78  1498373.97 10298202.12]]

[[[-49.53   0.  ]
[-32.25   0.  ]
[  0.     1.  ]
[  0.     1.  ]
[  0.     1.  ]]

[[-14.1    0.  ]
[ -9.77   0.  ]
[ 24.5    0.  ]
[  0.     1.  ]
[  0.     1.  ]]

[[ -8.56   0.  ]
[ -0.39   0.  ]
[ 11.62   0.  ]
[ 27.21   0.  ]
[  0.     1.  ]]

[[-41.62   0.  ]
[-29.62   0.  ]
[ -6.78   0.  ]
[ 25.57   0.  ]
[ 48.21   0.  ]]]

I have tried with both mean absolute error, mean squared error, mean absolute percentage error(which I believed, it should give the best results but didnt). No matter how many polynomials I put in the dataset, it seems like it does not learn from it at all. Even with very low mean absolute errors, around 4, the predictions are way off, almost as random even for second/third degree polynomials.

And the model

    h_size = 128
    model = Sequential()
    model.add(LSTM(h_size , input_shape=(None, 1)))
    model.add(RepeatVector(degree))
    model.add((LSTM(h_size , return_sequences=True)))
    model.add(TimeDistributed(Dense(2)))

    model.compile(loss='mean_absolute_error',
              optimizer='adam',
              metrics=['mae'])

And more thing, what kind of an auto encoder should I use?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.