I am trying to implement the Fibonacci Sequence in Python with Machine Learning. I want my program to predict the next 5 digits after the given input. Such as, if I pass [0,1,1]
, it will predict and return [2,3,5,8,13]
. However, I can't find a way to do this. my program can currently predict the next digit only. Yes, I could hard-code it, updating the array with the new outputs, but I don't want to do that.
My code:
#! /usr/bin/python3
from sklearn import svm
from sklearn.linear_model import LinearRegression
features = [
[0,1,1],
[2,3,5],
[8,13,21],
[34,55,89],
]
labels = [2,8,34,144]
clf = LinearRegression()
clf.fit(features, labels)
test = [[144, 233, 377]]
print(clf.predict(test))
Any help?