예측 기능을 randomforest와 함께 사용할 수 있습니까? PFB예측 함수를 r의 임의 포리스트 모델과 함께 사용할 수 있습니까?
Date SKU City Sales
<date> <chr> <chr> <dbl>
1 2014-08-11 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 378
2 2014-08-18 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 348
3 2014-08-25 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 314
4 2014-09-01 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 324
5 2014-09-08 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 352
6 2014-09-15 Vaseline Petroleum Jelly Pure 60 ml Jeddah1 453
코드
train_len=round(nrow(SubSales)*0.8)
test_len=nrow(SubSales)
######Splitting dataset into training and testing#####
#### Training Set
training<-slice(SubSales,1:train_len)
#### Testing Set
testing<-slice(SubSales,train_len+1:test_len)
training=training[c(1,4)]
testing=testing[c(1,4)]
library(randomForest)
set.seed(1234)
regressor = randomForest(formula=Sales~.,
data=training,
ntree=100)
y_pred = predict(regressor,newdata = testing)
내가 대신 예측의 예측 기능을 사용할 수 랜덤 포레스트
Subsales<-read.csv('Sales.csv')
head(Subsales)
샘플 데이터 집합으로 회귀 모델을 만드는 내 코드?
[좋은 질문을하는 방법] (http://stackoverflow.com/help/how-to-ask) 및 [재현 가능한 예] (http://stackoverflow.com/questions/5963269). 이렇게하면 다른 사람들이 당신을 도울 수있게됩니다. – zx8754
@ zx8754 어떻게 작동하는지 모르는 것에 재현 가능한 예를 어떻게 제공합니까? 난 그냥 랜덤 포레스트로 모델을 훈련 할 때 예측 기능을 사용할 수 있는지 알고 싶다. 모든 곳에서 예측과 함께 작동 할 수 있는지 궁금한 RF로 예측 기능을 보았습니다. –
@ zx8754 이전에 명확하지 않은 경우 모든 세부 사항으로 질문을 편집했습니다. 건배. –