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