def data_to_function(self): ''' Uses the KroghInterpolator to make a function from our data and uses that function to predict the prices at the wanted dates. returns: wanted dates (self.intra_x_values) and their associated predicted prices (self.intra_y_values) ''' print(self.x_values) print(self.y_values) poly_func = KroghInterpolator(self.x_values, self.y_values) self.creating_wanted_days(self.n_days) #self.intra_x_values= [1477492378020,1477492378030] #self.intra_x_values = self.intra_x_values[:-1] self.intra_x_values = np.asarray(self.intra_x_values) #print(self.intra_x_values) print(self.intra_x_values) self.intra_y_values = poly_func.__call__(self.intra_x_values) print(self.intra_y_values) return self.intra_x_values, self.intra_y_values
from scipy.interpolate import KroghInterpolator #from format_data import Formatter import matplotlib.pyplot as plt import time import numpy as np x_values = [1,2,3,4,5] y_values = [6,7,8,9,10] intra_x_values = [6,7,8] poly_func = KroghInterpolator(x_values,y_values) intra_x_values = np.asarray(intra_x_values) intra_y_values = poly_func.__call__(intra_x_values) print(intra_y_values)