"Error using Linear Regression with R Extension"
Doloop
New Altair Community Member
I am experimenting with the R extension. I can successfully do a simple linear regression using the R Script operator, but I cannot do the linear regression using the R linear regression operator. When I use the R Linear Regression operator I get the following error:
Process Failed: The model did not return any results, so no prediction can be made. During model application the data is exported to R and needs to be scored there. The scored data should then be transferred back to RapidMiner but wasn't available. Offending operator: Apply Model.
Any help is appreciated.
Here is the XML for my process:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="quantx1:world_bank_data_extractor" compatibility="1.0.006" expanded="true" height="60" name="World Bank Data Extractor (2)" width="90" x="45" y="30">
<parameter key="Select Indicator" value="SP.POP.TOTL"/>
<parameter key="Start Year" value="1950"/>
<parameter key="End Year" value="2000"/>
<parameter key="Country" value="Germany"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.3.015" expanded="true" height="76" name="Select Attributes (2)" width="90" x="179" y="30">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="|Year|Value"/>
</operator>
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role" width="90" x="313" y="30">
<parameter key="attribute_name" value="Value"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="multiply" compatibility="5.3.015" expanded="true" height="94" name="Multiply" width="90" x="447" y="30"/>
<operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="76" name="Example 4" width="90" x="581" y="120">
<process expanded="true">
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role (4)" width="90" x="112" y="30">
<parameter key="attribute_name" value="Year"/>
<list key="set_additional_roles">
<parameter key="Value" value="label"/>
</list>
</operator>
<operator activated="true" class="r:linear_regression" compatibility="5.3.000" expanded="true" height="76" name="Linear Regression (3)" width="90" x="246" y="30"/>
<operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Predict Year (2)" width="90" x="112" y="120">
<list key="attribute_values">
<parameter key="Year" value="2025"/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (3)" width="90" x="380" y="75">
<list key="application_parameters"/>
</operator>
<connect from_port="in 1" to_op="Set Role (4)" to_port="example set input"/>
<connect from_op="Set Role (4)" from_port="example set output" to_op="Linear Regression (3)" to_port="training set"/>
<connect from_op="Linear Regression (3)" from_port="model" to_op="Apply Model (3)" to_port="model"/>
<connect from_op="Predict Year (2)" from_port="output" to_op="Apply Model (3)" to_port="unlabelled data"/>
<connect from_op="Apply Model (3)" from_port="labelled data" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="76" name="Example 3" width="90" x="581" y="30">
<process expanded="true">
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role (3)" width="90" x="112" y="30">
<parameter key="attribute_name" value="Year"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Predict Year" width="90" x="112" y="120">
<list key="attribute_values">
<parameter key="Year" value="2025"/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="r:execute_script_r" compatibility="5.3.000" expanded="true" height="94" name="Execute Script (R)" width="90" x="246" y="30">
<parameter key="script" value="dat <- data.frame(dat) newdat <- data.frame(predict_yr) prediction <- predict(lm(Value~Year,data=dat),newdata=newdat) results <- data.frame(cbind(newdat,prediction)) names(results) <- c("Year","Value") results "/>
<enumeration key="inputs">
<parameter key="name_of_variable" value="dat"/>
<parameter key="name_of_variable" value="predict_yr"/>
</enumeration>
<list key="results">
<parameter key="results" value="Data Table"/>
</list>
</operator>
<connect from_port="in 1" to_op="Set Role (3)" to_port="example set input"/>
<connect from_op="Set Role (3)" from_port="example set output" to_op="Execute Script (R)" to_port="input 1"/>
<connect from_op="Predict Year" from_port="output" to_op="Execute Script (R)" to_port="input 2"/>
<connect from_op="Execute Script (R)" from_port="output 1" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_op="World Bank Data Extractor (2)" from_port="example set" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_op="Example 3" to_port="in 1"/>
<connect from_op="Multiply" from_port="output 2" to_op="Example 4" to_port="in 1"/>
<connect from_op="Example 4" from_port="out 1" to_port="result 2"/>
<connect from_op="Example 3" from_port="out 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
</process>
</operator>
</process>
Process Failed: The model did not return any results, so no prediction can be made. During model application the data is exported to R and needs to be scored there. The scored data should then be transferred back to RapidMiner but wasn't available. Offending operator: Apply Model.
Any help is appreciated.
Here is the XML for my process:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="quantx1:world_bank_data_extractor" compatibility="1.0.006" expanded="true" height="60" name="World Bank Data Extractor (2)" width="90" x="45" y="30">
<parameter key="Select Indicator" value="SP.POP.TOTL"/>
<parameter key="Start Year" value="1950"/>
<parameter key="End Year" value="2000"/>
<parameter key="Country" value="Germany"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.3.015" expanded="true" height="76" name="Select Attributes (2)" width="90" x="179" y="30">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="|Year|Value"/>
</operator>
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role" width="90" x="313" y="30">
<parameter key="attribute_name" value="Value"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="multiply" compatibility="5.3.015" expanded="true" height="94" name="Multiply" width="90" x="447" y="30"/>
<operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="76" name="Example 4" width="90" x="581" y="120">
<process expanded="true">
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role (4)" width="90" x="112" y="30">
<parameter key="attribute_name" value="Year"/>
<list key="set_additional_roles">
<parameter key="Value" value="label"/>
</list>
</operator>
<operator activated="true" class="r:linear_regression" compatibility="5.3.000" expanded="true" height="76" name="Linear Regression (3)" width="90" x="246" y="30"/>
<operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Predict Year (2)" width="90" x="112" y="120">
<list key="attribute_values">
<parameter key="Year" value="2025"/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (3)" width="90" x="380" y="75">
<list key="application_parameters"/>
</operator>
<connect from_port="in 1" to_op="Set Role (4)" to_port="example set input"/>
<connect from_op="Set Role (4)" from_port="example set output" to_op="Linear Regression (3)" to_port="training set"/>
<connect from_op="Linear Regression (3)" from_port="model" to_op="Apply Model (3)" to_port="model"/>
<connect from_op="Predict Year (2)" from_port="output" to_op="Apply Model (3)" to_port="unlabelled data"/>
<connect from_op="Apply Model (3)" from_port="labelled data" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="76" name="Example 3" width="90" x="581" y="30">
<process expanded="true">
<operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role (3)" width="90" x="112" y="30">
<parameter key="attribute_name" value="Year"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Predict Year" width="90" x="112" y="120">
<list key="attribute_values">
<parameter key="Year" value="2025"/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="r:execute_script_r" compatibility="5.3.000" expanded="true" height="94" name="Execute Script (R)" width="90" x="246" y="30">
<parameter key="script" value="dat <- data.frame(dat) newdat <- data.frame(predict_yr) prediction <- predict(lm(Value~Year,data=dat),newdata=newdat) results <- data.frame(cbind(newdat,prediction)) names(results) <- c("Year","Value") results "/>
<enumeration key="inputs">
<parameter key="name_of_variable" value="dat"/>
<parameter key="name_of_variable" value="predict_yr"/>
</enumeration>
<list key="results">
<parameter key="results" value="Data Table"/>
</list>
</operator>
<connect from_port="in 1" to_op="Set Role (3)" to_port="example set input"/>
<connect from_op="Set Role (3)" from_port="example set output" to_op="Execute Script (R)" to_port="input 1"/>
<connect from_op="Predict Year" from_port="output" to_op="Execute Script (R)" to_port="input 2"/>
<connect from_op="Execute Script (R)" from_port="output 1" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_op="World Bank Data Extractor (2)" from_port="example set" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_op="Example 3" to_port="in 1"/>
<connect from_op="Multiply" from_port="output 2" to_op="Example 4" to_port="in 1"/>
<connect from_op="Example 4" from_port="out 1" to_port="result 2"/>
<connect from_op="Example 3" from_port="out 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
</process>
</operator>
</process>
Tagged:
0