Skip to Main Content

Data Science & Machine Learning

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regression problems

950757Jul 20 2012 — edited Jul 23 2012
Hi,

i have a problem predicting data in Oracle R Enterprise. I build a model on a part of the dataset and build a prediction on a whole dataset. Something goes wrong - the prediction becomes inadequate. When i build a model on a whole data set everything is fine. I was trying to post the datasets, but they just messed.
Can anybody help me, please?

This is the code:

begin
sys.rqScriptCreate('electro2',
'function(dat) {
mod <- lm(ZHD ~ EL, dat)
mod}');
end;
/
drop table electro_model;
create table electro_model as
select *
from table(rqTableEval(
cursor(select ZHD,EL
from ELECTRISITY where DAT>'01.04.2012' and
DAT< '01.06.2012'
),
NULL,
NULL,
'electro2'));

-- score data
begin
sys.rqScriptCreate('electropred2',
'function(dat, mod) {
prd <- predict(mod, newdata=dat)
prd[as.integer(rownames(prd))] <- prd
res <- cbind(dat, PRED = prd)
res}');
end;
/
drop table electro_res
create table electro_res as
select *
from table(rqTableEval(
cursor(select ZHD,EL from ELECTRISITY),
cursor(select 1 max1, 1 pos1, 'mod' name1,
to_number(null) max2, to_number(null) pos2,
to_char(null) name2, total, chunk, value
from ELECTRO_MODEL),
'select ZHD, EL, 1 PRED from ELECTRISITY',
'electropred2'))
order by 1, 2, 3;



Regina Lazareva

Edited by: 947754 on 20.07.2012 5:47

Edited by: 947754 on 20.07.2012 5:47

Edited by: 947754 on 20.07.2012 5:48
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2012
Added on Jul 20 2012
6 comments
342 views