I work with Rapid Miner using the Java-API. I created a Model which I would like to use now. Is there a possibility to use the value of a Java variable as input for my model?

I try to explain my problem: I've got a time serie of values (for time=0,...,t ) which I used to generate a regression model. Now I want to apply an simple Integer value (t+1) to "forcast" the next value. But until now, I didn't find a way to apply this value which is saved in an integer variable to my model.

I really hopy someone know what I have to do. It is the first time I am using Rapid Miner...

0

IngoRMAdministrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University ProfessorPosts: 1,751 RM Founder

Hello,

first of all: welcome here to our community. I would like to give you two remarks:

1.) Although you probably do not want to hear this but: it is most often not a good idea to simply use a regression model for time series forecasting. The reasons is that the future predictions are not backed up by any of the seen data and therefore the predictions often tend to drop to zero. So what you probably want to use is a windowing approach together with a base regression learner. You can have a look into the discussion here

2.) If you stick to the approach described in the link above, you can simply build a new window from the historical data plus the new one and apply the model to it just in the same way as you can apply a model to other data. The prediction of this model then is the prediction for the time lag defined by the horizon in the windowing approach.

Hope that gives you some hints how to work on your problem.

Thank you very much for your advices. But it is part of my diploma thesis (where I evaluate the use of prediction methods for tuning an database system) using regression methods to predict values. I know that there are problems using the hole time serie to forecast something.

My approach is the following: - monitoring performance metrics of an IT-system - create a regression model using the last x snapshots (where x is a constant!!!) - apply this model for the next time value to forecast the next performance value

If I am not wrong, I implicitly use the same idea like your explained window operator. In the meantime, I found another way to set my input parameters by using the database where all my values are saved.

But now, I have another problem: How can I access the predicted value to use it in my java program??? ???

I really hope that someone can explain it to me...

0

IngoRMAdministrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University ProfessorPosts: 1,751 RM Founder

Hi,

But it is part of my diploma thesis (where I evaluate the use of prediction methods for tuning an database system) using regression methods to predict values.

Using regression methods is perfectly fine. But you should consider to wrap the regression learning step into a windowing in order to get true predictions...

If I am not wrong, I implicitly use the same idea like your explained window operator. In the meantime, I found another way to set my input parameters by using the database where all my values are saved.

...what you seem to have

I should definitely read the full text before answering. You are right, your approach follows the basic windowing idea mentioned in the post above - but you have to perform more work manually in creating the data sets.

But now, I have another problem: How can I access the predicted value to use it in my java program???

May I ask if you could post the source code you tried so far (for model building and model application)? I could give you some hints on the code then and add the missing lines for the retrieval of the model predictions.

but you have to perform more work manually in creating the data sets.

It isn't so. All my data is stored in a database so that I can get the last x value using the FETCH-command in the sql-query. So I think it isn' t too much work.

I omitted the settings of the parameters because I think there aren't so relevant. In the meantime I found a way to get the predicted value, but I am sure there are better possibilities to get it:

Example reader = resultSet.getExample(0); Attributes att = reader.getAttributes(); String value = reader.getValueAsString( att.getPredictedLabel() ); result = Math.round( Float.parseFloat( value ) * 1000.0 )/1000.0;

It would be great if you could show me a better way to the predicted value...

0

IngoRMAdministrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University ProfessorPosts: 1,751 RM Founder

Hi again,

I omitted the settings of the parameters because I think there aren't so relevant. In the meantime I found a way to get the predicted value, but I am sure there are better possibilities to get it:

Looks good for me so far.

It would be great if you could show me a better way to the predicted value...

The one you mentioned is correct in principle. I just did not understand the last two lines. Why didn't you just use "getValue(Attribute)" as in the following snippet:

double result = reader.getValue(att.getPredictedLabel());

## Answers

347MavenI am afraid I got you wrong, but...

If you look in the javadoc, you will see that every class that implements the interface "Model" provides a method called This method (normally) adds prediction and confidence attributes to the input ExampleSet testSet based on the used model.

Is this what you are looking for ?

Steffen

10Contributor III try to explain my problem:

I've got a time serie of values (for time=0,...,t ) which I used to generate a regression model. Now I want to apply an simple Integer value (t+1) to "forcast" the next value. But until now, I didn't find a way to apply this value which is saved in an integer variable to my model.

I really hopy someone know what I have to do. It is the first time I am using Rapid Miner...

1,751RM Founderfirst of all: welcome here to our community. I would like to give you two remarks:

1.) Although you probably do not want to hear this but: it is most often not a good idea to simply use a regression model for time series forecasting. The reasons is that the future predictions are not backed up by any of the seen data and therefore the predictions often tend to drop to zero. So what you probably want to use is a windowing approach together with a base regression learner. You can have a look into the discussion here

http://rapid-i.com/rapidforum/index.php/topic,16.0.html

in order to get the basic ideas.

2.) If you stick to the approach described in the link above, you can simply build a new window from the historical data plus the new one and apply the model to it just in the same way as you can apply a model to other data. The prediction of this model then is the prediction for the time lag defined by the horizon in the windowing approach.

Hope that gives you some hints how to work on your problem.

Cheers,

Ingo

10Contributor IIMy approach is the following:

- monitoring performance metrics of an IT-system

- create a regression model using the last x snapshots (where x is a constant!!!)

- apply this model for the next time value to forecast the next performance value

If I am not wrong, I implicitly use the same idea like your explained window operator. In the meantime, I found another way to set my input parameters by using the database where all my values are saved.

But now, I have another problem: How can I access the predicted value to use it in my java program??? ???

I really hope that someone can explain it to me...

1,751RM FounderI should definitely read the full text before answering. You are right, your approach follows the basic windowing idea mentioned in the post above - but you have to perform more work manually in creating the data sets.

May I ask if you could post the source code you tried so far (for model building and model application)? I could give you some hints on the code then and add the missing lines for the retrieval of the model predictions.

Cheers,

Ingo

10Contributor IIMy source code is the following: I omitted the settings of the parameters because I think there aren't so relevant. In the meantime I found a way to get the predicted value, but I am sure there are better possibilities to get it: It would be great if you could show me a better way to the predicted value...

1,751RM FounderIngo

10Contributor II