0
これは恐らく疑問な質問ですが、RでH2O Predict関数を使用すると、スコアリングデータから列を保持するように指定できる方法があるかどうか疑問に思っています。具体的には、私の一意のIDキーを保持したい。新しいデータセットの採点時にIDキー(または他の列)を保持していますか?
今のところ、元のデータセットにインデックスキーを割り当て、スコアに1つのインデックスキーを割り当ててスコアリングデータセットにスコアをマージするという、非常に効率の悪いアプローチを行ってしまいます。むしろ「このデータセットをスコアリングしてx、y、z ....列を維持する」と言っています。何かアドバイス?
非効率なコード:予測フレームの行が同じ順序になっているので、
#Use H2O predict function to score new data
NL2L_SCore_SetScored.hex = h2o.predict(object = best_gbm, newdata =
NL2L_SCore_Set.hex)
#Convert scores hex to data frame from H2O
NL2L_SCore_SetScored.df<-as.data.frame(NL2L_SCore_SetScored.hex)
#add index to the scores so we can merge the two datasets
NL2L_SCore_SetScored.df$ID <- seq.int(nrow(NL2L_SCore_SetScored.df))
#Convert orignal scoring set to data frame from H2O
NL2L_SCore_Set.df<-as.data.frame(NL2L_SCore_Set.hex)
#add index to original scoring data so we can merge the two datasets
NL2L_SCore_Set.df$ID <- seq.int(nrow(NL2L_SCore_Set.df))
#Then merge by newly created ID Key so I have the scores on my scoring data
#set. Ideally I wouldn't have to even create this key and could keep
#original Columns from the data set, which include the customer id key
Full_Scored_Set=inner_join(NL2L_SCore_Set.df,NL2L_SCore_Set.df, by="ID")