Double to String cast error

Contributor II

Double to String cast error

Hi all,

using the image mining extension as described in my other topics, I'm building a image clustering process but encountered an exception that is as follows:

Exception: java.lang.ClassCastException
Message: java.lang.Double cannot be cast to java.lang.String
Stack trace:

  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  java.lang.Thread.run(Unknown Source)

Does anyone know how to fix this?

Here's the process xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.013">
  <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
    <parameter key="parallelize_main_process" value="true"/>
    <process expanded="true">
      <operator activated="true" class="imageprocessing:multiple_color_image_opener" compatibility="1.4.001" expanded="true" height="60" name="MCIO" width="90" x="45" y="30">
        <list key="images">
          <parameter key="all" value="C:\Users\nick\Pictures\fruitveggiecollection\JPG\All"/>
        <parameter key="assign_label" value="true"/>
        <process expanded="true">
          <operator activated="true" class="imageprocessing:global_feature_extraction" compatibility="1.4.001" expanded="true" height="60" name="Global Feature Extractor from a Single Image" width="90" x="179" y="30">
            <process expanded="true">
              <operator activated="true" class="imageprocessing:statistics" compatibility="1.4.001" expanded="true" height="60" name="Global statistics" width="90" x="179" y="30"/>
              <operator activated="true" class="imageprocessing:histogram" compatibility="1.4.001" expanded="true" height="60" name="histogram" width="90" x="179" y="120"/>
              <operator activated="true" class="imageprocessing:color_to_grayscale" compatibility="1.4.001" expanded="true" height="60" name="Color to grayscale" width="90" x="179" y="210"/>
              <operator activated="true" class="imageprocessing:obcf" compatibility="1.4.001" expanded="true" height="60" name="OBCF" width="90" x="447" y="210"/>
              <connect from_port="color image plus 1" to_op="Global statistics" to_port="color image plus"/>
              <connect from_port="color image plus 2" to_op="histogram" to_port="color image plus"/>
              <connect from_port="color image plus 3" to_op="Color to grayscale" to_port="color image plus"/>
              <connect from_op="Global statistics" from_port="features" to_port="feature 1"/>
              <connect from_op="histogram" from_port="features" to_port="feature 2"/>
              <connect from_op="Color to grayscale" from_port="grayscale image" to_op="OBCF" to_port="grayscale image plus"/>
              <connect from_op="OBCF" from_port="features" to_port="feature 3"/>
              <portSpacing port="source_color image plus 1" spacing="0"/>
              <portSpacing port="source_color image plus 2" spacing="0"/>
              <portSpacing port="source_color image plus 3" spacing="0"/>
              <portSpacing port="source_color image plus 4" spacing="0"/>
              <portSpacing port="sink_feature 1" spacing="0"/>
              <portSpacing port="sink_feature 2" spacing="0"/>
              <portSpacing port="sink_feature 3" spacing="0"/>
              <portSpacing port="sink_feature 4" spacing="0"/>
          <connect from_port="color image plus" to_op="Global Feature Extractor from a Single Image" to_port="color image plus"/>
          <connect from_op="Global Feature Extractor from a Single Image" from_port="example set" to_port="Example set"/>
          <portSpacing port="source_color image plus" spacing="0"/>
          <portSpacing port="sink_Example set" spacing="0"/>
      <operator activated="true" class="support_vector_clustering" compatibility="5.3.013" expanded="true" height="76" name="Clustering (2)" width="90" x="313" y="30"/>
      <operator activated="true" class="imageprocessing:create_clusters" compatibility="1.4.001" expanded="true" height="60" name="create_clusters" width="90" x="581" y="30">
        <parameter key="result_folder" value="C:\Users\nick\Pictures\clusterresults"/>
      <connect from_op="MCIO" from_port="example set" to_op="Clustering (2)" to_port="example set"/>
      <connect from_op="Clustering (2)" from_port="cluster model" to_op="create_clusters" to_port="clusters"/>
      <connect from_op="create_clusters" from_port="clusters" 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"/>
Regular Contributor

Re: Double to String cast error

In case it helps I have just encountered the same problem with sentiment analysis.  I found a solution without fully understanding the problem...

I had two attributes: Polarity (0 or 1) and Text.  A straightforward-looking process to classify sentiment based on bag-of-words.  But I received the same 'Double to String cast' error as you. By a process of elimination I traced the problem to the Process Documents operator and found that the problem is related to the initial data for Polarity (which oddly, is not handled by Process Documents) being an integer.  When I changed it to Polynominal the problem went away.  At least this is consistent with the error message but I have no idea why this problem shoudl occur.