2014-07-11 20 views
0

我試圖在RapidMiner中使用SVM對數據庫中包含的推文進行分類(TASS 2014語料庫),但是,無論使用什麼樣的性能模塊,應用模型結束時總是以一種方式評估所有推文(即所有正面,全部負面,全部中性或全部無)。不知道我是否配置錯誤。RapidMiner中的Twitter數據庫TextMining以唯一的方式評估所有評論

After Multipliy operator,角色輸出(第一角色,第二名稱,第三類型):

  • 文本,文本,文本
  • 標籤,值,標稱
  • ID,tweetid,標稱

After September Operator Role (2),角色輸出是(角色第一,第二名,第三種):

  • 標籤,文本,文本
  • ID,tweetid,標稱

然後,我添加RapidMiner的XML代碼:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<process version="5.3.015"> 
    <context> 
    <input/> 
    <output/> 
    <macros/> 
    </context> 
    <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process"> 
    <process expanded="true"> 
     <operator activated="false" class="read_database" compatibility="5.3.015" expanded="true" height="60" name="Read Database" width="90" x="45" y="30"> 
     <parameter key="connection" value="sqlserver2014"/> 
     <parameter key="query" value="SELECT TOP 4246 &quot;content&quot;, &quot;tweetid&quot;, &quot;value&quot;&#10;FROM &quot;dbo&quot;.&quot;TweetsTrainClean&quot;&#10;WHERE 'POS'=SUBSTRING(value,1,3)&#10;UNION ALL&#10;SELECT TOP 4246 &quot;content&quot;, &quot;tweetid&quot;, &quot;value&quot;&#10;FROM &quot;dbo&quot;.&quot;TweetsTrainClean&quot;&#10;WHERE 'NEU'=SUBSTRING(value,1,3)&#10;UNION ALL&#10;SELECT TOP 4246 &quot;content&quot;, &quot;tweetid&quot;, &quot;value&quot;&#10;FROM &quot;dbo&quot;.&quot;TweetsTrainClean&quot;&#10;WHERE 'NEG'=SUBSTRING(value,1,3)"/> 
     <enumeration key="parameters"/> 
     </operator> 
     <operator activated="true" class="read_database" compatibility="5.3.015" expanded="true" height="60" name="Read Database (5)" width="90" x="45" y="300"> 
     <parameter key="connection" value="sqlserver2014"/> 
     <parameter key="query" value="SELECT top 1000 *&#10;FROM &quot;dbo&quot;.&quot;TweetsGeneralClean&quot;"/> 
     <enumeration key="parameters"/> 
     </operator> 
     <operator activated="false" class="read_database" compatibility="5.3.015" expanded="true" height="60" name="Read Database (2)" width="90" x="45" y="210"> 
     <parameter key="connection" value="sqlserver2014"/> 
     <parameter key="query" value="SELECT *&#10;FROM (&#10;  SELECT *, ROW_NUMBER() OVER (ORDER BY tweetid) AS RowNum&#10;  FROM &quot;dbo&quot;.&quot;TweetsGeneralClean&quot;&#10; ) AS tabla&#10;WHERE tabla.RowNum BETWEEN 30000 AND 64798"/> 
     <enumeration key="parameters"/> 
     </operator> 
     <operator activated="true" class="select_attributes" compatibility="5.3.015" expanded="true" height="76" name="Select Attributes (2)" width="90" x="179" y="255"> 
     <parameter key="attribute_filter_type" value="subset"/> 
     <parameter key="attributes" value="|tweetid|content"/> 
     </operator> 
     <operator activated="true" class="text:process_document_from_data" compatibility="5.3.002" expanded="true" height="76" name="Process Documents from Data (2)" width="90" x="313" y="255"> 
     <parameter key="keep_text" value="true"/> 
     <list key="specify_weights"/> 
     <process expanded="true"> 
      <connect 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="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role (2)" width="90" x="447" y="255"> 
     <parameter key="attribute_name" value="text"/> 
     <parameter key="target_role" value="label"/> 
     <list key="set_additional_roles"> 
      <parameter key="tweetid" value="id"/> 
     </list> 
     </operator> 
     <operator activated="true" class="read_database" compatibility="5.3.015" expanded="true" height="60" name="Read Database (3)" width="90" x="45" y="75"> 
     <parameter key="connection" value="sqlserver2014"/> 
     <parameter key="query" value="select &quot;content&quot;,&quot;tweetid&quot;,&quot;value&quot; from &quot;dbo&quot;.&quot;TweetsTrainClean&quot;&#10;where 'POS'=SUBSTRING(&quot;value&quot;,1,3) or 'NEG'=SUBSTRING(&quot;value&quot;,1,3)&#10;&#9;or 'NEU'=SUBSTRING(&quot;value&quot;,1,3) or 'NON'=SUBSTRING(&quot;value&quot;,1,3)&#10;order by rand()"/> 
     <enumeration key="parameters"/> 
     </operator> 
     <operator activated="true" class="text_to_nominal" compatibility="5.3.015" expanded="true" height="76" name="Text to Nominal" width="90" x="112" y="120"> 
     <parameter key="attribute_filter_type" value="single"/> 
     <parameter key="attribute" value="value"/> 
     <parameter key="attributes" value="|type|value"/> 
     </operator> 
     <operator activated="true" class="set_role" compatibility="5.3.015" expanded="true" height="76" name="Set Role" width="90" x="179" y="30"> 
     <parameter key="attribute_name" value="tweetid"/> 
     <parameter key="target_role" value="id"/> 
     <list key="set_additional_roles"> 
      <parameter key="value" value="label"/> 
     </list> 
     </operator> 
     <operator activated="true" class="nominal_to_text" compatibility="5.3.015" expanded="true" height="76" name="Nominal to Text" width="90" x="246" y="120"> 
     <parameter key="attribute_filter_type" value="single"/> 
     <parameter key="attribute" value="content"/> 
     </operator> 
     <operator activated="true" class="text:process_document_from_data" compatibility="5.3.002" expanded="true" height="76" name="Process Documents from Data" width="90" x="313" y="30"> 
     <parameter key="keep_text" value="true"/> 
     <list key="specify_weights"/> 
     <process expanded="true"> 
      <connect 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="multiply" compatibility="5.3.015" expanded="true" height="94" name="Multiply" width="90" x="380" y="120"/> 
     <operator activated="true" class="x_validation" compatibility="5.3.015" expanded="true" height="112" name="Validation" width="90" x="514" y="30"> 
     <parameter key="number_of_validations" value="5"/> 
     <parameter key="sampling_type" value="linear sampling"/> 
     <process expanded="true"> 
      <operator activated="true" class="select_attributes" compatibility="5.3.015" expanded="true" height="76" name="Select Attributes" width="90" x="45" y="30"> 
      <parameter key="attribute_filter_type" value="no_missing_values"/> 
      <parameter key="attribute" value="content"/> 
      <parameter key="attributes" value="tweetid|type||content"/> 
      </operator> 
      <operator activated="true" class="nominal_to_binominal" compatibility="5.3.015" expanded="true" height="94" name="Nominal to Binominal" width="90" x="45" y="120"> 
      <parameter key="attribute_filter_type" value="single"/> 
      <parameter key="attribute" value="value"/> 
      </operator> 
      <operator activated="true" class="polynomial_by_binomial_classification" compatibility="5.3.015" expanded="true" height="76" name="Polynominal by Binominal Classification" width="90" x="45" y="255"> 
      <process expanded="true"> 
       <operator activated="true" class="support_vector_machine_linear" compatibility="5.3.015" expanded="true" height="76" name="SVM (Linear)" width="90" x="45" y="255"/> 
       <connect from_port="training set" to_op="SVM (Linear)" to_port="training set"/> 
       <connect from_op="SVM (Linear)" from_port="model" to_port="model"/> 
       <portSpacing port="source_training set" spacing="0"/> 
       <portSpacing port="sink_model" spacing="0"/> 
      </process> 
      </operator> 
      <connect from_port="training" to_op="Select Attributes" to_port="example set input"/> 
      <connect from_op="Select Attributes" from_port="example set output" to_op="Nominal to Binominal" to_port="example set input"/> 
      <connect from_op="Nominal to Binominal" from_port="example set output" to_op="Polynominal by Binominal Classification" to_port="training set"/> 
      <connect from_op="Polynominal by Binominal Classification" from_port="model" to_port="model"/> 
      <portSpacing port="source_training" spacing="0"/> 
      <portSpacing port="sink_model" spacing="0"/> 
      <portSpacing port="sink_through 1" spacing="0"/> 
     </process> 
     <process expanded="true"> 
      <operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30"> 
      <list key="application_parameters"/> 
      </operator> 
      <operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance" width="90" x="179" y="30"/> 
      <connect from_port="model" to_op="Apply Model" to_port="model"/> 
      <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/> 
      <connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/> 
      <connect from_op="Performance" from_port="performance" to_port="averagable 1"/> 
      <portSpacing port="source_model" spacing="0"/> 
      <portSpacing port="source_test set" spacing="0"/> 
      <portSpacing port="source_through 1" spacing="0"/> 
      <portSpacing port="sink_averagable 1" spacing="0"/> 
      <portSpacing port="sink_averagable 2" spacing="0"/> 
     </process> 
     </operator> 
     <operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (2)" width="90" x="648" y="210"> 
     <list key="application_parameters"/> 
     </operator> 
     <connect from_op="Read Database (5)" from_port="output" to_op="Select Attributes (2)" to_port="example set input"/> 
     <connect from_op="Select Attributes (2)" from_port="example set output" to_op="Process Documents from Data (2)" to_port="example set"/> 
     <connect from_op="Process Documents from Data (2)" from_port="example set" to_op="Set Role (2)" to_port="example set input"/> 
     <connect from_op="Set Role (2)" from_port="example set output" to_op="Apply Model (2)" to_port="unlabelled data"/> 
     <connect from_op="Read Database (3)" from_port="output" to_op="Text to Nominal" to_port="example set input"/> 
     <connect from_op="Text to Nominal" from_port="example set output" to_op="Set Role" to_port="example set input"/> 
     <connect from_op="Set Role" from_port="example set 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="Multiply" to_port="input"/> 
     <connect from_op="Multiply" from_port="output 1" to_op="Validation" to_port="training"/> 
     <connect from_op="Multiply" from_port="output 2" to_port="result 1"/> 
     <connect from_op="Validation" from_port="model" to_op="Apply Model (2)" to_port="model"/> 
     <connect from_op="Validation" from_port="averagable 1" to_port="result 3"/> 
     <connect from_op="Apply Model (2)" from_port="labelled data" to_port="result 2"/> 
     <portSpacing port="source_input 1" spacing="0"/> 
     <portSpacing port="sink_result 1" spacing="0"/> 
     <portSpacing port="sink_result 2" spacing="0"/> 
     <portSpacing port="sink_result 3" spacing="0"/> 
     <portSpacing port="sink_result 4" spacing="0"/> 
    </process> 
    </operator> 
</process> 

回答

0

我沒有對數據的訪問,所以我不能確定,但​​我認爲其中一個屬性包含完整的鳴叫文本爲幾個字。

有了這個假設,Process Documents運營商需要包含運營商將文本分割爲令牌。爲此,請使用Tokenize操作員,並將其簡單地放置在每個Process Documents操作員中。

另外,訓練操作Process Documents生成的單詞列表輸出應連接到構建測試集的Process Documents操作員。這很重要,因爲它消除了測試集中出現的任何額外屬性,這些屬性與訓練期間未看到的單詞相對應,因此可確保正確應用模型。

相關問題