"Time series differentiation example"

haddockhaddock Member Posts: 849 Maven
edited May 2019 in Help
I've been playing around with 4.4 and have come across a real gem for time-series miners, here is an example of it at work...
<operator name="Root" class="Process" expanded="yes">
    <operator name="SingleMacroDefinition" class="SingleMacroDefinition">
        <parameter key="macro" value="Symbol"/>
        <parameter key="value" value="&#39;USDJPY&#39;"/>
    <operator name="DatabaseExampleSource" class="DatabaseExampleSource">
        <parameter key="database_system" value="Microsoft SQL Server (Microsoft)"/>
        <parameter key="database_url" value="jdbc:sqlserver://localhost:1433;databaseName=Tradestation"/>
        <parameter key="username" value="sa"/>
        <parameter key="password" value="wL8/6ZO7YrXKa8XgQd4v7g=="/>
        <parameter key="query" value="SELECT [DateTime], FROM [Updates] WHERE Symbol=%{Symbol} and Year(DateTime)&gt;2007&#10;order by [DateTime]"/>
        <parameter key="id_attribute" value="DateTime"/>
    <operator name="CSVExampleSetWriter" class="CSVExampleSetWriter">
        <parameter key="csv_file" value="Close.txt"/>
    <operator name="CSVExampleSource" class="CSVExampleSource">
        <parameter key="filename" value="Close.txt"/>
    <operator name="IteratingOperatorChain" class="IteratingOperatorChain" expanded="yes">
        <parameter key="iterations" value="50"/>
        <operator name="DifferentiateSeries" class="DifferentiateSeries">
            <parameter key="attribute_name" value="C"/>
            <parameter key="change_mode" value="percentage"/>
            <parameter key="lag" value="%{a}"/>
        <operator name="ChangeAttributeNamesReplace" class="ChangeAttributeNamesReplace">
            <parameter key="attributes" value="change.*"/>
            <parameter key="replace_what" value="\(|\)"/>
            <parameter key="replace_by" value="_"/>
            <parameter key="apply_on_special" value="false"/>
        <operator name="AttributeConstruction" class="AttributeConstruction">
            <list key="function_descriptions">
              <parameter key="%{Symbol}_%{a}" value="change_C_"/>
            <parameter key="use_standard_constants" value="false"/>
        <operator name="FeatureNameFilter" class="FeatureNameFilter">
            <parameter key="skip_features_with_name" value="change.*"/>
You'll need to put the attached 'Close.txt' file in the same directory as the XML process to get it to go. Database gnomes also take note of the SQL query in the disabled database operator. Yes, you can stuff macros into queries  8)

I do rather too much series grinding, and used to do most pre-prep on the server, this by comparison is lightning quick, so I'm one happy bunny this afternoon. Merci beaucoup RM.

[attachment deleted by admin]


  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Thanks! Nice to hear that somebody else also like it  ;D

Sign In or Register to comment.