human
I found an interesting problem on https://www.codewars.com/kata/591748b3f014a2593d0000d9:
Your task is to build a model^(1) which can predict y-coordinate.
You can pass tests if predicted y-coordinates are inside error margin.

You will receive train set which should be used to build a model. 
After you build a model tests will call function ```predict``` and pass x to it. 

Error is going to be calculated with RMSE.

Side note: Points in test cases are from different polynomials (up to 5th degree).


Easier version: Data mining #1

Blocked libraries: sklearn, pandas, tensorflow, numpy, scipy

Explanation
[1] A mining model is created by applying an algorithm to data, but it is more than an algorithm or a metadata container: it is a set of data, statistics, and patterns that can be applied to new data to generate predictions and make inferences about relationships.

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is the Python program you requested.

class Datamining:

    def __init__(self, train_set):
        self.X = [s[0] for s in train_set[:6]]
        self.Y = [s[1] for s in train_set[:6]]
        

    def predict(self, x):
        y = 0
        for j in range(len(self.X)):
            Lj, xj = 1, self.X[j]
            for k in range(len(self.X)):
                xk = self.X[k]
                if xk != xj:
                    Lj *= (x-xk)/(xj-xk)
            y += Lj * self.Y[j]
        
        
        
        
        return y