Preparing a Customized Algorithm .py File

The user-defined Python file for comparison algorithm-based can only be used for accuracy comparison. The security of the file and input parameters is ensured by users.

To customize an algorithm, you need to write the customized algorithm script in a .py file and make preparations as follows:

  • The .py file name must comply with alg_{algorithm_name}.py.
  • The content of the .py file is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    def compare(my_output_dump_data, ground_true_dump_data, args):   # Fixed header format of the algorithm
    # The following is an example algorithm:
        """
        Function Description:
            compare the my output dump data and the ground true dump data by algorithm
        Parameter:
            my_output_dump_data: the my output dump data
            ground_true_dump_data: the ground true dump data
            args: the algorithm arguments
        Return Value:
            the compare algorithm value, string; error_msg, string
        """
    
    Table 1 Parameters

    Parameter

    Description

    my_output_dump_data

    My output dump data, one-dimensional array.

    ground_true_dump_data

    Ground true dump data, one-dimensional array.

    args

    Algorithm parameter, which is parsed by users.

    Return Value

    Return value, including:

    • Algorithm comparison result, in string format.
    • Error message, in string format.
  • Create the algorithm directory in the current user directory to store the .py file. Ensure that the user has the read and write permissions on the directory and file.