The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"Parameter macro process_path"

fjcuberosfjcuberos Member Posts: 18 Maven
edited May 2019 in Help
I can´t get the path of a process with the %{process_path}.

If I modify the 01_DecisionTree.xml with a reference in the log file I get an error
Cannot create log file: java.io.FileNotFoundException: C:\rmws\Sample\02_Learner\01_DecisionTree.xml\kk.log
The name and extension of the experiment is included. The same is obtained using process_name macro.

Can be used the macros in the root node?
Is there  any other macro for the path?

Thanks in advance.

F.J. Cuberos

<operator name="Root" class="Process" expanded="yes">
    <description text="#ylt#table#ygt##ylt#tr#ygt##ylt#td#ygt##ylt#p#ygt#This experiment starts with loading the data.
...
RuleLearner.#ylt#/i#ygt##ylt#/td#ygt##ylt#/tr#ygt##ylt#/table#ygt##ylt#/li#ygt##ylt#/ul#ygt#"/>
    <parameter key="logfile" value="%{process_path}\kk.log"/>
    <parameter key="logverbosity" value="all"/>
    <operator name="Input" class="ExampleSource">
        <parameter key="attributes" value="../data/golf.aml"/>
    </operator>
    <operator name="DecisionTree" class="DecisionTree">
    </operator>
</operator>

Tagged:

Answers

  • steffensteffen Member Posts: 347 Maven
    Hello

    The macro is working correctly:
    %{process_path} = C:\rmws\Sample\02_Learner\01_DecisionTree.xml
    The problem is that there is no folder named "01_DecisionTree.xml"

    Here are a few hints regarding this problem:
    • If you save your process before you run it and path parameters are specified without folders (e.g. like "kk.log") the files will automatically be saved to the folder where your process.xml is located
    • If you want to save files to a subfolder of your process-folder, use something like "/testfolder/kk.log". Note that the mentioned subfolder has to be created MANUALLY
    hope this was helpful,

    Steffen
  • fjcuberosfjcuberos Member Posts: 18 Maven
    I´d already took the two shorcuts you comment.

    I don´t understand that the process_path return the path and the name of the process.
    If the name is obtained with process_name and process_file is logical to think process_path (and 4.0 tutorial states "%{process_path} becomes the path of the process file.") only return the path, because in that case the path+name can be obtained with %{process_path}\%{process_file}.

    Thanks again.

    F.J. Cuberos
  • steffensteffen Member Posts: 347 Maven
    Hello

    Yes, there is some kind of redundancy. But if %{process_path} would behave as you wish it were completely redundant, since RapidMiner resolves the path of the process-file automatically. I guess that the three different kinds of process-macros
    %{process name} becomes the name of the process file (without path and extension).
    %{process file} becomes the name of the process file (with extension).
    %{process path} becomes the path of the process file.
    are part of RapidMiner due to historical reasons...

    beside: I do not know any usecase for %{process path} for its current or your desired behaviour.

    greetings,

    Steffen
  • BartNBartN Member Posts: 18 Maven
    Under Windows7 the %{process_path} seems to behave differently. It returns the string \\LocalRepository\.... which is obviously not a valid path.

    Anyone found a solution how to get a valid path under W7?
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Bart,

    \\LocalRepository\... actually is a valid path; however not a file system path, but a repository path: it's the location of the process in the repository structure.

    Best,
    Marius
  • BartNBartN Member Posts: 18 Maven
    HI Marius,

    How can this \\LocalRepository\ repository path be converted to a valid system path in a WriteFile operator for example?

    The two options to use relative paths (you suggested on October 07, 2008, 09:27:49 AM) do not write the file in the location of the process file but in my home directory. (Is this typical W7?)

    Kind regards,
    Bart
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    I think that's not easily possible. But may I ask what you want to do? Maybe there is a better way of doing it than finding the process location.

    Anyway, it is a bad idea to write anything manually into the directory containing the process, because it is located in the repository folder, which has a special format which should be maintained exclusively by RapidMiner (similar to a database or something).

    Best,
    Marius
  • BartNBartN Member Posts: 18 Maven
    Hi Markus,

    I try to read a file settings to be used in macros in different projects. So i would like to put that file, say current.csv, in the folder within the local repository. The result is a file not found exception on \\LocalRepository\MyProjects\MySettings\current.csv

    The only alternative is to define the full path to this file, but that is not the purpose of the default macros, right?

    Kind regards,
    Bart

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
        <process expanded="true" height="721" width="1201">
          <operator activated="true" class="read_csv" compatibility="5.2.008" expanded="true" height="60" name="Read CSV" width="90" x="112" y="30">
            <parameter key="csv_file" value="%{process_path}/current.csv"/>
            <list key="annotations"/>
            <list key="data_set_meta_data_information"/>
          </operator>
          <connect from_op="Read CSV" 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>
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    why not import the csv file into the repository and use Extract Macro to read the macro values from the example set? The attached process provides an example on how to do that.

    Best, Marius
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
        <process expanded="true" height="562" width="718">
          <operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve macros" width="90" x="112" y="30">
            <parameter key="repository_entry" value="//LocalRepository/support/forum/macros"/>
          </operator>
          <operator activated="true" class="extract_macro" compatibility="5.3.000" expanded="true" height="60" name="Extract Macro" width="90" x="246" y="30">
            <parameter key="macro" value="macro1"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="macro_value"/>
            <parameter key="example_index" value="1"/>
            <list key="additional_macros"/>
          </operator>
          <operator activated="true" class="extract_macro" compatibility="5.3.000" expanded="true" height="60" name="Extract Macro (2)" width="90" x="380" y="30">
            <parameter key="macro" value="macro2"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="macro_value"/>
            <parameter key="example_index" value="2"/>
            <list key="additional_macros"/>
          </operator>
          <connect from_op="Retrieve macros" from_port="output" to_op="Extract Macro" to_port="example set"/>
          <connect from_op="Extract Macro" from_port="example set" to_op="Extract Macro (2)" to_port="example set"/>
          <connect from_op="Extract Macro (2)" from_port="example set" 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>
Sign In or Register to comment.