[英]Use pre-fit lmfit model to predict values in new dataset
I trained an lmfit model using the following:我使用以下方法训练了一个 lmfit model:
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.现在我想使用 fitModel 来预测数据集中的下一系列值。 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.我知道我可以 output 最适合 model 的权重并在等式中运行它,但我想知道 lmfit 是否提供了更好的方法。
you can use to predict value你可以用来预测价值
model.eval() 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.