Practical lab
So, the first problem is to create a rest API with fake data that we can predict with.
For this, I have used mockaroo.com.
Here is the schema I created with Mockaroo:
Figure 6.2: Setting fake data
A sample of the data looks like this:
Figure 6.3: Fake data output
Mockaroo allows you to create a free API – all you need to do is hit Create API at the bottom of the schema window.
Next, we will use Python to pull the data and prepare it for modeling.
First, we will import the necessary libraries:
import requests import pandas as pd import io import requests import mlflow from sklearn import metrics from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor import numpy as np
Next, we will use the requests
package to send a REST GET
to our new Mockaroo API:
url = "https://my.api.mockaroo.com/chapter_6.json"
Note that you must put...