Generate Data y=f(x)

Hi All,
I'm a beginner and I just simply wants to gerenate a small table with two atrributes, x and y.
x = 1,2,3,4,5
y = x^2 = 1,2, 4,9,16,25
I tried to do that with the generate Data processors, but I couldn't manage it.
Can someone help me? Thank you in advance.
Regards
jens
Best Answer
-
Hi Jens,
it's a macro of the process defined in the context. Macros are process variables. Have a look at this article for more details: http://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-to-Use-Macros/ta-p/32966
Best,
Martin
1
Answers
-
Hallo Jens,
Just check the attached process. This is how i created a sqrt function for my latest gbt kb article.
~Martin<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
<context>
<input/>
<output/>
<macros>
<macro>
<key>points</key>
<value>1000</value>
</macro>
</macros>
</context>
<operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" breakpoints="after" class="subprocess" compatibility="7.4.000" expanded="true" height="82" name="Subprocess" width="90" x="45" y="34">
<process expanded="true">
<operator activated="true" class="generate_data" compatibility="7.4.000" expanded="true" height="68" name="Generate Data" width="90" x="45" y="34">
<parameter key="number_examples" value="%{points}"/>
</operator>
<operator activated="true" class="generate_id" compatibility="7.4.000" expanded="true" height="82" name="Generate ID" width="90" x="179" y="34"/>
<operator activated="true" class="generate_attributes" compatibility="7.4.000" expanded="true" height="82" name="Generate Attributes" width="90" x="313" y="34">
<list key="function_descriptions">
<parameter key="value" value="sqrt(id/eval(%{points}))"/>
<parameter key="id" value="id/eval(%{points})"/>
</list>
</operator>
<operator activated="true" class="select_attributes" compatibility="7.4.000" expanded="true" height="82" name="Select Attributes" width="90" x="447" y="34">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="value|id"/>
<parameter key="include_special_attributes" value="true"/>
</operator>
<operator activated="true" class="rename" compatibility="7.4.000" expanded="true" height="82" name="Rename" width="90" x="581" y="34">
<parameter key="old_name" value="id"/>
<parameter key="new_name" value="x"/>
<list key="rename_additional_attributes"/>
</operator>
<operator activated="true" class="set_role" compatibility="7.4.000" expanded="true" height="82" name="Set Role" width="90" x="709" y="34">
<parameter key="attribute_name" value="x"/>
<list key="set_additional_roles">
<parameter key="value" value="label"/>
</list>
</operator>
<connect from_op="Generate Data" from_port="output" to_op="Generate ID" to_port="example set input"/>
<connect from_op="Generate ID" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Rename" to_port="example set input"/>
<connect from_op="Rename" 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_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_op="Subprocess" 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"/>
</process>
</operator>
</process>0 -
Hi Martin,
ok thank you, I understand.
I just wonder, where you have defined the value 1000 behind the variable %{points}. (Generates 1000 Rows).
Could you please explain that?
Regards
Jens
0 -
Hi Jens,
it's a macro of the process defined in the context. Macros are process variables. Have a look at this article for more details: http://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-to-Use-Macros/ta-p/32966
Best,
Martin
1 -
ah ok,
I was expectinig a Set macro Process.
I Didn't know the context panel.
Thanks a lot
Jens
0