Creating Predictors in Mongo
Predictors are the machine learning models that enable us to forecast future data based on the available data. By using the db.models.insertOne()
method, we create and train predictors in Mongo.
The db.models.insertOne()
Method
Description
The db.models.insertOne()
method creates and trains a new model.
Syntax
Here is the syntax:
On execution, we get:
Where:
Expressions | Description |
---|---|
name | The name of the model to be created. |
predict | The name of the target column to be predicted. |
connection | The name of the integration created via the db.databases.insertOne() method or file upload. |
select_data_query | Object that stores the data collection name to be used for training and validation and additional arguments for filtering the data. |
Checking Predictor Status
After running the db.models.insertOne()
method, execute the db.models.find()
method from the mindsdb.models
collection to check the status of the model.
Example
Creating a Predictor
This example shows how you can create and train the home_rentals_model
machine
learning model to predict the rental prices for real estate properties inside
the dataset.
On execution, we get:
Checking Predictor Status
To check the predictor status, query the
mindsdb.models
table
using the db.models.find()
command.
On execution, we get: