"how do I input data from text document into rapidminer."

sunnyfunghysunnyfunghy Member Posts: 19 Contributor II
edited May 2019 in Help
Hi Everyone,
          I am a beginner of rapidminer. I would like to ask how to input following data from text file.

What I am doing first. When input them directly, it then change to data automatically.
Or I put it in excel file first, but need to spend lots of time to remove "colon (:)".

Just want to know any experts how to input following data into rapidminer. I copied the data from the website,

http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html#a1a

-1 1:-766 2:128 3:0.140625 4:0.304688 5:0.234375 6:0.140625 7:0.304688 8:0.234375
-1 1:-726 2:131 3:0.129771 4:0.328244 5:0.229008 6:0.129771 7:0.328244 8:0.229008
-1 1:-648 2:123 3:0.146341 4:0.333333 5:0.211382 6:0.146341 7:0.333333 8:0.211382
-1 1:-764 2:124 3:0.137097 4:0.322581 5:0.233871 6:0.137097 7:0.322581 8:0.233871
-1 1:-584 2:130 3:0.153846 4:0.392308 5:0.184615 6:0.153846 7:0.392308 8:0.184615
-1 1:-866 2:124 3:0.193548 4:0.169355 5:0.314516 6:0.193548 7:0.169355 8:0.314516
-1 1:-662 2:120 3:0.25 4:0.216667 5:0.275 6:0.25 7:0.216667 8:0.275
-1 1:-518 2:120 3:0.283333 4:0.233333 5:0.258333 6:0.283333 7:0.233333 8:0.258333
-1 1:-574 2:120 3:0.241667 4:0.225 5:0.275 6:0.241667 7:0.225 8:0.275
-1 1:-962 2:133 3:0.180451 4:0.142857 5:0.338346 6:0.180451 7:0.142857 8:0.338346
-1 1:-568 2:120 3:0.275 4:0.241667 5:0.25 6:0.275 7:0.241667 8:0.25
-1 1:-778 2:116 3:0.206897 4:0.172414 5:0.301724 6:0.206897 7:0.172414 8:0.301724
-1 1:-876 2:123 3:0.203252 4:0.162602 5:0.300813 6:0.203252 7:0.162602 8:0.300813
-1 1:-880 2:123 3:0.195122 4:0.154472 5:0.300813 6:0.195122 7:0.154472 8:0.300813
-1 1:-976 2:123 3:0.195122 4:0.138211 5:0.308943 6:0.195122 7:0.138211 8:0.308943
-1 1:-768 2:117 3:0.188034 4:0.153846 5:0.316239 6:0.188034 7:0.153846 8:0.316239
-1 1:-536 2:110 3:0.190909 4:0.281818 5:0.245455 6:0.190909 7:0.281818 8:0.245455
-1 1:-514 2:120 3:0.225

Thanks  a lot
Sunny

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    I assume that this is sparse data with the label as first column? Then see the Read Sparse operator and its help text.

    Greetings,
      Sebastian
  • sunnyfunghysunnyfunghy Member Posts: 19 Contributor II
    Thanks.
    However, I am a beginner. Can you explain clearly? I have used the read sparse operator from the data and insert the text file directly. But cannot read.

    http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/a1a

    You can see the text file and I discover that many rsearches use this format. So how to do it if not from excel file which has many colons to separate data and the format is not constant. Thanks  a lot.

    Sunny
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Sunny,

    actually reading the help helps sometimes. Isn't too hard to understand. Here is the process containing one single operator that loads the data.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.005">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.005" expanded="true" name="Process">
        <process expanded="true" height="554" width="803">
          <operator activated="true" class="read_sparse" compatibility="5.1.005" expanded="true" height="60" name="Read Sparse" width="90" x="179" y="75">
            <parameter key="format" value="yx"/>
            <parameter key="data_file" value="C:\Users\sland\Desktop\a1a.txt"/>
            <parameter key="dimension" value="150"/>
            <list key="prefix_map"/>
          </operator>
          <connect from_op="Read Sparse" from_port="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>
    Please take into account that I had no clue of the maximal number of dimensions so I guessed 150...

    Greetings,
      Sebastian
Sign In or Register to comment.