הרצת מודל כך שיקבל קובץ CSV כקלט, וידפיס את הפלט לקובץ טקסט

25 views
Skip to first unread message

Einat Miller Kreiczer

unread,
Feb 1, 2016, 10:40:18 AM2/1/16
to Israel R User Group

היי, יש לי כמה מודלים שבניתי ב R  ואני רוצה לדעת איך להשתמש בהם.

אני רוצה לקבל נתונים דרך קובץ ROLLOUT.CSV , להריץ את המודל שבניתי ושההחלטה לגבי המשתנה התלוי BUYER_FLAG תודפס לקובץ טקסט

 

דוגמא 1 (רגרסיה לוגיסטית)

 

 

mdl <- glm(formula = BUYER_FLAG ~ . , family= "binomial", data = ds_tr (

y_hat = predict(mdl, data = ds_tr , type = 'response('

אני מניחה שהקריאה של הנתונים תהיה באופן הבא:

ds = read.csv(file_path, na.strings="")

ואז את ds אני אתן בתור newdata

y_hat = predict(mdl, newdata =  ds, type = 'response')

y = (ds_te$BUYER_FLAG == 1)

cutoff= (y_hat > 0.5)

 

 

איך אני שופכת את התוצאות לקובץ טקסט? תודה!


Ofrit Lesser

unread,
Feb 1, 2016, 11:03:12 AM2/1/16
to israel-r-...@googlegroups.com

write.csv או  write.table יעשו את העבודה

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This email has been sent from a virus-free computer protected by Avast.
www.avast.com
Reply all
Reply to author
Forward
0 new messages