SeeDerekEngineer
SeeDerekEngineer

Reputation: 780

Use pre-fit lmfit model to predict values in new dataset

I trained an lmfit model using the following:

xList = np.linspace(1, len(dataRowTrain), len(dataRowTrain))
model = LinearModel()
parameters = model.guess(dataRowTrain, x=xList)
fitModel = model.fit(dataRowTrain, parameters, x=xList)

Now I would like to use the fitModel to predict the next series of values in the dataset. How can I do so?

I am aware I can output the weights of the best fit model and run it in the equation, but I am wondering if lmfit offers a better way.

Upvotes: 0

Views: 346

Answers (1)

BIg G
BIg G

Reputation: 316

you can use to predict value

model.eval()

Example:

result = model.fit(y, params, x=X) # curve fitting
x1 = [1, 2, 3] # input for prediction
a = result.eval(x=x1)   # prediction

Upvotes: 2

Related Questions