-
Notifications
You must be signed in to change notification settings - Fork 29
Prediction Nodes
A Prediction Node represents a cloud-based model that is encapsulated such that Numerai can trigger it for predictions; it is designed to be scalable, resource efficient, and easy to configure and debug. This section details what each file does in the Numerai Examples and the important components of a Prediction Node.
The examples show how to structure one Prediction Node. You can review the layout of an example after running numerai copy-example to copy the files to your computer.
numerai-python3
├── Dockerfile
├── .dockerignore
├── predict.py
├── requirements.txt
└── train.py
-
Dockerfile: Used duringnumerai node deployto build a Docker image that's used to run your code in the cloud. It copies all files in its directory, installs Python requirements for requirements.txt, and runspython predict.pyby default. -
.dockerignore: This file uses regex to match files that should not be included in the Docker image. -
train.py: This is an extra entry point specifically for training, it's used when runningnumerai node test --local --command "python train.py" -
requirements.txt: Defines python packages required to run the code. -
predict.py: Gets run by default locally and in the cloud when runningnumerai testwithout the--command|-coption.
numerai-rlang
├── Dockerfile
├── install_packages.R
└── main.R
-
Dockerfile: Used duringnumerai node deployto build a Docker image that's used to run your code in the cloud. It copies all files in its directory, installs Rlang requirements from install_packages.R, and runs main.R by default. -
.dockerignore: This file uses regex to match files that should not be included in the Docker image. -
install_packages.R: Installs dependencies necessary for running the example. -
main.R: Ran by default locally and in the cloud and when runningnumerai testwithout the--command|-coption.
Prediction Nodes use a few important components like a Dockerfile, a Trigger, a Container, and a Compute Cluster, all of which can be created when following the quickstart in the main README.
The most important component of deploying a Prediction Node is the Dockerfile, which is a program for building Docker images. An image is a package of your code with all of its dependencies; this image is instantiated as a Container in the cloud and can run a command when it starts up. The most typical case of a Dockerfile is demonstrated in the Numerai Examples, if you're not sure how to use a Dockerfile, first copy an example with numerai copy-example, then read the documentation in the example Dockerfile to find out how to customize which files are included and ran by default.
Dockerfiles are very flexible, each Dockerfile can reference the same code base, it’s own code base, or multiple code bases depending on how you write it; as long as it copies the correct files and runs the correct command, you can structure it however you'd like. If you want to learn more about how to customize this file checkout the Dockerfile reference.
The CLI uses Terraform to provision cloud resources. These cloud resources generally provide the following components on all cloud providers:
-
Trigger: A small function that schedules a "task" on yourCompute Cluster. This "task" handles pulling the image that was created by theDockerfileand running it as aContaineron yourCompute Cluster. -
Container: The thing that actually contains and runs your code on a computer provisioned by theCompute Cluster. The--size(or-s) flag on thenumerai node configsets the CPU and Memory limits for aContainer. -
Compute Cluster: A handler that accepts scheduled "tasks" and spins up and down computers to runContainers.
For detailed architecture breakdowns of our supported Cloud providers go to their individual Wiki pages: