- 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 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Gautam
on 8 Jan 2025
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 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!