"Read Weight -

drdespair
drdespair New Altair Community Member
edited November 5 in Community Q&A
I cant seem to figure out how to apply weights from a Write Weight file to a data set. It say use AttibuteWeight but I cant find that type of operation that can take in a weight file. Please help. Thank you!
Tagged:

Answers

  • earmijo
    earmijo New Altair Community Member
    Hi dr:
    I had exactly the same problem a few days ago. The equivalent to AttributeWeightApplier in RM 5.0 is "Select by Attributes" which you can find under

    DataTransformation/Attribute Set Reduction..../Selection/

    This operator takes as inputs an example set and a set of weights. See a quick example below.

    Hope this helps,

    \Ernesto
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.000">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.1.000" expanded="true" name="Process">
       <process expanded="true" height="190" width="413">
         <operator activated="true" class="read_csv" compatibility="5.1.000" expanded="true" height="60" name="Read CSV" width="90" x="45" y="30">
           <parameter key="csv_file" value="E:\cerveza.csv"/>
           <parameter key="column_separators" value=","/>
           <parameter key="first_row_as_names" value="false"/>
           <list key="annotations">
             <parameter key="0" value="Name"/>
           </list>
           <list key="data_set_meta_data_information">
             <parameter key="0" value="id.true.integer.id"/>
             <parameter key="1" value="cerveza.true.integer.label"/>
             <parameter key="2" value="mujer.true.integer.attribute"/>
             <parameter key="3" value="educ1.true.integer.attribute"/>
             <parameter key="4" value="educ2.true.integer.attribute"/>
             <parameter key="5" value="educ3.true.integer.attribute"/>
             <parameter key="6" value="ingreso.true.integer.attribute"/>
             <parameter key="7" value="edad.true.integer.attribute"/>
           </list>
         </operator>
         <operator activated="true" class="read_weights" compatibility="5.1.000" expanded="true" height="60" name="Read Weights" width="90" x="112" y="120">
           <parameter key="attribute_weights_file" value="E:\linreg.wgt"/>
         </operator>
         <operator activated="true" class="select_by_weights" compatibility="5.1.000" expanded="true" height="94" name="Select by Weights" width="90" x="313" y="75"/>
         <connect from_op="Read CSV" from_port="output" to_op="Select by Weights" to_port="example set input"/>
         <connect from_op="Read Weights" from_port="output" to_op="Select by Weights" to_port="weights"/>
         <connect from_op="Select by Weights" from_port="example set output" 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>
  • drdespair
    drdespair New Altair Community Member
    Hi, Thank for answering, but this process does not actualy take any values from the weight file, it only allows you to filter your selection by the weights. I need for the weights to be applied back to the attributes so they can be properly used inside a modeling process. When the weights are applied you can see the weighting in the meta data, after running through the Select by Weight I get my selection but the weights are not kept. :(

    D.
  • earmijo
    earmijo New Altair Community Member
    The only option I can think of is "Scale by Weights" which takes a set of weights and an example set and returns an example set with the variables multiplied by their weights (variables with zero weight are dropped from the example set). Is that what you are looking for?