Keras Sample bug??

mansourmansour Member Posts: 26 Contributor II
I changed iris-classification samples of Keras to 2 target classes (deleted just one class in the database) and sat the number of units parameter in core layer two to 2 (output class). It didn't work and gave the shape error (attached). I tried with various conditions and had the same problem. Any thought?
Regards. Mansour

<?xml version="1.0" encoding="UTF-8"?><process version="9.3.001">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="9.3.001" expanded="true" name="Process" origin="GENERATED_SAMPLE">
    <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="true" class="retrieve" compatibility="9.3.001" expanded="true" height="68" name="Retrieve Iris" origin="GENERATED_SAMPLE" width="90" x="45" y="289">
        <parameter key="repository_entry" value="//Samples/data/Iris"/>
      </operator>
      <operator activated="true" class="filter_examples" compatibility="9.3.001" expanded="true" height="103" name="Filter Examples" width="90" x="179" y="289">
        <parameter key="parameter_expression" value=""/>
        <parameter key="condition_class" value="custom_filters"/>
        <parameter key="invert_filter" value="true"/>
        <list key="filters_list">
          <parameter key="filters_entry_key" value="label.equals.Iris-setosa"/>
        </list>
        <parameter key="filters_logic_and" value="true"/>
        <parameter key="filters_check_metadata" value="true"/>
      </operator>
      <operator activated="true" class="split_data" compatibility="9.3.001" expanded="true" height="103" name="Split Data" origin="GENERATED_SAMPLE" width="90" x="313" y="289">
        <enumeration key="partitions">
          <parameter key="ratio" value="0.9"/>
          <parameter key="ratio" value="0.1"/>
        </enumeration>
        <parameter key="sampling_type" value="automatic"/>
        <parameter key="use_local_random_seed" value="false"/>
        <parameter key="local_random_seed" value="1992"/>
      </operator>
      <operator activated="true" class="keras:sequential" compatibility="1.0.003" expanded="true" height="166" name="Keras Model" origin="GENERATED_SAMPLE" width="90" x="447" y="187">
        <parameter key="input shape" value="(4,)"/>
        <parameter key="loss" value="categorical_crossentropy"/>
        <parameter key="optimizer" value="Adam"/>
        <parameter key="learning rate" value="0.001"/>
        <parameter key="momentum" value="0.0"/>
        <parameter key="rho" value="0.9"/>
        <parameter key="beta 1" value="0.999"/>
        <parameter key="beta 2" value="0.999"/>
        <parameter key="epsilon" value="1.0E-8"/>
        <parameter key="decay" value="0.0"/>
        <parameter key="schedule decay" value="0.004"/>
        <parameter key="Nesterov" value="false"/>
        <parameter key="use metric" value="false"/>
        <enumeration key="metric"/>
        <parameter key="epochs" value="128"/>
        <parameter key="batch size" value="32"/>
        <enumeration key="callbacks">
          <parameter key="callbacks" value="TensorBoard(log_dir='./logs', histogram_freq=0, write_graph=True, write_images=False, embeddings_freq=0, embeddings_layer_names=None, embeddings_metadata=None)"/>
        </enumeration>
        <parameter key="verbose" value="1"/>
        <parameter key="validation split" value="0.0"/>
        <parameter key="shuffle" value="false"/>
        <parameter key="fix seed" value="false"/>
        <parameter key="random seed" value="0"/>
        <process expanded="true">
          <operator activated="true" class="keras:core_layer" compatibility="1.0.003" expanded="true" height="82" name="Add Core Layer" origin="GENERATED_SAMPLE" width="90" x="179" y="289">
            <parameter key="layer_type" value="Dense"/>
            <parameter key="no_units" value="8"/>
            <parameter key="activation_function" value="'relu'"/>
            <parameter key="use_bias" value="true"/>
            <parameter key="kernel_initializer" value="glorot_uniform(seed=None)"/>
            <parameter key="bias_initializer" value="Zeros()"/>
            <parameter key="kernel_regularizer" value="None"/>
            <parameter key="bias_regularizer" value="None"/>
            <parameter key="activity_regularizer" value="None"/>
            <parameter key="kernel_constraint" value="None"/>
            <parameter key="bias_constraint" value="None"/>
            <parameter key="rate" value="0.1"/>
            <parameter key="noise_shape" value="None"/>
            <parameter key="seed" value="None"/>
            <parameter key="target_shape" value="(1, 1)"/>
            <parameter key="dims" value="1.1"/>
            <parameter key="repetition_factor" value="2"/>
            <parameter key="function" value="None"/>
            <parameter key="l1" value="0.0"/>
            <parameter key="l2" value="0.0"/>
            <parameter key="mask_value" value="0.0"/>
          </operator>
          <operator activated="true" class="keras:core_layer" compatibility="1.0.003" expanded="true" height="82" name="Add Core Layer (2)" origin="GENERATED_SAMPLE" width="90" x="313" y="289">
            <parameter key="layer_type" value="Dense"/>
            <parameter key="no_units" value="2"/>
            <parameter key="activation_function" value="'softmax'"/>
            <parameter key="use_bias" value="true"/>
            <parameter key="kernel_initializer" value="glorot_uniform(seed=None)"/>
            <parameter key="bias_initializer" value="Zeros()"/>
            <parameter key="kernel_regularizer" value="None"/>
            <parameter key="bias_regularizer" value="None"/>
            <parameter key="activity_regularizer" value="None"/>
            <parameter key="kernel_constraint" value="None"/>
            <parameter key="bias_constraint" value="None"/>
            <parameter key="rate" value="0.1"/>
            <parameter key="noise_shape" value="None"/>
            <parameter key="seed" value="None"/>
            <parameter key="target_shape" value="(1, 1)"/>
            <parameter key="dims" value="1.1"/>
            <parameter key="repetition_factor" value="2"/>
            <parameter key="function" value="None"/>
            <parameter key="l1" value="0.0"/>
            <parameter key="l2" value="0.0"/>
            <parameter key="mask_value" value="0.0"/>
          </operator>
          <connect from_op="Add Core Layer" from_port="layers 1" to_op="Add Core Layer (2)" to_port="layers"/>
          <connect from_op="Add Core Layer (2)" from_port="layers 1" to_port="layers 1"/>
          <portSpacing port="sink_layers 1" spacing="0"/>
          <portSpacing port="sink_layers 2" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="keras:apply" compatibility="1.0.003" expanded="true" height="82" name="Apply Keras Model" origin="GENERATED_SAMPLE" width="90" x="648" y="289">
        <parameter key="batch_size" value="16"/>
        <parameter key="verbose" value="0"/>
      </operator>
      <connect from_op="Retrieve Iris" from_port="output" to_op="Filter Examples" to_port="example set input"/>
      <connect from_op="Filter Examples" from_port="example set output" to_op="Split Data" to_port="example set"/>
      <connect from_op="Split Data" from_port="partition 1" to_op="Keras Model" to_port="training set"/>
      <connect from_op="Split Data" from_port="partition 2" to_op="Apply Keras Model" to_port="unlabelled data"/>
      <connect from_op="Keras Model" from_port="model" to_op="Apply Keras Model" to_port="model"/>
      <connect from_op="Apply Keras Model" from_port="labelled data" 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>



Best Answer

  • varunm1varunm1 Moderator, Member Posts: 1,207 Unicorn
    edited July 2019 Solution Accepted
    Hello @mansour

    Keras in RM is kind of outdated extension and there are some issues that were not resolved. As the focus is now on the deep learning extension (DL4J) based, we recommend using the deep learning extension.

    I used to get the same error but there is no answer for this issue. 

    Did you install all the dependencies exactly as mentioned in the below thread by @jpuente ? The requirements are highly specific and the exact versions should be installed.

    https://community.rapidminer.com/discussion/comment/54662#Comment_54662

    Thanks
    Regards,
    Varun
    https://www.varunmandalapu.com/

    Be Safe. Follow precautions and Maintain Social Distancing

    [Deleted User]mansour
Sign In or Register to comment.