I am attempting to build a model to predict whether a product will get sold on an ecommerce website with 1 or 0 being the output.
My data is a handful of categorical variables, one with a large amount of levels, a couple binary, and one continuous (the price), with an output variable of 1 or 0, whether or not the product listing got sold.
This is my code:
inTrainingset<-createDataPartition(C$Sale, p=.75, list=FALSE)
CTrain<-C[inTrainingset,]
CTest<-C[-inTrainingset,]
gbmfit<-gbm(Sale~., data=C,distribution="bernoulli",n.trees=5,interaction.depth=7,shrinkage= .01,)
plot(gbmfit)
gbmTune<-train(Sale~.,data=CTrain, method="gbm") …Run Code Online (Sandbox Code Playgroud) 我使用python 2.7.8 64位.我正在尝试使用numpy包导入CSV文件.我一直得到***关键字不能表达,然后它给我路径并说第6行,所以我假设第6行是问题所在.
这是我的代码.
import numpy as np
def main():
try:
date, rate, arb = np.loadtext('TutSheet.csv'.
delimter=',',
unpack=True,
dtype='str')
print date
except Exception, e:
print str(e)
Run Code Online (Sandbox Code Playgroud)