- Identify key parameters from the old “NaiveBayes” object that can be directly translated to the “ClassificationNaiveBayes” object. These typically include class prior probabilities and feature likelihoods
- Make a custom function or class that mimics the behaviour of the new “fitcnb” model using the parameters from the old model
- Use the extracted parameters to manually implement the prediction logic, effectively creating a forward-compatible model for predictions.
Is there any way to create a ClassificationNaiveBayes model directly from a NaiveBayes model?
1 次查看(过去 30 天)
显示 更早的评论
I want to update some code that uses the deprecated NaiveBayes class, ideally without digging up the ancient training data in order to retrain a current model type, the key fields have obvious matches but there are many more fields with non-obvious meaning in the new class, is there any easy way to create a functional new model from the old one without the original training data?
0 个评论
回答(1 个)
Gautam
2025-1-8
Hello Anthony,
Unfortunately, MATLAB does not provide a direct method to convert an old “NaiveBayes” model object to a new “ClassificationNaiveBayes” object without retraining. However, you can attempt to manually extract and map relevant parameters from the old model to the new format.
There are a couple of ways you can go about it. Consider the following approaches:
Please note, however, while this approach provides a workaround, retraining with the original data remains the most robust solution for leveraging the full capabilities of the new “fitcnb” function.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!