R Interface to the Numerai Machine Learning Tournament API
This interface allows download of tournament data, submit predictions, get user information, stake NMR’s and much more. Using the functions from this package end user can write R code to automate the whole procedure related to numerai tournament.
If you encounter a problem or have suggestions, feel free to open an issue.
install.packages("Rnumerai")
devtools::install_github("Omni-Analytics-Group/Rnumerai")
library(Rnumerai)
Use current working directory
data_dir <- getwd()
Or use temporary directory
data_dir <- tempdir()
Or use a user specific directory
data_dir <- "~/OAG/numerai"
Get your public key and api key by going to numer.ai and then going to Custom API Keys
section under your Account
Tab. Select appropriate scopes to generate the key or select all scopes to use the full functionality of this package.
set_public_id("public_id_here")
set_api_key("api_key_here")
Optional: If we choose not to setup the credentials here the terminal will interactively prompt us to type the values when we make an API call.
data <- download_data(data_dir)
data_train <- data$data_train
data_tournament <- data$data_tournament
A user can put his/her own custom model code to generate the predictions here. For demonstration purposes, we will generate random predictions.
submission <- data.frame(id=data_tournament$id,prediction = sample(seq(.35,.65,by=.1),nrow(data_tournament),replace=TRUE))
The submission object should have two columns (id & prediction) only.
submission_id <- submit_predictions(submission,data_dir,tournament="Nomi")
If you have an account with multiple models you should provide the model_id corresponding to model name you want to make submission against.
get_models()
submission_id <- submit_predictions(submission,data_dir,tournament="Nomi",model_id=get_models()[1])
Sys.sleep(10) ## 10 Seconds wait period
status_submission_by_id(submission_id)
stake_tx_hash <- stake_nmr(value = 1)
stake_tx_hash
release_tx_hash <- release_nmr(value = 1)
release_tx_hash
Users can now check performance across the following metrics: Reputation
, Rank
, NMR_Staked
, Leaderboard_Bonus
, Payout_NMR
, Average_Daily_Correlation
, Round_Correlation
, MMC
, Correlation_With_MM
.
Create histograms of metric performance
performance_distribution(c("objectscience"), "Average_Daily_Correlation")
performance_distribution(c("objectscience"), "MMC")
Create time series plots of metric performance
performance_over_time(c("objectscience"), "MMC")
performance_over_time(c("objectscience", "uuazed", "arbitrage"), "Average_Daily_Correlation", outlier_cutoff = .01, merge = TRUE)
Create a table of summary statistics
summary_statistics(c("objectscience", "uuazed", "arbitrage"))
Get account information for the account whose API key and ID are entered, Check out the name of the return object to see what informations are included in the return and then subset the required information
ainfo <- account_info()
ainfo
names(ainfo)
Get information for a given round number.
round_stats(tournament="Nomi",round_number=238)
Get closing time and round number for current open round
current_round()
Get V2 Leaderboard
leaderboard()
Get V2 User Profile
user_performance(user_name="theomniacs")
custom_query <- 'query queryname { rounds (number:177) { closeTime } }'
run_query(query=custom_query)$data