Ejemplo n.º 1
0
 def runRegression(purchases):
     # define the model
     lrModel = LinearRegression()
     # dummy training to initialize weights and biases of the model
     lrModel.fit(np.array([0]).reshape(-1, 1), [1])
     # Assigning trained weights and biases to the model
     lrModel.coef_ = np.array([[0.08037347]])  # weights
     lrModel.bias_ = np.array([3.68091473])  # bias
     example_instance = np.array([purchases
                                  ]).reshape(-1, 1)  # [NUMBER OF PURCHASES]
     # Test the model
     prediction = lrModel.predict(example_instance)
     print(prediction)
     return prediction[0].item()