knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Assume we have

  1. test dataset test
  2. model xgb_base which is a xgboost model
  3. we want to save it in the directory data with name my_pred.csv
phv_pred(test,xgb_base,dir='data',output_name='my_pred.csv')

The official target metric on the site is not usual, thus here is the function I wrap the metric into.

Assume you finish your model and get four coloumn in dataset dataset,

  1. id is the id of the phv machine
  2. t is time to record every y and x variables
  3. p is the real power, in this contest, it is the target we want to predict.
  4. phat is the predicted power, we want it to approach the real one.
library(add2evaluation)
data(dataset)
library(lubridate)
library(psych)
library(tidyverse)
dataset %>% 
    describe()
phv_metric(
    id = dataset$short_name
    ,t = dataset$t
    ,y = dataset$p
    ,yhat = dataset$phat
)


JiaxiangBU/add2evaluation documentation built on Jan. 21, 2020, 7:05 a.m.