# BoxRF: A New Machine Learning Algorithm for Grade Estimation
## 2 Materials and Methods  
The proposed technique has its basis in the structure of RFs. Readers unfamiliar with RFs are referred to [2], an open-source publication that presents RFs in a way that is relevant to this paper. At its essence, RFs employ a set of samples, known as leaves, to make predictions. These leaves are produced through a random and sequential division of data. By segmenting the data in numerous different ways, a series of divisions culminates in a collection of leaves, called trees. In the BoxRF method, leaves are a random set of \"boxes\", with a box being a 3D region in space. The dimension of the boxes is set by the user based on their knowledge of the deposit. The dimensions are not fixed; they are set as ranges based on expected lengths of geological trends. The intention behind the use of boxes is to capture trends, like how they are used as search boxes in classical reserve estimation methods. In the classical methods, search boxes are typically fixed in dimension and direction, whereas in the BoxRF method, they are not. The BoxRF method starts with laying a box at the location of a randomly selected sample (Figure 1). The direction and plunge of the box are randomly determined. Once a box is generated, all samples that fall within the box are identified. If the number of samples in a box meets a threshold (minimum samples in a box or MS), the box is \"accepted\" and the samples inside the box are deleted from the database. There is a nuance about the deletion of samples that is discussed in a subsequent section. This is reflected in Figure 1 as \"Delete captured samples from database as appropriate\". The next box is then laid at the end of the current box, so that it is in the same alignment as the current box. The next box has the same dimensions as the current one. The logic is to continue laying boxes in a random direction as long as the MS requirements are met. Figure 1: The process by which a tree is formed for the forest. When two or more boxes are laid in sequence, the structure is called a branch (though a branch may have just one box eventually). The process stops when a box is rejected for having insufficient samples. A new box is then generated at the location of a randomly selected sample with a different dimension and in a different direction. The process continues until boxes cannot be formed. Twenty-five attempts are made to form boxes before the process is stopped. At the end of the process, there will always be a sprinkling of samples that are not in any boxes. These orphan samples are treated as a leaf and represent the region outside of all the boxes (\"orphan leaf\"). The collection of boxes, along with the orphan leaf, is called a tree (Figure 2). Like RFs, the BoxRF method requires several trees. Once a tree is formed, the algorithm continues to generate the next tree with a fresh copy of the dataset. After the RF is formed, it is used to make predictions. The final similarity and difference between RF and BoxRF are in how predictions are made. Two flowcharts are provided in subsequent sections to help describe the prediction method. In both methods, the final prediction is obtained from the predictions made by individual trees. RFs typically obtain the final prediction by taking the mean or median of predictions made by individual trees. In RFs, a prediction is made by a tree from a leaf that represents the prediction location most closely. In BoxRF, a prediction is made by the box whose space includes the location to be predicted. When a sample is outside any of the boxes in a tree, a prediction is made from the orphan leaf. In an RF, the prediction from a leaf is simply the mean or median of the samples in the leaf. The BoxRF method, on the other hand, uses the inverse distance (ID) method on the samples contained in the leaf to obtain the prediction. Thus, the BoxRF method honors the classical techniques by giving more weight to nearby samples. In this paper, the ID method was used with a power of 3, as it was found to perform better.