# tMatchModel

Generates the matching model that is used by the tMatchPredict component to automatically predict the labels for the suspect pairs and groups records which match the label(s) set in the component properties.

For further information about the tMatchPairing and tMatchPredict components, see [tMatchPairing](https://help.qlik.com/talend/en-US/data-matching/8.0/tmatchpairing) and [tMatchPredict](https://help.qlik.com/talend/en-US/data-matching/8.0/tmatchpredict) respectively.

tMatchModel reads the sample of the suspect pairs outputted by tMatchPairing after you label each second element in a pair, analyzes the data using the Random Forest algorithm and generates a matching model.

You can use the sample suspect records labeled in a Grouping campaign defined in Talend Data Stewardship with tMatchModel.

In local mode, Apache Spark 2.4.0 and later versions are supported.

This component is not shipped with your Talend Studio by default. You need to install it using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

## tMatchModel properties for Apache Spark Batch

These properties are used to configure tMatchModel running in the Spark Batch Job framework.

The Spark Batch tMatchModel component belongs to the Data Quality family.

The component in this framework is available in all Talend Platform products with Big Data and in Talend Data Fabric.

## Basic settings

| Properties | Description |
| --- | --- |
| Define a storage configuration component | Select the configuration component to be used to provide the configuration<br>information for the connection to the target file system such as HDFS.<br><br>If you leave this check box clear, the target file system is the local<br>system.<br><br>The configuration component to be used must be present in the same Job.<br>For example, if you have dropped a tHDFSConfiguration component in the Job, you can select it to write<br>the result in a given HDFS system. |
| Schema and Edit Schema | <ul> <li> <p>A schema is a row description. It defines the number of fields            (columns) to be processed and passed on to the next component. When you create a Spark            Job, avoid the reserved word <kbd>line</kbd> when naming the            fields.</p> <p>Click <span>Sync        columns</span> to retrieve the schema from the previous component connected in the      Job.</p> <p>Click <span>Edit        schema</span> to make changes to the schema. If the current schema is of the <span>Repository</span> type, three options are available:</p> <ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul> </li> <li> <p> <span>Built-In</span>: You create and store the schema locally for this component                only.</p> </li> <li> <p> <span>Repository</span>: You have already created the schema and stored it in the                Repository. You can reuse it in various projects and Job designs.</p> </li> </ul> |
| Matching key | Select the columns on which you want to base the match computation. |
| Matching label column | Select the column from the input flow which holds the label you set manually on the suspect pairs of records.<br><br>If you select the Integration with Data Stewardship check box, this list does not appear. In this case, the matching label column is the TDS\_ARBITRATION\_LEVEL column, which holds the label(s) you set on the suspect pairs of records set using Talend Data Stewardship. |
| Matching model location | Select the Save the model on file system check box and in the Folder field, set the path to the local folder where you want to generate the matching files.<br><br>If you want to store the model in a specific file system, for example S3 or HDFS, you must use the corresponding component in the Job and select the Define a storage configuration component check box in the component basic settings.<br><br>The button for browsing does not work with the Spark Local mode; if you are using the other Spark Yarn modes that Talend Studio<br>supports with your distribution, ensure that you have properly configured the connection<br>in a configuration component in the same Job. Use the configuration component depending<br>on the filesystem to be used. |
| Generate feature importance report | Select this check box to generate a report that contains a summary of the model and the settings. For more information, see [Feature importance report](https://help.qlik.com/talend/en-US/data-matching/8.0/feature-importance-report).<br><br>You can save the report on:<br><br><ul> <li>The local system</li> <li>Microsoft Azure, in local Spark mode or connected to Azure HDInsight, using <span>tAzureFSConfiguration</span> </li> <li>Amazon S3, only in local Spark mode, using <span>tS3Configuration</span> </li> </ul> |
| Integration with Data Stewardship | Select this check box to set the connection parameters to the<br>Talend Data Stewardship<br>server.<br><br>If you select this check box, tMatchModel uses the sample suspect records labeled in a Grouping campaign defined on the<br>Talend Data Stewardship<br>server, which means this component can be used as a standalone component. |
| Data Stewardship Configuration | Available when the Integration with Data Stewardship check box is selected.<br><br><ul> <li> <p> <span>URL</span>:</p> <p>Enter the address to access the <span>Talend Data Stewardship</span> server suffixed with                <em>/data-stewardship/</em>, for example                <kbd>http://&lt;server_address&gt;:19999/data-stewardship/</kbd>.</p> <div> <p>If you are working with <span>Talend Cloud Data Stewardship</span>, use the URL for the                corresponding data center suffixed with <em>/data-stewardship/</em> to access the                application, for example, <kbd>https://tds.us.cloud.talend.com/data-stewardship</kbd> for the AWS US                data center.</p> <p>For the URLs of available data             centers, see <a href="https://help.qlik.com/talend/en-US/installation-guide-windows/Cloud/talend-cloud-application-url" target="_blank">Accessing Talend Cloud applications</a>.</p> </div> </li> <li> <p> <span>Username</span> and <span>Password</span>:</p> <p>Enter the authentication information to log in to <span>Talend Data Stewardship</span>.</p> <div>If you are working with <span>Talend Cloud Data Stewardship</span> and if: <ul> <li>SSO is enabled, enter an access					token in the field.</li> <li>SSO is not enabled, enter either					an access token or your password in the field.</li> </ul> </div> </li> <li> <p> <span>Campaign Label</span>:</p> <p>Displays the technical name of the campaign once it is selected            in the basic settings. However, you can modify the field value to replace it with a            context parameter for example and pass context variables to the Job at runtime. This            technical name is always used to identify a campaign when the Job communicates with                <span>Talend Data Stewardship</span> whatever is the value in the <span>Campaign</span>            field.</p> <p>Click <span>Find a Campaign</span> to open a dialog box which lists the Grouping campaigns on the server for which you are the <span>Campaign owner</span> or you have the access rights.</p> <p>Click the refresh button to retrieve the campaign details from the <span> <span>Talend Data Stewardship</span> </span> server.</p> </li> </ul> |

## Advanced settings

| Properties | Description |
| --- | --- |
| Max token number for phonetic comparison | Set the maximum number of the tokens to be used in the phonetic comparison.<br><br>When the number of tokens exceeds what has been defined in this field, no phonetic comparison is done on the string. |
| Random Forest hyper-parameters tuning | Number of trees range: Enter a range for the decision trees you want to build. Each decision tree is trained independently using a random sample of features.<br><br>Increasing this range can improve the accuracy by decreasing the variance in predictions, but will increase the training time.<br><br><br>Maximum tree-depth range: Enter a range for the decision tree depth at which the training should stop adding new nodes. New nodes represent further tests on features on internal nodes and possible class labels held by leaf nodes.<br><br>Generally speaking, a deeper decision tree is more expressive and thus potentially more<br>accurate in predictions, but it is also more resource consuming and prone to<br>overfitting. |
| Checkpoint Interval | Set the frequency of checkpoints. It is recommended to leave the default value (10).<br><br>Before setting a value for this parameter, activate checkpointing and set the checkpoint directory in the Spark Configuration tab of the Run view.<br><br>For further information about checkpointing, see [Logging and checkpointing the activities of your Apache Spark Job](https://help.qlik.com/talend/en-US/components/8.0/spark-batch/logging-and-checkpointing-activities-of-your-apache-spark-job-spark-batch-component-if-you). |
| Cross-validation parameters | Number of folds: Enter a numeric value of bins which are used as separate training and test datasets.<br><br><br>Evaluation metric type: Select a type from the list. For further information, see [Precision and recall](https://en.wikipedia.org/wiki/Precision_and_recall). |
| Random Forest parameters | Subsampling rate: Enter the numeric value to indicate the fraction of the input dataset used for training each tree in the forest. The default value 1.0 is recommended, meaning to take the whole dataset for test.<br><br><br>Subset Strategy: Select the strategy about how many features should be considered on each internal node in order to appropriately split this internal node (actually the training set or subset of a feature on this node) into smaller subsets. These subsets are used to build child nodes.<br><br>Each strategy takes a different number of features into account to find the optimal point among these features for split. This point could be, for example, the age 35 of the categorical feature age.<br><br><ul> <li> <p> <span>auto</span>: This strategy is based on the number of trees you have set in the <span>Number of trees in the forest</span> field in the <span>Basic settings</span> view. This is the default strategy to be used.</p> <p>If the number of trees is <kbd>1</kbd>, the strategy is actually <span>all</span>; if this number is greater than <kbd>1</kbd>, the strategy is <span>sqrt</span>.</p> </li> <li> <p> <span>all</span>: The total number of features is considered for split.</p> </li> <li> <p> <span>sqrt</span>: The number of features to be considered is the square root of the total number of features.</p> </li> <li> <p> <span>log2</span>: The number of features to be considered is the result of <em>log<sub>2</sub>(M)</em>, in which <em>M</em> is the total number of features.</p> </li> </ul> |
| Max Bins | Enter the numeric value to indicate the maximum number of bins used for splitting<br>features.<br><br>The continuous features are automatically transformed to ordered discrete features. |
| Minimum information gain | Enter the minimum number of information gain to be expected from a parent node to its<br>child nodes. When the number of information gain is less than this minimum number, node<br>split is stopped.<br><br>The default value of the minimum number of information gain is *0.0*, meaning that no further information is obtained by splitting a given node.<br>As a result, the splitting could be stopped.<br><br>For further information about how the information gain is calculated, see [Impurity and Information gain](http://spark.apache.org/docs/latest/mllib-decision-tree.html#node-impurity-and-information-gain) from the Spark documentation. |
| Min instance per Node | Enter the minimum number of training instances a node should have to make it valid for<br>further splitting.<br><br>The default value is *1*, which means when a node has<br>only *1* row of training data, it stops splitting. |
| Impurity | Select the measure used to select the best split from each set of splits.<br><br><ul> <li> <p> <span>gini</span>: it is about how often an element could be        incorrectly labeled in a split.</p> </li> <li> <p> <span>entropy</span>: it is about how unpredictable the information in        each split is.</p> </li> </ul><br><br>For further information about how each of the measures is calculated, see [Impurity measures](http://spark.apache.org/docs/latest/mllib-decision-tree.html#node-impurity-and-information-gain) from the Spark documentation. |
| Set a random seed | Enter the random seed number to be used for bootstrapping and choosing feature<br>subsets |
| Data Stewardship Configuration | Available when the Integration with Data Stewardship check box in the Basic settings is selected.<br><br><br>Campaign Name:<br><br>Displays the technical name of the campaign once it is selected<br>in the basic settings. However, you can modify the field value to replace it with a<br>context parameter for example and pass context variables to the Job at runtime. This<br>technical name is always used to identify a campaign when the Job communicates with<br>Talend Data Stewardship whatever is the value in the Campaign<br>field.<br><br><br>Batch Size: Specify the number of records to be processed in each batch.<br><br>Do not change the default value unless you are facing performance issues. Increasing the batch size can improve the performance but setting a too high value could cause Job failures. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as an intermediate step.<br><br>This component, along with the Spark Batch component Palette it belongs to,<br>appears only when you are creating a Spark Batch Job. |
| Spark Batch Connection | In the Spark<br>Configuration tab in the Run<br>view, define the connection to a given Spark cluster for the whole Job. In<br>addition, since the Job expects its dependent jar files for execution, you must<br>specify the directory in the file system to which these jar files are<br>transferred so that Spark can access these files:<br><br><ul> <li> <div> <span>Yarn mode</span> (Yarn client or Yarn cluster):<ul> <li> <p>When using Google Dataproc, specify a bucket in the                                            <span>Google Storage staging bucket</span>                                        field in the <span>Spark configuration</span>                                        tab.</p> </li> <li> <p>When using HDInsight, specify the blob to be used for Job                                        deployment in the <span>Windows Azure Storage                                            configuration</span> area in the <span>Spark                                            configuration</span> tab.</p> </li> <li>When using Altus, specify the S3 bucket or the Azure                                    Data Lake Storage for Job deployment in the <span>Spark                                        configuration</span> tab.</li> <li> <p>When using on-premises distributions, use                                        the configuration component corresponding to the file system                                        your cluster is using. Typically, this system is HDFS and so                                        use <a href="https://help.qlik.com/talend/r/en-US/8.0/hdfs/thdfsconfiguration" target="_blank">tHDFSConfiguration</a>.</p> </li> </ul> </div> </li> <li> <p> <span>Standalone mode</span>: use the                            configuration component corresponding to the file system your cluster is                            using, such as <a href="https://help.qlik.com/talend/r/en-US/8.0/hdfs/thdfsconfiguration-properties-for-apache-spark-batch" target="_blank">tHDFSConfiguration Apache Spark Batch</a> or <a href="https://help.qlik.com/talend/r/en-US/8.0/amazon-s3/ts3configuration-properties-for-apache-spark-batch" target="_blank">tS3Configuration Apache Spark Batch</a>.</p> <p>If you are using Databricks without any configuration component present                            in your Job, your business data is written directly in DBFS (Databricks                            Filesystem).</p> </li> </ul><br><br>This connection is effective on a per-Job basis. |