Bring Your Own Model
The Bring Your Own Model (BYOM) feature lets you upload your own models in the form of Python code and use them within MindsDB.
Please note that this feature is available for MindsDB Pro users. If you have a free demo account, you’ll be asked to upgrade to a dedicated AWS instance.
How It Works
You can upload your custom model via the MindsDB editor by clicking Add
and Upload custom model
, like this:
Here is the form that needs to be filled out in order to bring your model to MindsDB:
Let’s briefly go over the files that need to be uploaded:
-
The Python file stores an implementation of your model. It should contain the
train
andpredict
methods. Here is its sample content: -
The requirements file, known as
requirements.txt
, stores all dependencies along with their versions. Here is its sample content:
Once you upload the above files, please provide an engine name.
Please note that your custom model is uploaded to MindsDB as an engine. Then you can use this engine to create a model.
Let’s look at an example.
Example
We upload the custom model, as below:
Here we upload the custom_model.py
file that stores an implementation of the model and the requirements.txt
file that stores all the dependencies.
Once the model is uploaded, it becomes an ML engine within MindsDB. Now we use this custom_ML_engine
to create a model as follows:
Let’s query for predictions by joining the custom model with the data table.
Check out the BYOM handler folder to see the implementation details.