2

Spline Interpolation

Unsolved
Data Wrangling

Difficulty: 2 | Problem written by Mr. Umair
Spline interpolation uses low polynomial degrees and chooses a polynomial that will result in a smooth dataset. Our data consist of (x,y) coordinates of a train over time. Since motion is restricted for the train, we can expect that the points between (x,y) will be “smooth” rather than jagged.  

By using scipy.interpolate, find univariate splines for the "values" list from the x and y axis data points.

Input:

xAxis ( Time for reaching station ) =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

yAxis ( Train Number )=  [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

values= [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9]

Output:

result= [5.2, 5.4, 5.599999999999998, 5.799999999999998, 5.999999999999999, 6.199999999999999, 6.399999999999999, 6.6, 6.799999999999997]

Sample Input:
<class 'list'>
xAxis: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
<class 'list'>
yAxis: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
<class 'list'>
values: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9]

Expected Output:
<class 'list'>
[5.2, 5.4, 5.599999999999998, 5.799999999999998, 5.999999999999999, 6.199999999999999, 6.399999999999999, 6.6, 6.799999999999997]

This is a premium problem, to view more details of this problem please sign up for MLPro Premium. MLPro premium offers access to actual machine learning and data science interview questions and coding challenges commonly asked at tech companies all over the world

MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.

Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro

Get access to Premium only exclusive educational content available to only Premium users.

Have an issue, the MLPro support team is available 24X7 to Premium users.

This is a premium feature.
To access this and other such features, click on upgrade below.

Log in to post a comment

Comments
Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)