The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
how to extract metadata of a table (other than using R)?
Hi, how do I programmatically extract the metadata of a table?
For exmaple, how to extract the column name of the label?
I want to automate some workflow based on what the data look like. Thanks
I know how to extract metadata in "EXECTURE R". If there's no easy way using RM functions, I'll use R.
sample code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.4.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_data" compatibility="6.4.000" expanded="true" height="60" name="Generate Data" width="90" x="112" y="30">
<parameter key="number_examples" value="10"/>
</operator>
<connect from_op="Generate Data" from_port="output" 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>
Tagged:
0
Best Answer
-
IngoRM Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
Hey,
Ok, got it. There might be another way (it's getting late ;-)) but right now the only one I was able to come with was by using a small script in the Execute Script operator. Below is a process which is doing this.
Hope this helps and I will come back if I can figure out a completely code free way :smileywink:
Best,
Ingo
<?xml version="1.0" encoding="UTF-8"?><process version="7.2.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.2.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="7.2.001" expanded="true" height="68" name="Retrieve Sonar" width="90" x="45" y="34">
<parameter key="repository_entry" value="//Samples/data/Sonar"/>
</operator>
<operator activated="true" class="execute_script" compatibility="7.2.001" expanded="true" height="82" name="Execute Script" width="90" x="179" y="34">
<parameter key="script" value="ExampleSet exampleSet = operator.getInput(ExampleSet.class); Attribute label = exampleSet.getAttributes().getLabel(); if (label != null) 	operator.getProcess().getMacroHandler().addMacro("label_name", label.getName()); else 	operator.getProcess().getMacroHandler().addMacro("label_name", "null"); 	 return exampleSet;"/>
</operator>
<connect from_op="Retrieve Sonar" from_port="output" to_op="Execute Script" to_port="input 1"/>
<connect from_op="Execute Script" from_port="output 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
Answers
Hi,
Well, I don't know all your requirements but it sounds like a combination of Branch with Generate Macro might be able to do the job. Otherwise you can go with Execute Script / R.
Sorry, I think that I would need to know a bit more (maybe an example for an application?) to be more specific...
Cheers,
Ingo
Thank you very much Ingo!
My specific questions is, when you have a data table, how to get a macro = column name of the label (null if there is no label)?
The context is automatic workflow, which can be implemented using BRANCH or SELECT SUBPROCESSES.
Hope this helps make it clear. Thank you for your help~
Thank you Ingo!
Sripting is actually good - neat for complex logics. Thanks-
Glad to hear this :smileyhappy: - Have a nice weekend,
Ingo
Hi ingo thanks again for your help!
I don't know java. I tested the code and it displayed the dataset itself...
my implementation using R: - see LOG panel for things printed in R
(if can't find label/attribute, get empty list, not a NULL)
In my code I only have extracted the name of the label column into the macro "label_name" and then it delivers the data again as output. You would need to add the other columns as well if you want to go down the Java route. And you can only see the effect if you use the macro afterwards or if you use the panel "Macros" from the "View" menu - probably it would have been helpful if I would have mentioned that :-)
Cheers,
Ingo
Ahhh in the macro! Yes actually we need to send it into a macro to use it later.
Thank you Ingo! Have a good weekend