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

"extract results of similarity process to java"

JimmysJimmys Member Posts: 1 Learner III
edited June 2019 in Help
Hello,
I'm new in RapidMiner and I need some help please!
I have a process in RM witch find similarity between some records.  This process run successfully!
I run this process in java, but I cant get the results.
In java code run the process and get the result in IOContainer object.
Then get data of first outpout port with
SimilarityMeasureObject result = (SimilarityMeasureObject)ioResult.getElementAt(0);
How  can get the results of this process??
Thank you!!!

The RM process

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.008">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
   <process expanded="true">
     <operator activated="true" class="read_database" compatibility="5.3.008" expanded="true" height="60" name="Read Database" width="90" x="45" y="75">
       <parameter key="connection" value="diplomatii"/>
       <parameter key="query" value="SELECT `comment`&#10;FROM `web`"/>
       <enumeration key="parameters"/>
     </operator>
     <operator activated="true" class="nominal_to_text" compatibility="5.3.008" expanded="true" height="76" name="Nominal to Text" width="90" x="179" y="75"/>
     <operator activated="true" class="text:process_document_from_data" compatibility="5.3.000" expanded="true" height="76" name="Process Documents from Data" width="90" x="313" y="75">
       <parameter key="prune_method" value="percentual"/>
       <parameter key="prune_above_percent" value="60.0"/>
       <parameter key="select_attributes_and_weights" value="true"/>
       <list key="specify_weights">
         <parameter key="comment" value="1.0"/>
       </list>
       <process expanded="true">
         <operator activated="true" class="text:replace_tokens" compatibility="5.3.000" expanded="true" height="60" name="Replace Tokens" width="90" x="45" y="75">
           <list key="replace_dictionary">
             <parameter key="[-!&quot;#$%&amp;'()*+,./:;&lt;=&gt;?@\[\\\]_`{|}~]" value=" "/>
           </list>
         </operator>
         <operator activated="true" class="text:tokenize" compatibility="5.3.000" expanded="true" height="60" name="Tokenize" width="90" x="179" y="75">
           <parameter key="mode" value="linguistic tokens"/>
         </operator>
         <operator activated="true" class="text:transform_cases" compatibility="5.3.000" expanded="true" height="60" name="Transform Cases" width="90" x="313" y="75">
           <parameter key="transform_to" value="upper case"/>
         </operator>
         <operator activated="true" class="text:filter_by_length" compatibility="5.3.000" expanded="true" height="60" name="Filter Tokens (by Length)" width="90" x="179" y="210"/>
         <operator activated="true" class="text:filter_stopwords_dictionary" compatibility="5.3.000" expanded="true" height="76" name="Filter Stopwords (Dictionary)" width="90" x="313" y="210">
           <parameter key="file" value="C:\Users\Dimitris\Desktop\greek stopwords.txt"/>
         </operator>
         <operator activated="true" class="text:filter_stopwords_english" compatibility="5.3.000" expanded="true" height="60" name="Filter Stopwords (English)" width="90" x="447" y="210"/>
         <operator activated="true" class="text:stem_snowball" compatibility="5.3.000" expanded="true" height="60" name="Stem (Snowball)" width="90" x="581" y="210"/>
         <operator activated="true" class="text:generate_n_grams_terms" compatibility="5.3.000" expanded="true" height="60" name="Generate n-Grams (Terms)" width="90" x="648" y="75">
           <parameter key="max_length" value="3"/>
         </operator>
         <connect from_port="document" to_op="Replace Tokens" to_port="document"/>
         <connect from_op="Replace Tokens" from_port="document" to_op="Tokenize" to_port="document"/>
         <connect from_op="Tokenize" from_port="document" to_op="Transform Cases" to_port="document"/>
         <connect from_op="Transform Cases" from_port="document" to_op="Filter Tokens (by Length)" to_port="document"/>
         <connect from_op="Filter Tokens (by Length)" from_port="document" to_op="Filter Stopwords (Dictionary)" to_port="document"/>
         <connect from_op="Filter Stopwords (Dictionary)" from_port="document" to_op="Filter Stopwords (English)" to_port="document"/>
         <connect from_op="Filter Stopwords (English)" from_port="document" to_op="Stem (Snowball)" to_port="document"/>
         <connect from_op="Stem (Snowball)" from_port="document" to_op="Generate n-Grams (Terms)" to_port="document"/>
         <connect from_op="Generate n-Grams (Terms)" from_port="document" to_port="document 1"/>
         <portSpacing port="source_document" spacing="0"/>
         <portSpacing port="sink_document 1" spacing="0"/>
         <portSpacing port="sink_document 2" spacing="0"/>
       </process>
     </operator>
     <operator activated="true" class="data_to_similarity" compatibility="5.3.008" expanded="true" height="76" name="Data to Similarity" width="90" x="447" y="75">
       <parameter key="measure_types" value="NumericalMeasures"/>
       <parameter key="numerical_measure" value="CosineSimilarity"/>
     </operator>
     <connect from_op="Read Database" from_port="output" to_op="Nominal to Text" to_port="example set input"/>
     <connect from_op="Nominal to Text" from_port="example set output" to_op="Process Documents from Data" to_port="example set"/>
     <connect from_op="Process Documents from Data" from_port="example set" to_op="Data to Similarity" to_port="example set"/>
     <connect from_op="Data to Similarity" from_port="similarity" 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:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    I'm sorry for missing this post for so long! :-[
    You should get the SimilarityMeasureObject with the code and process you provided - what exactly is the problem now?

    Regards,
    Marco
Sign In or Register to comment.