3.1. Visualization of Basketball Game Data Based on Random Forest Algorithm
With the rapid development of the economy, the application fields of computer technology
are becoming more extensive. In terms of data visualization, computer technology can
use different techniques to visualize data, and people can also obtain basketball
game data through various channels. However, traditional algorithms are prone to poor
data visualization effects when visualizing basketball game data. Therefore, the study
introduces the RF to visualize basketball game data, as RF can extract feature data
from a large amount of data, classify and regress the feature data [15,
17]. The steps for visualizing basketball game data are shown in Fig. 1.
Fig. 1. Data visualization process.
Fig. 1 shows the core flow of basketball game data visualization. The View layer interacts
with the user through the ARI interface and designs the mechanics map to map key game
metrics (such as scoring efficiency and defensive line). The rendering and interaction
module of the force mapping component is responsible for dynamically presenting multidimensional
data (such as player position hot zone). The database interface connects the open
source knowledge graph database in the data layer with the basketball knowledge graph
database to extract and fuse structured data. This process provides infrastructure
support for subsequent TRRF algorithm feature classification and clustering optimization,
ensuring accurate segmentation and visual presentation of high-dimensional data. When
using the RF algorithm to visualize basketball game data, the first step is to calculate
the function of the input vector based on the decision tree that classifies and plans
the data, as shown in Eq. (1).
In Eq. (1), $A_k(\cdot)$ represents the average value. $I(\cdot)$ represents the function value.
Then, the error value of the RF algorithm is calculated through the input function,
as shown in Eq. (2).
In Eq. (2), $P^*$ represents the error value. Combined with the number of decision trees, convergence
analysis is performed on the error values, as shown in Eq. (3).
In Eq. (3), $h(X,\Theta)$ represents the classifier. Then, the limit value of the RF error value
is determined, as expressed in Eq. (4).
In Eq. (4), $\rho$ represents the value of the correlation coefficient. $S$ represents the classification
strength value. Finally, the coefficient of multiple decision trees is calculated,
as shown in Eq. (5).
In Eq. (5), $p^2(0 \mid T)$ and $p^2(1 \mid T)$ represent the sample ratio. Based on the proportion
between different samples, the visualization effect between different samples is judged,
as shown in Eq. (6).
In Eq. (6), $N$, $N_1$, and $N_r$ all represent the number of samples. After visualizing the
basketball game data through the above steps, the process of visualizing the basketball
game data using the RF algorithm is obtained, as shown in Fig. 2.
Fig. 2. The process of visualizing data in a random forest.
Fig. 2 shows the flow of basketball data visualization based on RF algorithm. Taking a specific
sample in the experimental data set as an example (such as a team's game data in a
certain year), the algorithm first extracts key features from the large-scale data,
including a player's shooting percentage (such as a player's 45.6%), defensive rebounding
efficiency (such as a team's 7.2 times per game), and passing success rate (such as
a player's 82%). Then, multiple decision trees are used to perform parallel classification
and regression analysis of features. For example, decision tree 1 ranks offensive
efficiency based on shooting percentage, and decision tree 2 evaluates defensive stability
based on defensive rebound data. After integrating the results of the decision tree
using the Bagging method, the improved TRRF algorithm introduces a clustering strategy
to screen high-precision sub libraries. Ultimately, the best prediction result is
selected through a majority voting mechanism. Clustering algorithms can cluster unlabeled
data samples based on their similarity, and assign the classified data to the same
cluster based on the classified data [18,
20]. When clustering algorithms classify data without similarity in decision trees, they
first select the initial cluster center in the decision tree, and then select the
next cluster center based on the initial cluster center [21,
23]. The expression is shown in Eq. (7).
In Eq. (7), $D(x)$ represents the distance. Then, based on the selected central clustering points,
the optimal K value of the clustering center is calculated, as shown in Eq. (8).
In Eq. (8), $a_i$ represents the distance between the sample and the classification cluster.
$b_i$ represents the average distance. Finally, the sample contour coefficient is
used to limit the K value, as shown in Eq. (9).
In Eq. (9), $n$ represents the number of samples. After improving the RF through the above steps,
the improved RF algorithm, namely TRRF algorithm, is obtained. The improved RF algorithm
is used to visualize and analyze basketball game data to obtain the best visualization
results. The specific process of visualizing basketball game data using this algorithm
is shown in Fig. 3.
Fig. 3. The process of visualizing data by the TRRF algorithm.
As shown in Fig. 3, the TRRF algorithm first samples the training set data for visual analysis of basketball
game data, and classifies the sampled game data. Then, features are extracted from
different categories of game data based on the improved high-precision decision tree
to obtain high-precision game data sub forests. The high-precision sub forests are
then divided into different clusters and combined into random sub forests. Finally,
the best sub forest is found in the random sub forest as the final visualization result.
For basketball game data with no features or sparse features, TRRF algorithm uses
an improved high-precision decision tree to divide the original data into multi-granularity,
such as dividing time series data into discrete intervals, and counting key indicators
in each interval. The clustering algorithm is used to analyze the similarity of unlabeled
data and generate cluster labels as new features. Multiple sub forests are generated
by the Bagging method. Each sub forest generates differentiated features based on
different clustering centers or feature combinations. The TRRF algorithm can automatically
mine the hidden features from the original data and effectively classify featureless
data.
3.2. Random Forest Data Visualization Prediction Model Integrating Voting Ensemble
Learning Algorithm
The improved RF algorithm can effectively visualize and analyze basketball game data.
However, when there are a large number of training sets in the basketball game dataset,
it is easy to be unable to classify feature data [24,
26]. In response to this issue, the research introduces the Voting ensemble learning
algorithm for visualizing basketball game data, mainly because this learning algorithm
can process the data in the dataset according to different voting methods to determine
the final prediction effect [27,
28]. The basic principle of the Voting ensemble learning algorithm is shown in Fig. 4.
Fig. 4. Basic principle of the Voting ensemble learning algorithm.
In Fig. 4, the Voting ensemble learning algorithm combines multiple classifiers in the training
set. Different models in the dataset are predicted and analyzed based on different
classifiers. All results are fused to obtain the final prediction result in the dataset.
When visualizing basketball game data using the Voting ensemble algorithm, different
categories are first calculated based on different voting methods, as shown in Eq. (10).
In Eq. (10), $p_k$ represents the probability. $E_k$ represents the weighted probability. $w_i$
represents the weight value. Then, the final probability value is calculated through
category probability, as shown in Eq. (11).
In Eq. (11), $y_{i-predict-voting}$ represents the probability result. Then, the feature data
in the dataset is selected and the error relationship between different classifiers
is calculated, as shown in Eq. (12).
In Eq. (12), $f$ represents the mapping relationship. $\varepsilon$ represents the error value.
The error value after voting is calculated based on the relationship between different
error values, as shown in Eq. (13).
In Eq. (13), $T$ represents the total number of classifiers. Finally, the weight is calculated
by computing the individual extremum, as expressed in Eq. (14).
In Eq. (14), $p_{iD}$ represents the individual extremum. The expression for calculating the
global extremum through individual extremum is shown in Eq. (15).
In Eq. (15), $p_{gD}$ represents the global optimal solution. Finally, by obtaining the extremum,
the update speed and position of the data particles are calculated, as shown in Eq. (16).
In Eq. (16), $\omega$ represents the inertia factor. $C_1$ and $C_2$ represent constant values.
$\gamma$ represents a random number. After visualizing basketball game data using
the Voting ensemble learning algorithm, the specific process of visualizing basketball
game data is obtained, as shown in Fig. 5.
Fig. 5. The process of ensemble learning to visualize data.
As shown in Fig. 5, when visualizing basketball game data, the Voting ensemble learning algorithm first
extracts the feature data of basketball games from a large dataset. The feature data
of basketball games is input into different training sets created by the Voting ensemble
learning algorithm. The feature data of basketball games is predicted based on the
models in different training sets, and then combined the prediction results with the
feature function. Finally, by analyzing and processing the final prediction results,
the visualization of basketball game data is obtained. The Voting ensemble learning
algorithm can obtain the optimal visualization results of basketball game data. Voting
ensemble learning improves the model performance by fusing the prediction results
of multiple classifiers [29,
30]. Its core mechanism can be divided into Hard Voting and Soft Voting. In basketball
game data, hard voting directly selects the highest frequency prediction category
through the majority voting mechanism. For example, when predicting the outcome of
an offense (score/turnover), if the three base classifiers output “score”, “score”,
and “turnover”, respectively, hard voting will determine the final result as “score”.
This method is suitable for scenarios where category labels are clear (such as event
type classification). Soft voting outputs weighted fusion results based on the probability
of the classifier. The optimization strategy of hard voting and soft voting is realized
through feature classification optimization, numerical prediction optimization, and
anti-noise enhancement. In feature classification optimization, hard voting is used
for discrete events (such as foul decision) to ensure that the classification results
are consistent with the actual referee records. In numerical prediction optimization,
soft voting is used for continuous indicators (such as shooting percentage). The contribution
of high-precision decision tree is dynamically adjusted by combining weight coefficients.
To obtain more accurate visualization results, a mixed prediction model combining
Voting ensemble learning algorithm with TRRF algorithm for basketball game data visualization
analysis is proposed, namely Voting-TRRF visualization prediction model. The basic
structure of this prediction model is shown in Fig. 6.
Fig. 6. Prediction model of TRRF algorithm based on voting ensemble learning.
In Fig. 6, the Voting-TRRF visualization prediction model first inputs the collected game data
for visual analysis of basketball game data. The input data is integrated into a training
set. Then, the high-precision decision tree of the TRRF algorithm is used to integrate
the data into a dataset. The data is then divided into multiple sub forests and combined
into a forest set. Finally, the Voting ensemble learning is combined with the TRRF
algorithm. The output result is used as the final game data result. To realize the
visual prediction of Voting ensemble learning algorithm, Scikit-learn and Plotly in
Python ecosystem are used as the core simulation tools. Scikit-learn provides interfaces
for VotingClassifiers and VotingRegressor, and supports flexible configuration of
hard and soft voting strategies. In the process of visual effect improvement, real-time
data flow rendering is implemented through plotly.graph_objects.Fig.Widget to update
competition data in real-time. Multi-dimensional overlay analysis uses Scatter3d to
simultaneously display player position, movement speed, and tactical path. User interaction
enhancement supports user-defined filtering conditions through callback functions,
improving the flexibility of data exploration.