How can I do a time series graph with several attributes in the y axis for several domain dimension?

santosjsantosj Member Posts: 5 Contributor II
edited December 2018 in Help

 

Hi,

I am using Rapid Miner for my master thesis project and I am right now doing the data exploration of my data. I want to do a specific time series graph but I do not know how to do it in Rapid Miner. I have been searching on the internet for several days on this matter but I cannot find anything..I hope you can help me! I would be very thankful.

 

The graph that I want to do is a time series graph that has as follows: In the x axis a number of days as an index and in the y axis, several attributes. So far so good. My problem is that I do not know how to plot each attribute that I have in the y axis at a time span in days that I have saved in several attributes. The aim of the series graph that I want to do is to view the evolution of a set of parameters through time were I have the values of all these parameters as well as when they were measured in days. Thank you very much!

Best Answer

  • lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
    Solution Accepted

    Hi again @santosj,

     

    Interesting problem !

    If I good understand, one way to perform what you want to do is to use the De-Pivot operator.

    By using this operator, you obtain the Blood Pressure according to the time like this : 

    Time_series_plot_2.png

    and then you can plot these data like this : 

    Time_series_plot_3.png

     

     

    You can find the process here : 

    <?xml version="1.0" encoding="UTF-8"?><process version="8.1.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.1.001" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="read_excel" compatibility="8.1.001" expanded="true" height="68" name="Read Excel" width="90" x="112" y="34">
    <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Time_series_Plot\Time_series_Plot_Blood_pressure.xlsx"/>
    <parameter key="imported_cell_range" value="A1:I3"/>
    <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="Patient ID.true.integer.attribute"/>
    <parameter key="1" value="Blood Pressure before treatment.true.integer.attribute"/>
    <parameter key="2" value="Blood Pressure 2 months.true.integer.attribute"/>
    <parameter key="3" value="Blood Pressure 3 months.true.integer.attribute"/>
    <parameter key="4" value="Blood Pressure 6 months.true.integer.attribute"/>
    <parameter key="5" value="Treatment date.true.date_time.attribute"/>
    <parameter key="6" value="date 2 months.true.date_time.attribute"/>
    <parameter key="7" value="date 3 months.true.date_time.attribute"/>
    <parameter key="8" value="date 6 months.true.date_time.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="8.1.001" expanded="true" height="82" name="Generate Attributes" width="90" x="246" y="34">
    <list key="function_descriptions">
    <parameter key="2" value="2"/>
    <parameter key="3" value="3"/>
    <parameter key="6" value="6"/>
    <parameter key="0" value="0"/>
    </list>
    </operator>
    <operator activated="true" class="select_attributes" compatibility="8.1.001" expanded="true" height="82" name="Select Attributes" width="90" x="380" y="34">
    <parameter key="attribute_filter_type" value="subset"/>
    <parameter key="attributes" value="Blood Pressure 2 months|Blood Pressure 3 months|Blood Pressure 6 months|Blood Pressure before treatment|6|3|2|0"/>
    </operator>
    <operator activated="true" class="de_pivot" compatibility="8.1.001" expanded="true" height="82" name="De-Pivot" width="90" x="514" y="34">
    <list key="attribute_name">
    <parameter key="Blood Pressure" value="Blood Pressure 2 months|Blood Pressure 3 months|Blood Pressure 6 months|Blood Pressure before treatment"/>
    </list>
    <parameter key="index_attribute" value="Time"/>
    <parameter key="create_nominal_index" value="true"/>
    </operator>
    <connect from_op="Read Excel" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
    <connect from_op="Select Attributes" from_port="example set output" to_op="De-Pivot" to_port="example set input"/>
    <connect from_op="De-Pivot" 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>

    and the Excel example set (from your partial dataset) here : 

    https://drive.google.com/open?id=1ZKmTSpj_jHV1rtaxBBCgpgwCIF-zl4zP

     

    I hope it helps,

     

    Regards,

     

     

    Lionel 

     

Answers

  • lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

    Hi @santosj,

     

    Can you share your dataset, please ?

     

    Regards,

     

    Lionel

  • lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

    Hi again @santosj,

     

    1.Go to the Results windows (after running your process)

    2. Go to the Charts Panel 

    3. Select Series as Chart Style (if RapidMiner has not set automatically)

    4. Set your Index Dimension (your time attibute) and Plot Series (the attribute you want to display in your chart). (Ctrtl + select the attribute you want to display).

    Here the screenshot to help you : 

    Time_series_plot.png

     

    Hope it helps,

     

    Regards,

     

    Lionel

     

  • santosjsantosj Member Posts: 5 Contributor II

    Thank you for your reply!

     

    I, unfortunately, cannot share the data that I have but I send you a similar dataset to better convey my question.

     

    In the attached Excel file you can see patients that have carried out a treatment to lower their blood pressure. What I would like to do is to plot these blood pressures in a time series graph for each time span on days (Date of the 2 months measurement - Treatment Date), (Date of the 3 months measurement - Treatment Date) and (Date of the 6 months measurement - Treatment Date) to see graphically if the patients improved after the treatment they have carried out to lower their blood pressure. I have already calculated these time spans in the Rapid Miner Platform with the attribute generator operator. I could also use as a domain graph the indication of "2 months", "3 months" and "6 months", that I do not know how to do it also, but I taught to use the time span because I would like to afterward add to the graph the standard deviations of the time span. 

    Thank you 

     

  • santosjsantosj Member Posts: 5 Contributor II

    Thank you for your help,

     

    Unfortunately, my difficulty lays on the index because I need to represent the several time spans in days that I have mentioned before...Do you have any clue on how I could do it?

     

    Thank you for your time, 

     

     

  • santosjsantosj Member Posts: 5 Contributor II

    Wow! I am impressed!

    It is exactly that. You solved my problem! I´ve already tested it and it works!

    I am very grateful...Thank you very much!

    Jud

  • lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

    You're welcome Jud.

     

    Good luck for your master thesis project.

     

    Regards,

     

    Lionel

     

Sign In or Register to comment.