Reputation: 11
I'm new at ML and have a problem with catboost. So, I want to predict function value (For example cos | sin etc.). I went over everything but my prediction is always straight line
Is it possible and if it is, how i can issue with my problems
I will be glad to any comment ))
train_data = np.array(np.arange(1, 100, 0.5))
test_data = np.array(np.arange(100, 120, 0.5))
train_labels = np.array(list(map(lambda x : math.cos(x), np.arange(1, 100, 0.5))))
model = CatBoostRegressor(iterations=100, learning_rate=0.01, depth=12, verbose=False)
model.fit(train_data, train_labels)
preds = model.predict(test_data)
plt.plot(preds)
plt.show()
This picture shows what i want:
Upvotes: 1
Views: 903
Reputation: 739
The thing to understand is Machine Learning is not magic.
First ML cannot miraculously predict everything.
Second, you need to pick the right ML algorithm, because there is no one best algorithm that works best all the time. See: https://en.wikipedia.org/wiki/No_free_lunch_theorem
Third, the input features are critical. The input features you are using in this problem are going to look like noise because it doesn't capture the periodicity of the data and CB isn't geared to understanding periodicity.
For your problem, you need to find an ML algorithm that is better suited to make predictions of periodicity.
Some of the more sophisticated ones use recurrent neural networks. I suspect that's too advanced for you at this point in time.
I would abandon this problem and find a problem that is more tractable/suitable for ML.
Something like the home price prediction would be good.
Upvotes: 1
Reputation: 123
I compiled your code and found that the prediction vector contains the same value for all entries
[-0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229
-0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229
-0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229
-0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229
-0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229 -0.09229]
I think your model is in high bias(underfit) condition. Try to increase number of features or use polynomial features.
Upvotes: 0