Gmum.r不支持向量回归吗?

时间:2017-06-28 05:04:15

标签: r svm libsvm

Gmum.r不支持SVR(支持向量回归)?

    library(RODBC)
    sqlConnString = "driver={SQL 
    Server};server=140.136.156.36;database=RealEstate_final;uid={sa};pwd=
    {Root1234}" 
    conn <- odbcDriverConnect(sqlConnString) 
    EstateNew <- sqlQuery(conn, " SELECT * FROM EstateNew ") 
    #head(FraudDF1, 5) 
    odbcClose(conn) 

expectcol&lt; -delete neednt column

expectcol <- 
    c("ID","Address","RealAddr","NonUrbanZone","NonUrbanLand","Aport_ID"
    ,"ParkB_ID","Univ_ID","ParkR_ID","Rzone_ID","Rzone_CentDistance"
    ,"Flood_ID","Flood_CentDistance","SoilLiq_ID","MRT_ID","MRT_OrderS"         
    ,"MRT_LID","MRT_OrderLS","Fway_ID","Fway_OrderS","Fway_LID","Fway_OrderLS"            
    ,"TRA_ID","TRA_OrderS","TRA_LID","TRA_OrderLS","THSR_ID","THSR_OrderS"
    ,"THSR_LID","THSR_OrderLS","River_ID","River_OrderLS","Fault_ID"
    ,"Fault_OrderLS","A001_ID","A002_ID","A003_ID","A004_ID","E001_ID"               
    ,"E002_ID","L001_ID","L002_ID","L003_ID","L004_ID","B001_ID","B002_ID"
    ,"B003_ID","Lng_X","Lat_Y","Section","Rzone","ParkingType","ParkingArea"
    ,"ParkingPrice","ParkingLot","TotalPrice")
    #EstateNew$TransDate<-as.Date(EstateNew$TransDate)
    #EstateNew$HouseDate<-as.Date(EstateNew$HouseDate)
    #,"TransDate","HouseDate"
    #將expectcol剃除
    tempdata <- EstateNew[,!names(EstateNew) %in% expectcol,drop=FALSE]

选择部门

tempdata<-subset(tempdata, 
                 tempdata$TransType==3 & tempdata$ZoneUse==2 
                 & tempdata$HouseUse==1 & tempdata$HouseType==1)

删除数据

sum(complete.cases(tempdata))
tempdata <- na.omit(tempdata)

家庭年龄

transyear<-as.numeric(substr(tempdata$TransDate, 1, 4))
    houseyear<-as.numeric(substr(tempdata$HouseDate, 1, 4))

    age_frame <- data.frame(HouseAge = transyear-houseyear)
    tempdata<-cbind(tempdata,age_frame)
    expectcol <-c("TransDate","HouseDate")
    tempdata <- tempdata[,!names(tempdata) %in% expectcol,drop=FALSE]

特征选择值

finaldata<-subset(tempdata,  
              select = c("Lng","Pcode5_ID","TransFloor","HouseArea"                          ,"Lat","River_LineDistance","A002_Distance","ParkB_Distance"
                         ,"MRT_LineDistance","LandArea","A003_Distance"
                         ,"L002_Distance","L003_Distance"
                         ,"HouseAge","Price"))

    index <- 1:nrow(finaldata)
    np = ceiling(1*nrow(finaldata))
    test.index = sample(1:nrow(finaldata),np)
    #testdata = finaldata[test.index,]
    traindata = finaldata[test.index,]

SVR

library(gmum.r)
svm.rbf <- SVM(formula=Price~., data=traindata, core="libsvm", kernel="rbf", 
C=1.0, gamma=0.5)

火车支持向量回归模型有一些误区

  

WARNING_LEVEL:使用-h 0可能会更快完成优化,#iter =   1024

0 个答案:

没有答案