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

My custom operator has no input or output ports

anaRodriguesanaRodrigues Member Posts: 33 Contributor II
edited March 2021 in Help
Here's my process.
<div><?xml version="1.0" encoding="UTF-8"?><process version="9.8.001"></div><div>&nbsp; <context></div><div>&nbsp; &nbsp; <input/></div><div>&nbsp; &nbsp; <output/></div><div>&nbsp; &nbsp; <macros/></div><div>&nbsp; </context></div><div>&nbsp; <operator activated="true" class="process" compatibility="9.8.001" expanded="true" name="Process"></div><div>&nbsp; &nbsp; <parameter key="logverbosity" value="init"/></div><div>&nbsp; &nbsp; <parameter key="random_seed" value="2001"/></div><div>&nbsp; &nbsp; <parameter key="send_mail" value="never"/></div><div>&nbsp; &nbsp; <parameter key="notification_email" value=""/></div><div>&nbsp; &nbsp; <parameter key="process_duration_for_mail" value="30"/></div><div>&nbsp; &nbsp; <parameter key="encoding" value="SYSTEM"/></div><div>&nbsp; &nbsp; <process expanded="true"></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="read_csv" compatibility="9.8.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="289"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="csv_file" value="C:/Users/ASUS/Documents/Mestrado BBC/tese/4. Feature Extraction/Gland_data/gland_trainSet_stable.csv"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="column_separators" value=","/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="trim_lines" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_quotes" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="quotes_character" value="&quot;"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="escape_character" value="\"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="skip_comments" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="comment_characters" value="#"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="starting_row" value="1"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="parse_numbers" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="decimal_character" value="."/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="grouped_digits" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="grouping_character" value=","/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="infinity_representation" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="date_format" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="first_row_as_names" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="annotations"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="time_zone" value="SYSTEM"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="locale" value="English (United States)"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="encoding" value="SYSTEM"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="read_all_values_as_polynominal" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="data_set_meta_data_information"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="read_not_matching_values_as_missings" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="datamanagement" value="double_array"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="data_management" value="auto"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="filter_examples" compatibility="9.8.001" expanded="true" height="103" name="Remove missing data" width="90" x="179" y="289"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="parameter_expression" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="condition_class" value="no_missing_attributes"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="invert_filter" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="filters_list"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="filters_logic_and" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="filters_check_metadata" value="true"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="set_role" compatibility="9.8.001" expanded="true" height="82" name="Set Role (2)" width="90" x="313" y="289"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="attribute_name" value="ID"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="target_role" value="id"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="set_additional_roles"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="ID" value="id"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="Target" value="label"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; </list></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="naive_bayes" compatibility="9.8.001" expanded="true" height="82" name="Naive Bayes (4)" width="90" x="447" y="289"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="laplace_correction" value="true"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="read_csv" compatibility="9.8.001" expanded="true" height="68" name="Read CSV (2)" width="90" x="313" y="391"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="csv_file" value="C:/Users/ASUS/Documents/Mestrado BBC/tese/4. Feature Extraction/Gland_data/gland_trainSet_stable.csv"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="column_separators" value=","/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="trim_lines" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_quotes" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="quotes_character" value="&quot;"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="escape_character" value="\"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="skip_comments" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="comment_characters" value="#"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="starting_row" value="1"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="parse_numbers" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="decimal_character" value="."/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="grouped_digits" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="grouping_character" value=","/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="infinity_representation" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="date_format" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="first_row_as_names" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="annotations"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="time_zone" value="SYSTEM"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="locale" value="English (United States)"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="encoding" value="SYSTEM"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="read_all_values_as_polynominal" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="data_set_meta_data_information"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="read_not_matching_values_as_missings" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="datamanagement" value="double_array"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="data_management" value="auto"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="set_role" compatibility="9.8.001" expanded="true" height="82" name="Set Role (5)" width="90" x="447" y="391"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="attribute_name" value="ID"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="target_role" value="id"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="set_additional_roles"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="Target" value="label"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; </list></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="false" class="apply_model" compatibility="9.8.001" expanded="true" height="82" name="Apply Model (4)" width="90" x="581" y="289"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <list key="application_parameters"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="create_view" value="false"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="performance_binominal_classification" compatibility="9.8.001" expanded="true" height="82" name="Performance" width="90" x="45" y="34"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="manually_set_positive_class" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="main_criterion" value="first"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="accuracy" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="classification_error" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="kappa" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="AUC (optimistic)" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="AUC" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="AUC (pessimistic)" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="precision" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="recall" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="lift" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="fallout" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="f_measure" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="false_positive" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="false_negative" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="true_positive" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="true_negative" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="sensitivity" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="specificity" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="youden" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="positive_predictive_value" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="negative_predictive_value" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="psep" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="skip_undefined_labels" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_example_weights" value="true"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="operator_toolbox:performance_auprc" compatibility="2.9.000" expanded="true" height="82" name="Performance (AUPRC)" width="90" x="179" y="34"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="main_criterion" value="first"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="accuracy" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="AUC" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="AUPRC" value="false"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="skip_undefined_labels" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_example_weights" value="true"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="multiply" compatibility="9.8.001" expanded="true" height="103" name="Multiply" width="90" x="313" y="136"/></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="performance_to_data" compatibility="9.8.001" expanded="true" height="82" name="Performance to Data" width="90" x="447" y="34"/></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="python_scripting:execute_python" compatibility="9.8.000" expanded="true" height="103" name="Execute Python" width="90" x="581" y="34"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="script" value="import pandas as pd&#10;import numpy as np&#10;&#10;# rm_main is a mandatory function, &#10;# the number of arguments has to be the number of input ports (can be none),&#10;#&nbsp; &nbsp; &nbsp;or the number of input ports plus one if &quot;use macros&quot; parameter is set&#10;# if you want to use macros, use this instead and check &quot;use macros&quot; parameter:&#10;#def rm_main(data,macros):&#10;def rm_main(data):&#10;&nbsp; &nbsp; #print(float(data.loc[data[&quot;Criterion&quot;]==&quot;precision&quot;,&quot;Value&quot;]))&#10;&nbsp; &nbsp; p = float(data.loc[data[&quot;Criterion&quot;]==&quot;precision&quot;,&quot;Value&quot;])&#10;&nbsp; &nbsp; r = float(data.loc[data[&quot;Criterion&quot;]==&quot;recall&quot;,&quot;Value&quot;])&#10;&nbsp; &nbsp; f = (1 + %{beta}**2)*p*r / (%{beta}**2 * p + r)&#10;&nbsp; &nbsp; data = data.set_index(&quot;Criterion&quot;)&#10;&nbsp; &nbsp; data = data.transpose()&#10;&nbsp; &nbsp; data[&quot;Fbeta-score&quot;]=f&#10;&nbsp; &nbsp; data = data.dropna()&#10;&nbsp; &nbsp; #print(data.columns)&#10;&nbsp; &nbsp; #df = pd.DataFrame({&quot;Criterion&quot;:&quot;Fbeta-score&quot;, &quot;Value&quot;:f}, columns=data.columns)&#10;&nbsp; &nbsp; #df = pd.DataFrame([[&quot;Fbeta-score&quot;, f, np.nan, np.nan]], columns=data.columns)&#10;&nbsp; &nbsp; #data.append(df, ignore_index=True)&#10;&nbsp; &nbsp; return data"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="notebook_cell_tag_filter" value=""/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_default_python" value="true"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="package_manager" value="conda (anaconda)"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="use_macros" value="false"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="extract_performance" compatibility="9.8.001" expanded="true" height="82" name="Performance (2)" width="90" x="715" y="34"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="performance_type" value="data_value"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="statistics" value="average"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="attribute_name" value="%{metric_to_optimize}"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="example_index" value="1"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="optimization_direction" value="maximize"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="multiply" compatibility="9.8.001" expanded="true" height="103" name="Multiply (2)" width="90" x="849" y="34"/></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="collect" compatibility="9.8.001" expanded="true" height="103" name="Collect" width="90" x="983" y="136"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="unfold" value="false"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="set_macro" compatibility="9.8.001" expanded="true" height="68" name="beta" width="90" x="179" y="136"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="macro" value="beta"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="2"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <operator activated="true" class="process_defined_operators:category_parameter_macro" compatibility="0.9.007" expanded="true" height="68" name="Metric to optimize" width="90" x="45" y="136"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <enumeration key="possible_values"></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="AUPRC"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="Fbeta-score"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="AUC"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="precision"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="recall"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="Kappa"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; </enumeration></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="macro" value="metric_to_optimize"/></div><div>&nbsp; &nbsp; &nbsp; &nbsp; <parameter key="value" value="AUPRC"/></div><div>&nbsp; &nbsp; &nbsp; </operator></div><div>&nbsp; &nbsp; &nbsp; <connect from_port="input 1" to_op="Performance" to_port="labelled data"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Read CSV" from_port="output" to_op="Remove missing data" to_port="example set input"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Remove missing data" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Set Role (2)" from_port="example set output" to_op="Naive Bayes (4)" to_port="training set"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Naive Bayes (4)" from_port="model" to_op="Apply Model (4)" to_port="model"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Read CSV (2)" from_port="output" to_op="Set Role (5)" to_port="example set input"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Set Role (5)" from_port="example set output" to_op="Apply Model (4)" to_port="unlabelled data"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Performance" from_port="performance" to_op="Performance (AUPRC)" to_port="performance"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Performance" from_port="example set" to_op="Performance (AUPRC)" to_port="labelled data"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Performance (AUPRC)" from_port="performance" to_op="Multiply" to_port="input"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Multiply" from_port="output 1" to_op="Performance to Data" to_port="performance vector"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Multiply" from_port="output 2" to_op="Collect" to_port="input 2"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Performance to Data" from_port="example set" to_op="Execute Python" to_port="input 1"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Execute Python" from_port="output 1" to_op="Performance (2)" to_port="example set"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Performance (2)" from_port="performance" to_op="Multiply (2)" to_port="input"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Multiply (2)" from_port="output 1" to_port="result 1"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Multiply (2)" from_port="output 2" to_op="Collect" to_port="input 1"/></div><div>&nbsp; &nbsp; &nbsp; <connect from_op="Collect" from_port="collection" to_port="result 2"/></div><div>&nbsp; &nbsp; &nbsp; <portSpacing port="source_input 1" spacing="0"/></div><div>&nbsp; &nbsp; &nbsp; <portSpacing port="source_input 2" spacing="0"/></div><div>&nbsp; &nbsp; &nbsp; <portSpacing port="sink_result 1" spacing="0"/></div><div>&nbsp; &nbsp; &nbsp; <portSpacing port="sink_result 2" spacing="0"/></div><div>&nbsp; &nbsp; &nbsp; <portSpacing port="sink_result 3" spacing="0"/></div><div>&nbsp; &nbsp; </process></div><div>&nbsp; </operator></div><div></process></div>

Tagged:

Best Answer

  • gmeiergmeier Employee-RapidMiner, Member Posts: 25 RM Engineering
    Solution Accepted
    Hi @anaRodrigues,

    Please try if the ports appear when you activate Process > Validate Automatically or when you press F12. Will try to fix that for the next release of the extension.

    Note that for the newer versions of the extension (which you have from the stack trace you posted) no jdk is needed anymore. Thanks for reporting the stack trace of the error, this will also be fixed with the next release. It should work when you use the Next button in the Create Custom Extension dialog.

Answers

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi @anaRodrigues,

    the process XML was garbled but I think I was able to clean it up.

    When I post processes, I first insert a Spoiler paragraph, then inside that a Code paragraph. 

    This is the process XML usable in RapidMiner:
    <?xml version="1.0" encoding="UTF-8"?><process version="9.8.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.8.001" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="false" class="read_csv" compatibility="9.8.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="289">
            <parameter key="csv_file" value="C:/Users/ASUS/Documents/Mestrado BBC/tese/4. Feature Extraction/Gland_data/gland_trainSet_stable.csv"/>
            <parameter key="column_separators" value=","/>
            <parameter key="trim_lines" value="false"/>
            <parameter key="use_quotes" value="true"/>
            <parameter key="quotes_character" value="&amp;quot;"/>
            <parameter key="escape_character" value="\"/>
            <parameter key="skip_comments" value="false"/>
            <parameter key="comment_characters" value="#"/>
            <parameter key="starting_row" value="1"/>
            <parameter key="parse_numbers" value="true"/>
            <parameter key="decimal_character" value="."/>
            <parameter key="grouped_digits" value="false"/>
            <parameter key="grouping_character" value=","/>
            <parameter key="infinity_representation" value=""/>
            <parameter key="date_format" value=""/>
            <parameter key="first_row_as_names" value="true"/>
            <list key="annotations"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="encoding" value="SYSTEM"/>
            <parameter key="read_all_values_as_polynominal" value="false"/>
            <list key="data_set_meta_data_information"/>
            <parameter key="read_not_matching_values_as_missings" value="true"/>
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="false" class="filter_examples" compatibility="9.8.001" expanded="true" height="103" name="Remove missing data" width="90" x="179" y="289">
            <parameter key="parameter_expression" value=""/>
            <parameter key="condition_class" value="no_missing_attributes"/>
            <parameter key="invert_filter" value="false"/>
            <list key="filters_list"/>
            <parameter key="filters_logic_and" value="true"/>
            <parameter key="filters_check_metadata" value="true"/>
          </operator>
          <operator activated="false" class="set_role" compatibility="9.8.001" expanded="true" height="82" name="Set Role (2)" width="90" x="313" y="289">
            <parameter key="attribute_name" value="ID"/>
            <parameter key="target_role" value="id"/>
            <list key="set_additional_roles">
              <parameter key="ID" value="id"/>
              <parameter key="Target" value="label"/>
            </list>
          </operator>
          <operator activated="false" class="naive_bayes" compatibility="9.8.001" expanded="true" height="82" name="Naive Bayes (4)" width="90" x="447" y="289">
            <parameter key="laplace_correction" value="true"/>
          </operator>
          <operator activated="false" class="read_csv" compatibility="9.8.001" expanded="true" height="68" name="Read CSV (2)" width="90" x="313" y="391">
            <parameter key="csv_file" value="C:/Users/ASUS/Documents/Mestrado BBC/tese/4. Feature Extraction/Gland_data/gland_trainSet_stable.csv"/>
            <parameter key="column_separators" value=","/>
            <parameter key="trim_lines" value="false"/>
            <parameter key="use_quotes" value="true"/>
            <parameter key="quotes_character" value="&amp;quot;"/>
            <parameter key="escape_character" value="\"/>
            <parameter key="skip_comments" value="false"/>
            <parameter key="comment_characters" value="#"/>
            <parameter key="starting_row" value="1"/>
            <parameter key="parse_numbers" value="true"/>
            <parameter key="decimal_character" value="."/>
            <parameter key="grouped_digits" value="false"/>
            <parameter key="grouping_character" value=","/>
            <parameter key="infinity_representation" value=""/>
            <parameter key="date_format" value=""/>
            <parameter key="first_row_as_names" value="true"/>
            <list key="annotations"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="encoding" value="SYSTEM"/>
            <parameter key="read_all_values_as_polynominal" value="false"/>
            <list key="data_set_meta_data_information"/>
            <parameter key="read_not_matching_values_as_missings" value="true"/>
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="false" class="set_role" compatibility="9.8.001" expanded="true" height="82" name="Set Role (5)" width="90" x="447" y="391">
            <parameter key="attribute_name" value="ID"/>
            <parameter key="target_role" value="id"/>
            <list key="set_additional_roles">
              <parameter key="Target" value="label"/>
            </list>
          </operator>
          <operator activated="false" class="apply_model" compatibility="9.8.001" expanded="true" height="82" name="Apply Model (4)" width="90" x="581" y="289">
            <list key="application_parameters"/>
            <parameter key="create_view" value="false"/>
          </operator>
          <operator activated="true" class="performance_binominal_classification" compatibility="9.8.001" expanded="true" height="82" name="Performance" width="90" x="45" y="34">
            <parameter key="manually_set_positive_class" value="false"/>
            <parameter key="main_criterion" value="first"/>
            <parameter key="accuracy" value="true"/>
            <parameter key="classification_error" value="false"/>
            <parameter key="kappa" value="true"/>
            <parameter key="AUC (optimistic)" value="false"/>
            <parameter key="AUC" value="true"/>
            <parameter key="AUC (pessimistic)" value="false"/>
            <parameter key="precision" value="true"/>
            <parameter key="recall" value="true"/>
            <parameter key="lift" value="false"/>
            <parameter key="fallout" value="false"/>
            <parameter key="f_measure" value="false"/>
            <parameter key="false_positive" value="false"/>
            <parameter key="false_negative" value="false"/>
            <parameter key="true_positive" value="false"/>
            <parameter key="true_negative" value="false"/>
            <parameter key="sensitivity" value="false"/>
            <parameter key="specificity" value="false"/>
            <parameter key="youden" value="false"/>
            <parameter key="positive_predictive_value" value="false"/>
            <parameter key="negative_predictive_value" value="false"/>
            <parameter key="psep" value="false"/>
            <parameter key="skip_undefined_labels" value="true"/>
            <parameter key="use_example_weights" value="true"/>
          </operator>
          <operator activated="true" class="operator_toolbox:performance_auprc" compatibility="2.8.001" expanded="true" height="82" name="Performance (AUPRC)" width="90" x="179" y="34">
            <parameter key="main_criterion" value="first"/>
            <parameter key="accuracy" value="true"/>
            <parameter key="AUC" value="false"/>
            <parameter key="AUPRC" value="false"/>
            <parameter key="skip_undefined_labels" value="true"/>
            <parameter key="use_example_weights" value="true"/>
          </operator>
          <operator activated="true" class="multiply" compatibility="9.8.001" expanded="true" height="103" name="Multiply" width="90" x="313" y="136"/>
          <operator activated="true" class="performance_to_data" compatibility="9.8.001" expanded="true" height="82" name="Performance to Data" width="90" x="447" y="34"/>
          <operator activated="true" class="python_scripting:execute_python" compatibility="9.8.000" expanded="true" height="103" name="Execute Python" width="90" x="581" y="34">
            <parameter key="script" value="import pandas as pd&amp;#10;import numpy as np&amp;#10;&amp;#10;# rm_main is a mandatory function, &amp;#10;# the number of arguments has to be the number of input ports (can be none),&amp;#10;#  or the number of input ports plus one if &amp;quot;use macros&amp;quot; parameter is set&amp;#10;# if you want to use macros, use this instead and check &amp;quot;use macros&amp;quot; parameter:&amp;#10;#def rm_main(data,macros):&amp;#10;def rm_main(data):&amp;#10;  #print(float(data.loc[data[&amp;quot;Criterion&amp;quot;]==&amp;quot;precision&amp;quot;,&amp;quot;Value&amp;quot;]))&amp;#10;  p = float(data.loc[data[&amp;quot;Criterion&amp;quot;]==&amp;quot;precision&amp;quot;,&amp;quot;Value&amp;quot;])&amp;#10;  r = float(data.loc[data[&amp;quot;Criterion&amp;quot;]==&amp;quot;recall&amp;quot;,&amp;quot;Value&amp;quot;])&amp;#10;  f = (1 + %{beta}**2)*p*r / (%{beta}**2 * p + r)&amp;#10;  data = data.set_index(&amp;quot;Criterion&amp;quot;)&amp;#10;  data = data.transpose()&amp;#10;  data[&amp;quot;Fbeta-score&amp;quot;]=f&amp;#10;  data = data.dropna()&amp;#10;  #print(data.columns)&amp;#10;  #df = pd.DataFrame({&amp;quot;Criterion&amp;quot;:&amp;quot;Fbeta-score&amp;quot;, &amp;quot;Value&amp;quot;:f}, columns=data.columns)&amp;#10;  #df = pd.DataFrame([[&amp;quot;Fbeta-score&amp;quot;, f, np.nan, np.nan]], columns=data.columns)&amp;#10;  #data.append(df, ignore_index=True)&amp;#10;  return data"/>
            <parameter key="notebook_cell_tag_filter" value=""/>
            <parameter key="use_default_python" value="true"/>
            <parameter key="package_manager" value="conda (anaconda)"/>
            <parameter key="use_macros" value="false"/>
          </operator>
          <operator activated="true" class="extract_performance" compatibility="9.8.001" expanded="true" height="82" name="Performance (2)" width="90" x="715" y="34">
            <parameter key="performance_type" value="data_value"/>
            <parameter key="statistics" value="average"/>
            <parameter key="attribute_name" value="%{metric_to_optimize}"/>
            <parameter key="example_index" value="1"/>
            <parameter key="optimization_direction" value="maximize"/>
          </operator>
          <operator activated="true" class="multiply" compatibility="9.8.001" expanded="true" height="103" name="Multiply (2)" width="90" x="849" y="34"/>
          <operator activated="true" class="collect" compatibility="9.8.001" expanded="true" height="103" name="Collect" width="90" x="983" y="136">
            <parameter key="unfold" value="false"/>
          </operator>
          <operator activated="true" class="set_macro" compatibility="9.8.001" expanded="true" height="68" name="beta" width="90" x="179" y="136">
            <parameter key="macro" value="beta"/>
            <parameter key="value" value="2"/>
          </operator>
          <operator activated="true" class="process_defined_operators:category_parameter_macro" compatibility="0.9.006" expanded="true" height="68" name="Metric to optimize" width="90" x="45" y="136">
            <enumeration key="possible_values">
              <parameter key="value" value="AUPRC"/>
              <parameter key="value" value="Fbeta-score"/>
              <parameter key="value" value="AUC"/>
              <parameter key="value" value="precision"/>
              <parameter key="value" value="recall"/>
              <parameter key="value" value="Kappa"/>
            </enumeration>
            <parameter key="macro" value="metric_to_optimize"/>
            <parameter key="value" value="AUPRC"/>
          </operator>
          <connect from_port="input 1" to_op="Performance" to_port="labelled data"/>
          <connect from_op="Read CSV" from_port="output" to_op="Remove missing data" to_port="example set input"/>
          <connect from_op="Remove missing data" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
          <connect from_op="Set Role (2)" from_port="example set output" to_op="Naive Bayes (4)" to_port="training set"/>
          <connect from_op="Naive Bayes (4)" from_port="model" to_op="Apply Model (4)" to_port="model"/>
          <connect from_op="Read CSV (2)" from_port="output" to_op="Set Role (5)" to_port="example set input"/>
          <connect from_op="Set Role (5)" from_port="example set output" to_op="Apply Model (4)" to_port="unlabelled data"/>
          <connect from_op="Performance" from_port="performance" to_op="Performance (AUPRC)" to_port="performance"/>
          <connect from_op="Performance" from_port="example set" to_op="Performance (AUPRC)" to_port="labelled data"/>
          <connect from_op="Performance (AUPRC)" from_port="performance" to_op="Multiply" to_port="input"/>
          <connect from_op="Multiply" from_port="output 1" to_op="Performance to Data" to_port="performance vector"/>
          <connect from_op="Multiply" from_port="output 2" to_op="Collect" to_port="input 2"/>
          <connect from_op="Performance to Data" from_port="example set" to_op="Execute Python" to_port="input 1"/>
          <connect from_op="Execute Python" from_port="output 1" to_op="Performance (2)" to_port="example set"/>
          <connect from_op="Performance (2)" from_port="performance" to_op="Multiply (2)" to_port="input"/>
          <connect from_op="Multiply (2)" from_port="output 1" to_port="result 1"/>
          <connect from_op="Multiply (2)" from_port="output 2" to_op="Collect" to_port="input 1"/>
          <connect from_op="Collect" from_port="collection" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="source_input 2" 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>


    The process looks OK to me, I don't know why it doesn't have input and output ports when converted to a custom operator. I asked the developer to take a look at it.
     
    Regards,
    Balázs

  • anaRodriguesanaRodrigues Member Posts: 33 Contributor II
    Hi @BalazsBarany,

    Thank you for your answer. I read in your tutorial that we need jdk, and not just jre, for the custom operator to work. How can I check this?

    Also, to test my operator I'm right clicking the .cusop file and creating a temporary operator. Could this be why it has no ports?

    Thank you,
    Ana
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi @anaRodrigues,

    depending on your operating system, you can check the installation directory. RapidMiner on Windows comes with its own Java runtime.

    If you can issue "javac -version" on a command prompt or shell and you get a version number, you have the Java compiler which is a part of the JDK.

    I am not sure if just using the .cusop file is enough. I always used the Extensions/Create Custom Extension menu to create and install the custom extension. 

    Regards,

    Balázs
  • anaRodriguesanaRodrigues Member Posts: 33 Contributor II
    edited March 2021
    Hi @BalazsBarany ,

    So I did the javac -version thing and got a version number, so that seems to be ok.

    I tried creating the custom extension, but I get this error:



    Thanks,
    Ana
  • anaRodriguesanaRodrigues Member Posts: 33 Contributor II
    Hi @BalazsBarany,

    So, out of knowwhere it worked and I was able to create and install the extension. However, the operator still has no ports.

    Thank you so much for your help anyway!
    Ana 
  • anaRodriguesanaRodrigues Member Posts: 33 Contributor II
    Thank you thank you thank you @gmeier!
Sign In or Register to comment.