Welcome to the Data Set Weights section. This section goes over how to automatically balance class data sets using weights. Unlike the Balanced Data Sets section, this feature will only add a weight for each data set type and not remove data sets for balancing. 

When creating a new machine learning model, a weight can be used for balancing the positive (profit target reached) and negative (profit target not reached) data sets. As an example, if there are more negative than positive data sets a weight can be added to the positive data sets so that each data set that gets added to the model is either equal weight or greater weight than the negative set. 

In the Data Set Weights section in the Strategy Analyzer, the Use Data Set Weights parameter must be checked in order to use the weights option.


If the Use Positive Negative Class Weighting parameter is checked then the Deep Signal Library will add weights the positive and negative data sets to balance the sets 1:1. It uses an inverse frequency formula to calculate the weight values.

As an example, if we have 1 positive but 2 negative data sets we would like to add a weight to each set to help balance them.

First, we calculate the total sets, which is 1+2=3. Then for each class data set we set the frequency.

       Positive Frequency = #Positive data sets / Total Data Sets = 1/3

       Negative Frequency = #Negative data sets / Total Data Sets = 2/3

Then the weight for each data set is calculated by taking the inverse of each.

       Positive weight = 3 / 1 = 3

       Negative weight = 3 / 2 = 1.5

The weight for the positive data set would be 3. The two negative data sets would each get 1.5 for their weights.


Custom Data Set Weight Ratio

In addition to balancing the data set by using the Use Positive Negative Class Weighting option, the user can also add in a custom value for weights for each data set if the Use Custom Data Weight Set Ratio parameter is checked. The weight for each is calculated from the Custom Data Weight Ratio parameter. This ratio is the Positive Data Set Weight / Negative Data Set Weight. If the ratio is set to 1.5, then the positive data sets will get assigned a 1.5 weight and the negative data sets will get assigned a 1.0 weight. 

This can be used with the Use Positive Negative Class Weighting option to first balance the data sets then apply a custom weight.

Using the example above, if Use Positive Negative Class Weighting and Use Custom Data Weight Set Ratio are both checked and the Custom Data Weight Ratio is 3.0, then we first calculate the Positive Negative Class Weight as above then multiple the positive weight by 3.0.

The new positive weight would be 3 * 3 = 9 and the negative weight would remain the same at 1.5.

If Use Positive Negative Class Weighting was not checked then the positive and negative weight values would start at 1.0. The  Use Custom Data Weight Set Ratio would multiply the positive data set by 3.0 and the negative data set would stay at 1.0.

       Positive weight = 3 * 1 = 3

       Negative weight = 1



Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.