# IntelliPortfolio: Intelligent Portfolio for Enhanced Index Tracking Using Clustering and LSTM

Authors: Kan Yi; Jin Yang; Shuangling Wang; Zhengtong Zhang; Jing Zhang; Jinqiu Song; Xiao Ren
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

Enhanced index tracking (EIT) is an active research area in portfolio management that focuses on adding reliable value relative to the index on the basis of mimicking the behavior of the benchmark index. To solve the EIT problem, many approaches have been proposed. However, it still remains a critical challenge to efficiently generate a portfolio with good quality. In this study, we propose a learning-based approach named IntelliPortfolio for the EIT problem. IntelliPortfolio uses PCA and clustering to select stock and estimates the investment weight for each constituent stock using a long short-term memory (LSTM) network. Two advantages of the proposed algorithm are as follows. (1) It considers both the fundamentals and the price information for stocks and can balance the trade-off between the performance and the diversity of the selected stocks. (2) It uses a LSTM model to estimate investment weights, which is more capable to handle long sequences of input and is more robust to predict the future trend of stock market. Experimental results on the five real-world datasets of the international stock market illustrate the significant performance superiority of the proposed approach in comparison with five state-of-the-art algorithms.


---

## Body

## 1. Introduction

As one of the most important strategies of passive investment, index tracking describes the process of investing in a portfolio that attempts to match the performance of some specified benchmark indexes. Today, indexed portfolios often function as the core holding in an investor’s overall equity allocation. The idea of “enhanced index tracking (EIT)” has recently gained tremendous importance because more and more fund managers seek to outperform the index by appreciating the core of index investing. The reasons are pretty obvious. By design, index tracking can only produce a similar return to the index, which makes index funds always underperform the index by the amount of fund costs [1]. Enhanced return, therefore, could often bring fund managers competitive advantages after deducting expenses to track and reward new customers. In fact, enhanced index tracking is a dual-objective problem seeking the optimal decisions in the trade-off between maximizing expected performance and minimizing tracking risk.Existing methods for enhanced index tracking include statistic-based, heuristic, and learning-based, as discussed in Section2. Statistic-based approaches are the most mature method and have been studied for many years. However, such approach requires a significant amount of calculation and becomes instable when the covariance matrix of the dataset is ill-conditioned or nonpositive [2]. Heuristic methods have been shown to be effective in finding good portfolios [3], but are inefficient in solving high-dimensional EIT problems. More specifically, they are prone to fall into local minimums when searching for a large solution space and often result in suboptimal portfolios [4]. Learning-based approaches, although still in their infancy, are continuously popular. Methods belonging to this category are sensitive to the stability of the stock market, and their performance often fluctuates significantly.To address the above issues, we propose an Intelligent Portfolio algorithm for enhanced index tracking problem, referred to as IntelliPortfolio, which aims to automatically select the constituent stocks for the portfolio from a benchmark index and determine the investment weight for each constituent stock. The key ideas of IntelliPortfolio are to select constituent stocks for the portfolio using principal component analysis (PCA) and k-means clustering algorithm and to estimate the investment weight for each constituent stock using a long short-term memory (LSTM) network. The motivation here is twofold. (1) The use of PCA and clustering algorithm to select stock is that it can consider both the fundamentals and the price information for stocks and can balance the trade-off between the performance and the diversity of the selected stocks. (2) The use of LSTM to estimate investment weights is that LSTM is more capable to handle long sequences of input when compared to other recurrent neural networks and is more robust to predict the future trends of stock [5]. This strategy is shown to produce better solutions in our practical experiments.In summary, our work makes the following contributions to the field:(i)
We propose a novel, principal component analysis (PCA) and clustering-based stock selection algorithm to select constituent stocks for a portfolio from the benchmark index. Our algorithm considers both the fundamentals and the price information for each stock and can balance the trade-off between the performance and the diversity of the selected stocks. Our extensive experiments also show the effectiveness and the generality of proposed stock selection algorithm.(ii)
We propose IntelliPortfolio algorithm to solveEIT problem, which seamlessly integrates the stock selection algorithm with a long short-term memory (LSTM)-based investment weight estimation algorithm. Given a stock dataset and the number of stocks in a portfolio, IntelliPortfolio can both select the constituent stocks of the portfolio and determine the investment weight for each constituent stock.(iii)
We evaluate the performance of IntelliPortfolio through extensive experiments using five real-world datasets of international stock markets. We show that IntelliPortfolio outperforms five state-of-the-art enhanced index tracking algorithms by 8.78%–665.97% in terms of four well-known performance metrics.


## 2. Related Work

Enhanced index tracking is an active research area in portfolio management based on index tracking which aims to replicate the performance of the benchmark. We can classify the previous studies for index tracking on this problem into three categories: statistic-based, heuristic, and learning-based approaches, as discussed below.


### 2.1. Statistic-Based Approach

Traditionally, index tracking problem has been treated as linear or quadratic programming problems. Wu et al. [6] presented several constrained cluster-based linear mixed-integer optimization models for tracking broad market indices using the developed Lagrangian and semi-Lagrangian relaxation approaches for computing near optimal solutions. Chen and Kwon [2] developed a 0-1 integer program model considering initial portfolio selection and subsequent investment in assets. Fang and Wang [7] proposed a bi-objective programming model for the index tracking portfolio selection problem. Edirisinghe [8] developed a closed-form cost-free solution to the index tracking portfolio selection problem. Wu and Wu [9] designed a multifactor liner regression model as the basis of the tracking models and to enhance the capacity of the decision model, and a Lagrangian-based algorithm is applied to approximate optimal solutions. Oliver and Baumann [10] proposed a value-based mixed-integer linear programming (MILP) formulation for the index tracking problem that leads to a high similarity in terms of the normalized historical value developments between the tracking portfolio and the index and to low rebalancing costs.Statistic-based approach is a category of classic solutions to the EIT problem and has been studied for many years. However, such approach requires high-precision dataset and a significant amount of calculation. Moreover, they suffer from the poor stability when the covariance matrix of the dataset is ill-conditioned or nonpositive [2].


### 2.2. Heuristic Approach

Because the enhanced index tracking problem has been proven to be NP hard [11–15], many previous studies apply heuristic algorithms to solve it. Mutunge and Haugland [16] proposed a greedy constructive heuristic algorithm that can extend the current portfolio by a single asset in each iteration. Sant’Anna et al. [17] applied a hybrid solution approach combining mathematical programming and genetic algorithm to deal with the volatility problem of stock markets in developing countries. Chen et al. [18] introduced an indexed portfolio optimization model using the mean-variance-skewness framework and proposed a hybrid algorithm combining the firefly algorithm (FA) and the genetic algorithm (GA). Strub and Oliver [19] developed an iterated greedy heuristic for replicating the 1/N portfolio by investing in a subset from a given investment universe. Salehpoor and Molla-Alizadeh-Zavardehi [20] presented a hybrid metaheuristic algorithm to solve the index tracking problem. Beasley et al. [21] presented an evolutionary heuristic algorithm for the index tracking problem. Orito et al. [22] proposed a two-step stock selection algorithm that uses a heuristic method to select stocks and then uses a genetic algorithm to construct a portfolio. Oh et al. [23] used GA to optimize index funds, aiming at tracking stock index and minimizing tracking error. Roland and Berg [24] proposed a hybrid algorithm combining GA with quadratic programming to search for the optimal tracking portfolio. Kumar and Mishra [11] proposed a multiobjective optimizer for portfolio optimization which is based on covariance-guided Artificial Bee Colony (ABC) algorithm. Chen et al. [3] proposed a grouping genetic algorithm for solving the group trading strategy portfolio (GTSP) problem. Saborido et al. [25] proposed the mean-downside risk skewness (MDRS) model and defined the new mutation, crossover, and reparation operators for an evolutionary multiobjective optimization to solve the index tracking problem. Benidis et al. [26] provided a unified framework for a large variety of sparse index tracking formulations and derived a mixed-integer programming (MIP)-based algorithm considering various tracking error functions and constraints. Canakgoz and Beasley [27] presented a mixed-integer linear programming formulations for index tracking problem. García et al. [28] proposed a genetic algorithm and Tabu search-based for index tracking optimization.Heuristic methods have been proven to be effective in finding good portfolios [3], but they often suffer from the inefficiency in the EIT problem with a high-dimensional space [29]. They are prone to fall into the local minimum when searching for the large solution space [4] and often result in suboptimal portfolios.


### 2.3. Learning-Based Approach

Fu et al. [29] presented a stacking stock selection model based on supervised learning, used a genetic algorithm to select stock features, and labelled stocks according to the return-to-volatility ratio ordering. Dose and Cincotti [30] presented a stochastic-optimization technique based on time-series cluster analysis for index tracking problem. Ouyang et al. [4] used the deep autoencoder to select the portfolio and then used the deep neural network to dynamically determine the portfolio weight. Zhang and Tan [31] proposed a new stock selection model named DeepStockRanker to predict the future stock return ranking based on the historical data without handcrafted features. Chalvatzis and Hristu-Varsakelis [32] proposed a deep long short-term memory (LSTM) model to predict asset prices and a prediction-based trading strategy. Paiva et al. [33] proposed a method combining support vector machine (SVM) and mean-variance (MV) for portfolio selection. Jiang et al. [34] proposed a deep reinforcement learning framework aiming to maximize cumulative returns using deterministic policy gradient (DPG). Liang et al. [35] implemented three new continuous reinforcement learning algorithms, namely, deep deterministic policy gradient (DDPG), proximal policy optimization (PPO), and policy gradient (PG), in portfolio management. Moody et al. [36] trained two kinds of reinforcement learning methods, namely, real-time recurrent learning (RTRL) and Q-learning, to solve index tracking problem. Park et al. [37] proposed an approach for deriving a multiasset portfolio trading strategy using deep Q-learning. Lu [38] implemented a learning model using LSTM with reinforcement learning or evolution strategies as agents. Zhang and Maringer [39] developed a model that combines GA with recurrent reinforcement learning (RRL) for asset trading. García-Galicia et al. [40] provided a reinforcement learning model in continuous-time discrete-state portfolio management with time penalization for transaction cost. Vo et al. [41] introduced a deep responsible investment portfolio model containing a multivariate bidirectional LSTM neural network to predict stock returns.Learning-based approach has received much attention recently. However, many learning-based algorithms construct the portfolio by predicting the future price of stocks, which has been proven to be inaccurate [41]. Reinforcement learning-based algorithms, on the contrary, can construct the portfolio adaptively. However, our experiment shows that they are very sensitive to the stability of the stock market, and their performance fluctuates significantly.


## 2.1. Statistic-Based Approach

Traditionally, index tracking problem has been treated as linear or quadratic programming problems. Wu et al. [6] presented several constrained cluster-based linear mixed-integer optimization models for tracking broad market indices using the developed Lagrangian and semi-Lagrangian relaxation approaches for computing near optimal solutions. Chen and Kwon [2] developed a 0-1 integer program model considering initial portfolio selection and subsequent investment in assets. Fang and Wang [7] proposed a bi-objective programming model for the index tracking portfolio selection problem. Edirisinghe [8] developed a closed-form cost-free solution to the index tracking portfolio selection problem. Wu and Wu [9] designed a multifactor liner regression model as the basis of the tracking models and to enhance the capacity of the decision model, and a Lagrangian-based algorithm is applied to approximate optimal solutions. Oliver and Baumann [10] proposed a value-based mixed-integer linear programming (MILP) formulation for the index tracking problem that leads to a high similarity in terms of the normalized historical value developments between the tracking portfolio and the index and to low rebalancing costs.Statistic-based approach is a category of classic solutions to the EIT problem and has been studied for many years. However, such approach requires high-precision dataset and a significant amount of calculation. Moreover, they suffer from the poor stability when the covariance matrix of the dataset is ill-conditioned or nonpositive [2].


## 2.2. Heuristic Approach

Because the enhanced index tracking problem has been proven to be NP hard [11–15], many previous studies apply heuristic algorithms to solve it. Mutunge and Haugland [16] proposed a greedy constructive heuristic algorithm that can extend the current portfolio by a single asset in each iteration. Sant’Anna et al. [17] applied a hybrid solution approach combining mathematical programming and genetic algorithm to deal with the volatility problem of stock markets in developing countries. Chen et al. [18] introduced an indexed portfolio optimization model using the mean-variance-skewness framework and proposed a hybrid algorithm combining the firefly algorithm (FA) and the genetic algorithm (GA). Strub and Oliver [19] developed an iterated greedy heuristic for replicating the 1/N portfolio by investing in a subset from a given investment universe. Salehpoor and Molla-Alizadeh-Zavardehi [20] presented a hybrid metaheuristic algorithm to solve the index tracking problem. Beasley et al. [21] presented an evolutionary heuristic algorithm for the index tracking problem. Orito et al. [22] proposed a two-step stock selection algorithm that uses a heuristic method to select stocks and then uses a genetic algorithm to construct a portfolio. Oh et al. [23] used GA to optimize index funds, aiming at tracking stock index and minimizing tracking error. Roland and Berg [24] proposed a hybrid algorithm combining GA with quadratic programming to search for the optimal tracking portfolio. Kumar and Mishra [11] proposed a multiobjective optimizer for portfolio optimization which is based on covariance-guided Artificial Bee Colony (ABC) algorithm. Chen et al. [3] proposed a grouping genetic algorithm for solving the group trading strategy portfolio (GTSP) problem. Saborido et al. [25] proposed the mean-downside risk skewness (MDRS) model and defined the new mutation, crossover, and reparation operators for an evolutionary multiobjective optimization to solve the index tracking problem. Benidis et al. [26] provided a unified framework for a large variety of sparse index tracking formulations and derived a mixed-integer programming (MIP)-based algorithm considering various tracking error functions and constraints. Canakgoz and Beasley [27] presented a mixed-integer linear programming formulations for index tracking problem. García et al. [28] proposed a genetic algorithm and Tabu search-based for index tracking optimization.Heuristic methods have been proven to be effective in finding good portfolios [3], but they often suffer from the inefficiency in the EIT problem with a high-dimensional space [29]. They are prone to fall into the local minimum when searching for the large solution space [4] and often result in suboptimal portfolios.


## 2.3. Learning-Based Approach

Fu et al. [29] presented a stacking stock selection model based on supervised learning, used a genetic algorithm to select stock features, and labelled stocks according to the return-to-volatility ratio ordering. Dose and Cincotti [30] presented a stochastic-optimization technique based on time-series cluster analysis for index tracking problem. Ouyang et al. [4] used the deep autoencoder to select the portfolio and then used the deep neural network to dynamically determine the portfolio weight. Zhang and Tan [31] proposed a new stock selection model named DeepStockRanker to predict the future stock return ranking based on the historical data without handcrafted features. Chalvatzis and Hristu-Varsakelis [32] proposed a deep long short-term memory (LSTM) model to predict asset prices and a prediction-based trading strategy. Paiva et al. [33] proposed a method combining support vector machine (SVM) and mean-variance (MV) for portfolio selection. Jiang et al. [34] proposed a deep reinforcement learning framework aiming to maximize cumulative returns using deterministic policy gradient (DPG). Liang et al. [35] implemented three new continuous reinforcement learning algorithms, namely, deep deterministic policy gradient (DDPG), proximal policy optimization (PPO), and policy gradient (PG), in portfolio management. Moody et al. [36] trained two kinds of reinforcement learning methods, namely, real-time recurrent learning (RTRL) and Q-learning, to solve index tracking problem. Park et al. [37] proposed an approach for deriving a multiasset portfolio trading strategy using deep Q-learning. Lu [38] implemented a learning model using LSTM with reinforcement learning or evolution strategies as agents. Zhang and Maringer [39] developed a model that combines GA with recurrent reinforcement learning (RRL) for asset trading. García-Galicia et al. [40] provided a reinforcement learning model in continuous-time discrete-state portfolio management with time penalization for transaction cost. Vo et al. [41] introduced a deep responsible investment portfolio model containing a multivariate bidirectional LSTM neural network to predict stock returns.Learning-based approach has received much attention recently. However, many learning-based algorithms construct the portfolio by predicting the future price of stocks, which has been proven to be inaccurate [41]. Reinforcement learning-based algorithms, on the contrary, can construct the portfolio adaptively. However, our experiment shows that they are very sensitive to the stability of the stock market, and their performance fluctuates significantly.


## 3. Problem Statement

This study focuses on the enhanced index tracking problem, referred to as EIT, that aims to produce a portfolio that attempts to earn a higher return than the benchmark index (excess return) while minimizing the risk of deviating from the benchmark (tracking risk). In this section, we introduce notations and terminology first and then define the EIT problem formally.


### 3.1. Notations and Terminology

(i)
t: time point.(ii)
T: decision time point. 1,T is the in-sample time period to select tracking portfolio, and T,T+L is the out-of-sample time period to evaluate it.(iii)
N: number of stocks in the benchmark index.(iv)
K: number of stocks in the portfolio.(v)
pit: price of stock ii=1,2,…,N at time point tt=1,2,…,T+L.(vi)
It: index value at time tt=1,2,…,T+L.(vii)
xit: stock selection indicator for a portfolio. If the ith stock is selected to form the portfolio at time point t, xit=1; otherwise xit=0.(viii)
wit: investment weight for the ith stock in the tracking portfolio i=1,2,…,N.(ix)
rit: the single period continuous time return of the tracking portfolio at time point t and t−1t=2,3,…,T+L:(1)rt=ln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1.(x)
Rt: the single period continuous time return of the benchmark index at time point t and t−1t=2,3,…,T+L:(2)Rt=lnItIt−1.(xi)
TE: tracking error of the portfolio, which is defined as the distance between the returns of the tracking portfolio and its benchmark index [1]:(3)TE=1T∑t=2Trt−Rt21/2=1T∑t=2Tln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1−lnItIt−121/2.(xii)
ER: excess return of the portfolio, which is assessed by the average excess return per period achieved by the tracking portfolio [1]:(4)ER=∑t=1T1Tln∑i=1Npit+1pit⋅wit⋅xit−lnIt+1It.


### 3.2. Problem Formulation

As shown in Figure1, the EIT problem consists of two phases named in-sample and out-of-sample, respectively, and the decision time point is T. Any solutions to the EIT problem need to construct a tracking portfolio first according to the performance of stock market during the in-sample phase (from the time point 1 to T in Figure 1). The ultimate goal is to find an optimal tracking portfolio that can obtain the minimized tracking error and the maximized excess return during the out-of-sample phase (from the time point T to T+L in Figure 1). However, it is impossible to optimize this problem directly because a solution has to finish the construction of a portfolio at the decision time point T, and the price of a stock during the out-of-sample period (i.e., T,T+L) is unknown at T. To deal with this issue, we follow the previous studies [1] and simplify the EIT problem by optimizing the portfolio during the in-sample phase instead of the out-of-sample phase, which assumes that the stock prices between 1,T and T,T+L are independent and identical distributed (i.i.d).Figure 1
Overview of EIT problem.In summary, our EIT can be defined as a two-objective optimization problem:(5)minTE=1T∑t=2Trt−Rt21/2=1T∑t=2Tln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1−lnItIt−121/2,(6)maxER=∑t=1T1Tln∑i=1Npit+1pit⋅wit⋅xit−lnIt+1It,(7)s.t.∑i=1Nxit=K,∀t∈1,T,(8)wit≥0;∀t∈1,T,i∈1,N,(9)∑i=1Nwit=1,∀t∈1,T,where T and K is given, and equations (5) and (7) state that the goal of EIT is to optimize the tracking error and excess return simultaneously.Equations (9)–(11) state the constraints for the EIT problem. Equation (9) ensures that the number of stocks selected in the tracking portfolio is equal to K at any time point. Equation (9) ensures that no short positions are considered in a tracking portfolio. Equation (10) normalizes the investment weight for each stock in the tracking portfolio.


### 3.3. Complexity Analysis

This formulation shows that the goal of EIT problem is to search for an optimal portfolio consisting ofK stocks, each of which is selected from a known benchmark index containing NN≫K stocks, to minimize tracking error and maximize excess return. According to previous studies [11–15], the enhanced index tracking problem is essentially a classic combinatorial optimization (CO) problem and has been proven to be NP hard. The NP-completeness proof is established in [15]. Therefore, a naive exhaustive search solutions would not be practical due to the high dimensionality of decision space and the combinatorial nature of brutal force search.


## 3.1. Notations and Terminology

(i)
t: time point.(ii)
T: decision time point. 1,T is the in-sample time period to select tracking portfolio, and T,T+L is the out-of-sample time period to evaluate it.(iii)
N: number of stocks in the benchmark index.(iv)
K: number of stocks in the portfolio.(v)
pit: price of stock ii=1,2,…,N at time point tt=1,2,…,T+L.(vi)
It: index value at time tt=1,2,…,T+L.(vii)
xit: stock selection indicator for a portfolio. If the ith stock is selected to form the portfolio at time point t, xit=1; otherwise xit=0.(viii)
wit: investment weight for the ith stock in the tracking portfolio i=1,2,…,N.(ix)
rit: the single period continuous time return of the tracking portfolio at time point t and t−1t=2,3,…,T+L:(1)rt=ln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1.(x)
Rt: the single period continuous time return of the benchmark index at time point t and t−1t=2,3,…,T+L:(2)Rt=lnItIt−1.(xi)
TE: tracking error of the portfolio, which is defined as the distance between the returns of the tracking portfolio and its benchmark index [1]:(3)TE=1T∑t=2Trt−Rt21/2=1T∑t=2Tln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1−lnItIt−121/2.(xii)
ER: excess return of the portfolio, which is assessed by the average excess return per period achieved by the tracking portfolio [1]:(4)ER=∑t=1T1Tln∑i=1Npit+1pit⋅wit⋅xit−lnIt+1It.


## 3.2. Problem Formulation

As shown in Figure1, the EIT problem consists of two phases named in-sample and out-of-sample, respectively, and the decision time point is T. Any solutions to the EIT problem need to construct a tracking portfolio first according to the performance of stock market during the in-sample phase (from the time point 1 to T in Figure 1). The ultimate goal is to find an optimal tracking portfolio that can obtain the minimized tracking error and the maximized excess return during the out-of-sample phase (from the time point T to T+L in Figure 1). However, it is impossible to optimize this problem directly because a solution has to finish the construction of a portfolio at the decision time point T, and the price of a stock during the out-of-sample period (i.e., T,T+L) is unknown at T. To deal with this issue, we follow the previous studies [1] and simplify the EIT problem by optimizing the portfolio during the in-sample phase instead of the out-of-sample phase, which assumes that the stock prices between 1,T and T,T+L are independent and identical distributed (i.i.d).Figure 1
Overview of EIT problem.In summary, our EIT can be defined as a two-objective optimization problem:(5)minTE=1T∑t=2Trt−Rt21/2=1T∑t=2Tln∑i=1Nxit⋅pit⋅wit∑i=1Nxit−1⋅pit−1⋅wit−1−lnItIt−121/2,(6)maxER=∑t=1T1Tln∑i=1Npit+1pit⋅wit⋅xit−lnIt+1It,(7)s.t.∑i=1Nxit=K,∀t∈1,T,(8)wit≥0;∀t∈1,T,i∈1,N,(9)∑i=1Nwit=1,∀t∈1,T,where T and K is given, and equations (5) and (7) state that the goal of EIT is to optimize the tracking error and excess return simultaneously.Equations (9)–(11) state the constraints for the EIT problem. Equation (9) ensures that the number of stocks selected in the tracking portfolio is equal to K at any time point. Equation (9) ensures that no short positions are considered in a tracking portfolio. Equation (10) normalizes the investment weight for each stock in the tracking portfolio.


## 3.3. Complexity Analysis

This formulation shows that the goal of EIT problem is to search for an optimal portfolio consisting ofK stocks, each of which is selected from a known benchmark index containing NN≫K stocks, to minimize tracking error and maximize excess return. According to previous studies [11–15], the enhanced index tracking problem is essentially a classic combinatorial optimization (CO) problem and has been proven to be NP hard. The NP-completeness proof is established in [15]. Therefore, a naive exhaustive search solutions would not be practical due to the high dimensionality of decision space and the combinatorial nature of brutal force search.


## 4. Algorithm Design and Implementation

In this section, we introduce IntelliPortfolio, an efficient clustering and LSTM-based portfolio construction algorithm to solve the EIT problem. Its key idea is twofold: firstly, it applies principal component analysis (PCA) andk-means clustering algorithm to automatically select K constituent stocks for the portfolio from the benchmark index; secondly, it uses a long short-term memory (LSTM) network to determine the investment weight for each constituent stock in the portfolio. In the following, we first present the overview of our IntelliPortfolio algorithm. We then present the constituent stock selection algorithm and the weight estimation algorithm. Finally, we discuss the details of the IntelliPortfolio algorithm.


### 4.1. Overview

Figure2 illustrates the detailed steps of IntelliPortfolio. IntelliPortfolio contains two phases: constituent stock selection and investment weight estimation. At the constituent stock selection phase, after normalizing the original dataset, we use a PCA-based algorithm to reduce the dimensionality of the original dataset and apply a k-means clustering algorithm to generate K clusters from the benchmark index and then add K stocks that are closest to the center in each cluster to the portfolio. At the investment weight estimation phase, we adopt a novel windowed-random sampling strategy to generate random samples with fixed-window size and apply the LSTM model to estimate the investment weight for each constituent stock, which finally finishes the construction of the portfolio.Figure 2
Overview of IntelliPortfolio approach.


### 4.2. Constituent Stock Selection

The first step of constructing a tracking portfolio is to selectK constituent stocks from the benchmark index consisting of N stocks. Previous studies on this problem include industry-based method [34], trading volume-based method [23], and autoencoder-based method [4]. Industry-based method takes into account of the information on industry, market capitalization, and trading amount for each stock. Such approach is interpretable and easy to understand, but fail to reflect the trend in stock market [1]. Trading volume-based method, by contrast, can indicate the fluctuation of stock price effectively, but ignores the fundamentals of a stock. Autoencoder-based method trains a deep encoder-decoder network by using the stock price dataset and can adaptively select K stocks with the largest and smallest training error. However, it suffer from the low performance issue when the benchmark index contains a large number of stocks.To deal with these issues, we propose a novel stock selection algorithm integrating PCA and clustering method. The key of the our algorithm is twofold. (1) It considers both the fundamentals and the price information for each stock by receiving all known features from a dataset and using a PCA algorithm to find out the major factors. (2) It uses a clustering algorithm to automatically divide the stocks in the benchmark index intoK clusters and selects stocks that are closest to the center in each cluster as the constituent stocks of the portfolio. Our intensive experiment shows that this selection strategy has the ability to balance the trade-off between the performance and the diversity of the selected stocks.Specifically, the detailed process of our stock selection algorithm is listed in Algorithm 1.Algorithm 1: Stock selection algorithm: StockSelection D,K,R,τ,P.
Require:D: original dataset; K: the number of stocks in the portfolio; R: the desired number of features after dimensionality reduction; τ: the start time point for selection; P: the decision time interval for stock selection.Ensure:S∗: constituent stocks in the portfolio; D∗: the dataset consisting of the information of K constituent stocks in the portfolio.(1)
S⟵∅;(2)
S∗⟵∅;(3)
Perform mean-variance normalization on every feature of all stocks inD;(4)
D′⟵PCAD,R;(5)
fort=τ:τ+Pdo(6)
St⟵K−meansD′t,K;(7)
St⟵argmin∀s∈StDistances,sct;(8)
S⟵S∪St;(9)
end for(10)
fori=1:Kdo(11)
S∗⟵S∗∪argmax∀s∈SCountS,s;(12)
S⟵S−s;(13)
end for(14)
D∗⟵ExtractD′,S∗; returnS∗,D∗;As shown in Algorithm 1, the stock selection algorithm starts by performing mean-variance normalization on every feature in the original datasetD (line 3). After that, it applies a PCA algorithm [42] to reduce the dimensionality of D to R, where R is a small, positive integer given by a human expert (line 4). The idea here is to retain the important features containing as much as the variance of the dataset, while removing the insignificant features whose variance is near to zero.Given the time pointτ and the time interval P that are used to select the stocks, we repeat P times of applying a k-means clustering algorithm with cluster number K to generate P different sets of clusters, each of which represent the clustering result during time period τ,τ+P (line 6). For each time point t∈τ,τ+P, we find the stocks that are closest to the center of each cluster as the candidate constituent stocks of the portfolio (line 7), where the function Distances,sct measures the distance between a stock s and the center sct of a cluster. Once we get the candidate stocks in each time point, we put them together (line 8) and compute the total number of occurrences during τ,τ+P (line 11) and then find the stocks with the K-maximum number of occurrences (i.e., S∗) as the constituent stocks of the portfolio. Finally, the algorithm extracts the information for stocks in S∗ from the dataset D′ (line 14) and returns the two-tuple S∗,D∗. Note that the characteristic of this selection algorithm is that it can consider both the fundamentals and the price information for each stock over a period of time.


### 4.3. Investment Weight Estimation

After determiningK constituent stocks for the portfolio, we need to assign the investment weight for each constituent stock. In this study, we propose a long short-term memory (LSTM) network to estimate the investment weight for each constituent stock, as shown in Figure 3.Figure 3
The architecture of our LSTM model.As shown in Figure3, our LSTM networks are composed of an input layer, a hidden layers, and an output layer. The number of neurons in the input layer is equal to the number of explanatory variables (feature space) reduced in stock selection. The number of neurons in the output layer reflects the output space, i.e., K neurons in our case indicating the weight for each constituent stock in the portfolio in t+1. The main characteristic of LSTM networks is contained in the hidden layer consisting of so-called memory cells. Each of the memory cells has three gates maintaining and adjusting its cell state st: a forget gate ft, an input gate it, and an output gate ot.When processing an input sequence, its features are presented time point by time point to the LSTM network. Hereby, the input at each time pointt (in our case, the information of constituent stocks) is processed by the network as denoted in the equations above. Once the last element of the sequence has been processed, the final output for the whole sequence is returned. The detailed process is described as follows.Algorithm 2: Weight estimation algorithm: WeightEstimation D,Q,iter.
Require:D: the dataset consisting of information of K constituent stocks; Q: the length of a data sequence for training; iter: training iterations.Ensure:M∗: the LSTM model for weight estimation.(1)
M∗⟵RandomInit;(2)
TD⟵DataSplitD,Q;(3)
fori=1:iterdo(4)
Seq⟵RandomPickTD;(5)
M⟵LSTMSeq,M∗;(6)
M∗⟵argmin∀MLossM,f;(7)
end for returnM∗;The weight estimation algorithm first initializes the LSTM model with random parameters (line 1) and splits the datasetD into training dataset TD containing D−Q+1 continuous data sequences (line 2). During each iteration, it randomly picks a data sequence Seq from TD (line 3), generates a newer LSTM model M (line 4), and finally optimizes the model according to the loss function (lines 5 and 6). More specifically, the loss function f is defined as the weighted sum of TE and ER: f=α⋅TE+1−α⋅ER, and the ADAM optimizer [43] is used in the training process.


### 4.4. IntelliPortfolio Algorithm

We are now ready to describe our IntelliPortfolio algorithm in Algorithm 3. IntelliPortfolio first cleans the original dataset by removing stocks with missing data (line 1) and selectsK stocks to form the initial portfolio (line 2). After that, it obtains a LSTM-based weight estimation model using stock information on portfolio (line 3). To finish the final optimization, IntelliPortfolio constructs the test dataset DΔT by extracting the data with ΔT length of time interval from T−ΔT to T in D (line 4) and produces the final investment weights for constituent stocks according to M∗ and DΔT (line 5).Algorithm 3: The proposed IntelliPortfolio algorithm: IntelliPortfolio D,K,T.
Require:D: the original dataset; K: the number of stocks in the portfolio; T the decision time point.Ensure:W: the set of weight values of constituent stocks in the portfolio.(1)
Dc⟵DataCleanD;(2)
Dp⟵StockSelectionDc,K,R,τ,P;(3)
M∗⟵WeightEstimationDp,Q,iter;(4)
DΔT⟵ExtractDc,T−ΔT,T;(5)
W⟵LSTMM∗,DΔT; returnW;Note that, according to the definition of the EIT problem,D, T, and K are given. Our IntelliPortfolio algorithm contains seven hyperparameters, namely, R, τ, P, Q, α, iter, and ΔT, respectively, where(i)
R: the desired number of features after dimensionality reduction on D(ii)
τ: the start time point for stock selection(iii)
P: the time period for stock selection(iv)
Q: the length of a data sequence used for training a LSTM model(v)
α: the weight value for two-objectives TE and ER(vi)
iter: the training iterations of the LSTM model(vii)
ΔT: the time interval for final optimizationWe will report the values of these hyperparameters in Section5 and explain the basic principle for determining the values for some important hyperparameters.


## 4.1. Overview

Figure2 illustrates the detailed steps of IntelliPortfolio. IntelliPortfolio contains two phases: constituent stock selection and investment weight estimation. At the constituent stock selection phase, after normalizing the original dataset, we use a PCA-based algorithm to reduce the dimensionality of the original dataset and apply a k-means clustering algorithm to generate K clusters from the benchmark index and then add K stocks that are closest to the center in each cluster to the portfolio. At the investment weight estimation phase, we adopt a novel windowed-random sampling strategy to generate random samples with fixed-window size and apply the LSTM model to estimate the investment weight for each constituent stock, which finally finishes the construction of the portfolio.Figure 2
Overview of IntelliPortfolio approach.


## 4.2. Constituent Stock Selection

The first step of constructing a tracking portfolio is to selectK constituent stocks from the benchmark index consisting of N stocks. Previous studies on this problem include industry-based method [34], trading volume-based method [23], and autoencoder-based method [4]. Industry-based method takes into account of the information on industry, market capitalization, and trading amount for each stock. Such approach is interpretable and easy to understand, but fail to reflect the trend in stock market [1]. Trading volume-based method, by contrast, can indicate the fluctuation of stock price effectively, but ignores the fundamentals of a stock. Autoencoder-based method trains a deep encoder-decoder network by using the stock price dataset and can adaptively select K stocks with the largest and smallest training error. However, it suffer from the low performance issue when the benchmark index contains a large number of stocks.To deal with these issues, we propose a novel stock selection algorithm integrating PCA and clustering method. The key of the our algorithm is twofold. (1) It considers both the fundamentals and the price information for each stock by receiving all known features from a dataset and using a PCA algorithm to find out the major factors. (2) It uses a clustering algorithm to automatically divide the stocks in the benchmark index intoK clusters and selects stocks that are closest to the center in each cluster as the constituent stocks of the portfolio. Our intensive experiment shows that this selection strategy has the ability to balance the trade-off between the performance and the diversity of the selected stocks.Specifically, the detailed process of our stock selection algorithm is listed in Algorithm 1.Algorithm 1: Stock selection algorithm: StockSelection D,K,R,τ,P.
Require:D: original dataset; K: the number of stocks in the portfolio; R: the desired number of features after dimensionality reduction; τ: the start time point for selection; P: the decision time interval for stock selection.Ensure:S∗: constituent stocks in the portfolio; D∗: the dataset consisting of the information of K constituent stocks in the portfolio.(1)
S⟵∅;(2)
S∗⟵∅;(3)
Perform mean-variance normalization on every feature of all stocks inD;(4)
D′⟵PCAD,R;(5)
fort=τ:τ+Pdo(6)
St⟵K−meansD′t,K;(7)
St⟵argmin∀s∈StDistances,sct;(8)
S⟵S∪St;(9)
end for(10)
fori=1:Kdo(11)
S∗⟵S∗∪argmax∀s∈SCountS,s;(12)
S⟵S−s;(13)
end for(14)
D∗⟵ExtractD′,S∗; returnS∗,D∗;As shown in Algorithm 1, the stock selection algorithm starts by performing mean-variance normalization on every feature in the original datasetD (line 3). After that, it applies a PCA algorithm [42] to reduce the dimensionality of D to R, where R is a small, positive integer given by a human expert (line 4). The idea here is to retain the important features containing as much as the variance of the dataset, while removing the insignificant features whose variance is near to zero.Given the time pointτ and the time interval P that are used to select the stocks, we repeat P times of applying a k-means clustering algorithm with cluster number K to generate P different sets of clusters, each of which represent the clustering result during time period τ,τ+P (line 6). For each time point t∈τ,τ+P, we find the stocks that are closest to the center of each cluster as the candidate constituent stocks of the portfolio (line 7), where the function Distances,sct measures the distance between a stock s and the center sct of a cluster. Once we get the candidate stocks in each time point, we put them together (line 8) and compute the total number of occurrences during τ,τ+P (line 11) and then find the stocks with the K-maximum number of occurrences (i.e., S∗) as the constituent stocks of the portfolio. Finally, the algorithm extracts the information for stocks in S∗ from the dataset D′ (line 14) and returns the two-tuple S∗,D∗. Note that the characteristic of this selection algorithm is that it can consider both the fundamentals and the price information for each stock over a period of time.


## 4.3. Investment Weight Estimation

After determiningK constituent stocks for the portfolio, we need to assign the investment weight for each constituent stock. In this study, we propose a long short-term memory (LSTM) network to estimate the investment weight for each constituent stock, as shown in Figure 3.Figure 3
The architecture of our LSTM model.As shown in Figure3, our LSTM networks are composed of an input layer, a hidden layers, and an output layer. The number of neurons in the input layer is equal to the number of explanatory variables (feature space) reduced in stock selection. The number of neurons in the output layer reflects the output space, i.e., K neurons in our case indicating the weight for each constituent stock in the portfolio in t+1. The main characteristic of LSTM networks is contained in the hidden layer consisting of so-called memory cells. Each of the memory cells has three gates maintaining and adjusting its cell state st: a forget gate ft, an input gate it, and an output gate ot.When processing an input sequence, its features are presented time point by time point to the LSTM network. Hereby, the input at each time pointt (in our case, the information of constituent stocks) is processed by the network as denoted in the equations above. Once the last element of the sequence has been processed, the final output for the whole sequence is returned. The detailed process is described as follows.Algorithm 2: Weight estimation algorithm: WeightEstimation D,Q,iter.
Require:D: the dataset consisting of information of K constituent stocks; Q: the length of a data sequence for training; iter: training iterations.Ensure:M∗: the LSTM model for weight estimation.(1)
M∗⟵RandomInit;(2)
TD⟵DataSplitD,Q;(3)
fori=1:iterdo(4)
Seq⟵RandomPickTD;(5)
M⟵LSTMSeq,M∗;(6)
M∗⟵argmin∀MLossM,f;(7)
end for returnM∗;The weight estimation algorithm first initializes the LSTM model with random parameters (line 1) and splits the datasetD into training dataset TD containing D−Q+1 continuous data sequences (line 2). During each iteration, it randomly picks a data sequence Seq from TD (line 3), generates a newer LSTM model M (line 4), and finally optimizes the model according to the loss function (lines 5 and 6). More specifically, the loss function f is defined as the weighted sum of TE and ER: f=α⋅TE+1−α⋅ER, and the ADAM optimizer [43] is used in the training process.


## 4.4. IntelliPortfolio Algorithm

We are now ready to describe our IntelliPortfolio algorithm in Algorithm 3. IntelliPortfolio first cleans the original dataset by removing stocks with missing data (line 1) and selectsK stocks to form the initial portfolio (line 2). After that, it obtains a LSTM-based weight estimation model using stock information on portfolio (line 3). To finish the final optimization, IntelliPortfolio constructs the test dataset DΔT by extracting the data with ΔT length of time interval from T−ΔT to T in D (line 4) and produces the final investment weights for constituent stocks according to M∗ and DΔT (line 5).Algorithm 3: The proposed IntelliPortfolio algorithm: IntelliPortfolio D,K,T.
Require:D: the original dataset; K: the number of stocks in the portfolio; T the decision time point.Ensure:W: the set of weight values of constituent stocks in the portfolio.(1)
Dc⟵DataCleanD;(2)
Dp⟵StockSelectionDc,K,R,τ,P;(3)
M∗⟵WeightEstimationDp,Q,iter;(4)
DΔT⟵ExtractDc,T−ΔT,T;(5)
W⟵LSTMM∗,DΔT; returnW;Note that, according to the definition of the EIT problem,D, T, and K are given. Our IntelliPortfolio algorithm contains seven hyperparameters, namely, R, τ, P, Q, α, iter, and ΔT, respectively, where(i)
R: the desired number of features after dimensionality reduction on D(ii)
τ: the start time point for stock selection(iii)
P: the time period for stock selection(iv)
Q: the length of a data sequence used for training a LSTM model(v)
α: the weight value for two-objectives TE and ER(vi)
iter: the training iterations of the LSTM model(vii)
ΔT: the time interval for final optimizationWe will report the values of these hyperparameters in Section5 and explain the basic principle for determining the values for some important hyperparameters.


## 5. Experiments

We have implemented our approach and conducted extensive experiments on five real-world datasets of international stock market. The source code and the data can be found inhttps://github.com/anon4review/IntelliPortfolio. In this section, we first describe our experiment setup and then present the experimental results to prove the efficiency and effectiveness of the proposed approach.


### 5.1. Experimental Settings

#### 5.1.1. Datasets and Running Environment

We choose five well-known stock indices in the international stock markets as our datasets to evaluate our IntelliPortfolio algorithm, namely, SSE constituent index (SSE180) [44], Dow Jones Industrial Average (DJIA) [45], Financial Time Stock Exchange 100 Index (FTSE100) [46], Hang Seng Index (HSI) [47], and Nikkei stock average (Nikkei225) [48]:(i)
SSE180 chooses 180 sample stocks from all 1000 A-share stocks registered Shanghai, China. It reflects the profile and operation of the Shanghai stock market.(ii)
DJIA consists of stocks of 30 representative large industrial and commercial companies, which can roughly reflect the price level of the entire industrial and commercial stocks in the United States.(iii)
FTSE100 contains 100 representative stocks of influential companies in European. It is one of the most important indicators for global investors to observe the trend of European stocks [21].(iv)
HSI is an important indicator of Hong Kong stock market prices and represents 63% of the 12-month average market capitalization rate of all listed companies on the Hong Kong Stock Exchange; it contains 50 representative stocks.(v)
Nikkei225 contains 225 stocks with good continuity and comparability. It is the most common and reliable indicator for examining and analyzing the long-term evolution and dynamics of the Japanese stock market.The available features of each dataset are shown in Table1.Table 1
Features of each dataset.
SSE180Other four indicesOpening priceClosing priceHighest priceLowest priceAverage priceVolumeTurnoverOpening priceUps and downsClosing priceQuote changeHighest priceHand turnover rateLowest priceA-share market capitalizationVolumeThe total market capitalizationAdjusted closing priceA-share tradable share capitalTotal share capitalPrice-to-earnings ratio (PE)Price-to-book ratio (PB)Price-to-sales ratio (PS)Price cash flow ratio (PCF)For each index, we extract ten-year (2431 trading days) data from 2009 to 2018 and remove stocks with missing data. As a result, we have 111 stocks in SSE180, 28 in DJIA, 58 in FTSE100, 39 in HSI, and 201 in Nikkei225. For each dataset, we choose 2371 trading days as the in-sample period (i.e., training dataset) and use the last 60 trading days as out-of-sample period (i.e., test dataset).Table2 lists the number of constituent stocks (i.e., K) in the result portfolio.Table 2
Number of constituent stocks in the portfolio.
DatasetsNo. of constituent stocksKSSE18011110DJIA285FTSE100585HSI395Nikkei22520120All experiments run on a computer equipped with four processors, 8GiB RAM, 512 GB disk, and running windows 10. To ensure consistency, we run each algorithm five times and calculate the average of these five runs.


#### 5.1.2. Performance Metrics

We use four metrics to evaluate the performance of the algorithms, namely, tracking errorTE [4, 16, 23], excess return ER [21], information ratio IR [2, 49], and the Sharp ratio SR [34, 36, 38], defined as follows:(i)
Tracking errorTE↓: the performance difference between the portfolio and the benchmark index, which measures the tracking accuracy of the portfolio. We have defined TE in equation (3) and want to minimize the value of TE.(ii)
Excess returnER↑: the average excess return per period achieved by the tracking portfolio compared to its benchmark index, which is defined in equation (4). We want to maximize the value of ER.(iii)
Information ratioIR↑: a measurement of portfolio returns beyond the returns of a benchmark index, compared to the volatility of those returns. IR during the time interval 1,T can be defined as(10)IR=ERTE,whereER is the excess return and TE is the tracking error. We want to maximize the value of SR.(iv)
Sharp ratioSR↑: a well-known measurement that indicates the performance of an investment (i.e. the portfolio in our case) compared to a risk-free asset, after adjusting for its risk. SR during the time interval 1,T is defined as(11)SR=Ertsrt,t∈1,T,whereE is expectation and s is the standard variance. We want to maximize the value of SR.The performance improvement of an algorithm over a baseline algorithm in comparison is defined as(12)Impbaseline=P−PbaselinePbaseline⋅100%,where Pbaseline is the performance of the baseline algorithm and P is that of the algorithm being evaluated.


#### 5.1.3. Baseline Algorithms and Hyperparameters

Because IntelliPortfolio is a two-step optimization approach consisting of stock selection and weight estimation algorithms, we need to evaluate the performance of our stock selection algorithm first. Specifically, we compare it with four state-of-the-art methods, namely, random method (Random), industry-based method (Industry) [34], trading volume-based method (Volume) [23], and autoencoder-based method (Autoencoder) [4]. We provide a brief description for each method as follows and report its hyperparameters (including IntelliPortfolio) in Table 3.Random method (Random) randomly selects K constituent stocks from the benchmark indexIndustry-based method (Industry) selects K constituent stocks from the benchmark index considering the industry, the market capitalization, and the trading amount information for each stock in the marketTrading volume-based method (Volume) chooses the top K stocks from the benchmark index by sorting the total trading volume from large to small during a fixed periodAutoencoder-based method (Autoencoder) trains a encoder-decoder network using the historical dataset and selects K stocks with the largest and smallest training errorTable 3
Hyperparameters for stock selection methods.
AlgorithmHyperparametersRandomN/AIndustryN/AVolumeN/AAutoencoderHiddenUnitsNum: 640; CodeUnitsNum: 300; LearningRate: 0.001; TrainNum: 2000; TrainEpoch: 1IntelliPortfolioR: 3; τ: T−120; P: 120Finally, to evaluate the overall performance of our IntelliPortfolio method, we compare it with five state-of-the-art algorithms, namely, genetic algorithm and recurrent reinforcement learning (GA-RRL) [39], deep deterministic policy gradient (DDPG) [35], recurrent reinforcement learning (RRL) [38], DPG [34], and heuristic genetic algorithm (HGA) [21]. We provide a brief description for each algorithm as follows and report its hyperparameters (including IntelliPortfolio) in Table 4.GA-RRL uses a genetic algorithm (GA) to improve the trading results of a RRL-type equity trading system. It takes the advantage of GA’s capability to select an optimal combination of technical indicators, fundamental indicators, and volatility indicators for improving out-of-sample trading performance.DDPG adopts a deep deterministic policy gradient algorithm to implement portfolio management, in which the agent takes the stock data during a fixed time interval and the current stock weights as the observed environment, and derives the weights of portfolio for the next day.RRL uses trading volume-based method to select constituent stocks of a portfolio and adopts the recurrent reinforcement learning and LSTM model to implement portfolio management.DPG is a financial-model-free reinforcement learning framework to provide a deep machine learning solution to the portfolio management problem. It consists of the Ensemble of Identical Independent Evaluators (EIIE) topology, a Portfolio-Vector Memory (PVM), an Online Stochastic Batch Learning (OSBL) scheme, and a fully exploiting and explicit reward function.HGA selects stocks and determines portfolio weights based on the genetic algorithm (GA) and uses a heuristic method to update the population.Table 4
Hyperparameters forEIT algorithms.
AlgorithmsHyperparametersGA-RRLSequenceStep:30; WindowLen:20; LearningRate: 0.0001; stddev: 0.05; ElitistsNum: 10; ChoosenEliNum: 4; TrainEpoch: 15; TradeEpoch: 10; PopulationSize: 50; GenerationNum: 20; CrossoverProb: 0.5; MutationProb: 0.2DDPGλ: 0.3; MaxEpisodes: 1000; MaxEpSteps: 200; LrA: 0.001; LrC: 0.002; γ: 0.9; τ: 0.1; MemoryCapacity: 1000; BatchSize: 32RRLLearningRate: 0.0001DPGTrainingSteps: 8000; LearningRate: 0.0001; BatchSize: 40; FeatureNum: 3HGAEpsilon: 0.01; delta: 0.5; WinLen: 300; gamma: 0.1; Lambda: 0.3,α: 2.0; PopuationSize: 100; LoopNum: 10000; CrossoverProb: 0.5; MutationProb: 0.5


### 5.2. Experiment Results

#### 5.2.1. Hyperparameter Estimation Results for Stock Selection Algorithm

Two important hyperparameters, namely,τ and P, are involved in our stock selection algorithm. τ represents the start time point for stock selection process, and P denotes the length of the time interval for stock selection. Specially, we divide each dataset into three subsets: a validation set containing 60 days of data, a test set consisting of 60 days of data, and a training set containing all of the remaining data. In our experiment, we choose time intervals of 60, 90, and 120 days for stock selection (i.e., P  = 60/90/120), as suggested in [1, 21, 38, 39]. For each time interval, we try the first, the middle, and the last time point as our start time point for stock selection process.Based on the above experiment design, we have performed 45 = 5∗ 3 ∗ 3 groups of experiments, and only report the results on SSE180 dataset in Table 5 due to length limitations. Detailed results can be found in our online repository.Table 5
Hyperparameter estimation results for stock selection algorithm.
τPTE↓ER↑SR↑IR↑1600.00198−0.00026−0.132400.951681900.002210.000860.387200.8758411200.002930.001420.484431.373341156600.002220.000060.027330.868751156900.00144−0.00045−0.308750.7304911561200.004280.000180.043021.058092251600.005410.001010.187151.560982221900.004950.000660.132931.4556121911200.004650.001150.247051.57182We can see from Table5 that the results during the last stages containing 120 days (i.e., τ = 2191 and P = 120, denoted as 2191-120) outperform other eight combinations by obtaining three out of four best values of our performance metrics, with the only exception of the TE. Considering the TE values obtained by these combinations are not significantly different and all others are, we can safely take TE as an unimportant metrics. Moreover, in terms of SR metric, which reflects both the risks and the benefits of a portfolio, the results of 2191-120 combination outperform others significantly.The above results are reasonable because of the following. (1) The latest time point can reflect the recent trend of stock market. This is consistent with the findings of many previous studies in [1, 23, 35]. (2) The longest period of time interval can fully reflect the trends of stock, which are in turn utilized by our LSTM model. In summary, we make a conclusion that we should use the latest 120 days of data for stock selection, which is adopted in the following experiments.


#### 5.2.2. Comparison Results with Different Stock Selection Algorithms

To prove the effectiveness and the robustness of our selection algorithm, we mix five stock selection algorithms (i.e., Random, Industry, Volume, Autoencoder, and IntelliPortfolio), fiveEIT algorithms requiring stock selection process (i.e., GA-RRL, DDPG, RRL, DPG, and IntelliPortfolio), and five dataset (i.e., SSE180, DJIA, FTSE100, HSI, and Nikkei225) together and conduct 225 groups of tests. Due to limited space, Table 6 shows the 25 groups of testing results on the SSE180 dataset and highlights the best values. For the complete experimental results, please check our online repository.Table 6
Results of different selection algorithms on the SSE180 dataset.
IntelliPortfolioSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.001161.765070.24298Random0.002000.000020.448140.01141Industry0.00215−0.001200.87021−0.55862Volume0.00171−0.000300.62009−0.17336Autoencoder0.004750.000551.265640.09968GA-RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.011030.000940.586420.11496Random0.005100.000500.244460.09727Industry0.00546−0.001440.35697−0.26416Volume0.004410.000110.354480.02391Autoencoder0.008180.000840.522520.07605DDPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.024310.000470.162690.01950Random0.003650.000120.078260.03227Industry0.00581−0.000170.05993−0.02978Volume0.00296−0.00006−0.23251−0.02252Autoencoder0.017850.00021−0.170500.01179RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.040020.001170.022980.01953Random0.01092−0.00011−0.01936−0.01017Industry0.01738−0.00008−0.03844−0.00483Volume0.010290.00019−0.049260.01857Autoencoder0.045930.000900.020320.00753DPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002660.00118−0.037300.36666Random0.00179−0.00024−0.14548−0.13338Industry0.00085−0.00018−0.36048−0.21024Volume0.001410.00008−0.171270.05529Autoencoder0.002250.00060−0.051510.26669We can see from Table6 that our stock selection algorithm outperforms other four algorithms on five EIT algorithms over four performance metrics, i.e., obtaining 14 out of 20 best values in all. Note that the volume algorithm outperforms other algorithms on TE metric; this is because it only considers the trading volume while choosing stocks, and stocks with large trading volume are influencing factors for index pricing. Although volume algorithm performs well on TE, it is underperforming in other three metrics. Another important observation from Table 6 is that our stock selection algorithm achieves more significant improvements over the other algorithms on the SR metric, which means our algorithm has better performance when considering the TE and ER metrics simultaneously. In summary, the above results indicate that our selection algorithm not only has better performance than others but also has strong generality and is suitable for many EIT algorithms.For a better illustration, we plot the four normalized performance metrics of five stock selection algorithms on SSE180 dataset in Figures4(a)–4(e), respectively. In each figure, the x-axis lists the five algorithms and the y-axis represents the measurements of the four performance metrics. We conclude from Figure 4 that our stock selection algorithm achieves stable improvements compared with the other five algorithms, and the improvements are more significant in SR and IR metrics.Figure 4
Results for stock selection algorithms.
(a)(b)(c)(d)(e)


#### 5.2.3. Overall Algorithm Performance Results

Finally, we compare our IntelliPortfolio algorithm with five state-of-the-artEIT algorithms on five international stock markets, and the results are listed in Table 7.Table 7
Final results on five datasets.
SSE180AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.000551.765060.19968DPG0.005595.68095e − 05−0.212280.09699RRL0.010290.00019−0.049260.01857DDPG0.024310.000470.162680.01950GA-RRL0.004410.000100.354480.02391HGA0.04434−0.010760.07013−0.24273Nikkei225AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.001140.001161.126800.05055DPG0.00096−0.00142−0.20583−1.48279RRL0.01669−0.00150−0.02886−0.08960DDPG0.010550.000330.133470.03162GA-RRL0.00483−0.000980.43392−0.20310HGA0.01521−0.01194−0.10225−0.78510HSIAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002870.000720.664670.25105DPG0.00109−0.00155−0.10316−1.42760RRL0.00694−0.00147−0.02697−0.21127DDPG0.002800.000060.088230.02068GA-RRL0.00185−0.001840.08630−0.99876HGA0.01133−0.010460.03701−0.92311DJIAAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.003750.000630.412090.16682DPG0.00167−0.00014−0.18196−0.08172RRL0.014340.00008−0.06911−0.00553DDPG0.01403−0.000480.13292−0.03438GA-RRL0.00289−0.002230.22810−0.77050HGA0.01046−0.00951−0.20269−0.90926FTSE100AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.00238−0.000020.43635−0.00683DPG0.00212−0.00080−0.07507−0.37783RRL0.02067−0.000280.00667−0.01370DDPG0.00156−0.00049−0.05788−0.31460GA-RRL0.00516−0.000600.40223−0.11589HGA0.01884−0.008550.07314−0.45402We can see from Table7 that IntelliPortfolio outperforms other five algorithms on five datasets over four performance metrics, i.e., obtaining 16 out of 20 best values in all. Specifically, in terms of ER, our algorithm achieves an average performance improvement of 178.90% over DPG, 29.3% over RRL, 260.90% over DDPG, 98.01% over GA-RRL, and 89.16% over HGA; in terms of SR, our algorithm achieves an average performance improvement of 665.97% over DPG, 364.57% over RRL, 136.47% over DDPG, 69.47% over GA-RRL, and 130.73% over HGA; in terms of IR, our algorithm achieves an average performance improvement of 120.20% over DPG, 98.54% over RRL, 8.78% over DDPG, 86.57% over GA-RRL, and 37.71% over HGA. Note that although DPG and DDPG algorithms outperform other algorithms on TE metric, they are still underperforming in other three metrics. Such results illustrates the significant and consistent performance superiority of the IntelliPortfolio algorithm in comparison with five state-of-the-art algorithms.Figure5 illustrates the average performance measurements of different algorithms. We observe from Figure 5 that IntelliPortfolio outperforms all other five algorithms, followed by GA-RRL, DDPG, PG, RRL, and HGA. The difference between IntelliPortfolio and other algorithms is significant, and all others are not. Such results indicate that IntelliPortfolio is stable and robust on different datasets in comparison with other algorithms.Figure 5
Average measurements of different algorithms on five databases.
(a)(b)(c)(d)


## 5.1. Experimental Settings

### 5.1.1. Datasets and Running Environment

We choose five well-known stock indices in the international stock markets as our datasets to evaluate our IntelliPortfolio algorithm, namely, SSE constituent index (SSE180) [44], Dow Jones Industrial Average (DJIA) [45], Financial Time Stock Exchange 100 Index (FTSE100) [46], Hang Seng Index (HSI) [47], and Nikkei stock average (Nikkei225) [48]:(i)
SSE180 chooses 180 sample stocks from all 1000 A-share stocks registered Shanghai, China. It reflects the profile and operation of the Shanghai stock market.(ii)
DJIA consists of stocks of 30 representative large industrial and commercial companies, which can roughly reflect the price level of the entire industrial and commercial stocks in the United States.(iii)
FTSE100 contains 100 representative stocks of influential companies in European. It is one of the most important indicators for global investors to observe the trend of European stocks [21].(iv)
HSI is an important indicator of Hong Kong stock market prices and represents 63% of the 12-month average market capitalization rate of all listed companies on the Hong Kong Stock Exchange; it contains 50 representative stocks.(v)
Nikkei225 contains 225 stocks with good continuity and comparability. It is the most common and reliable indicator for examining and analyzing the long-term evolution and dynamics of the Japanese stock market.The available features of each dataset are shown in Table1.Table 1
Features of each dataset.
SSE180Other four indicesOpening priceClosing priceHighest priceLowest priceAverage priceVolumeTurnoverOpening priceUps and downsClosing priceQuote changeHighest priceHand turnover rateLowest priceA-share market capitalizationVolumeThe total market capitalizationAdjusted closing priceA-share tradable share capitalTotal share capitalPrice-to-earnings ratio (PE)Price-to-book ratio (PB)Price-to-sales ratio (PS)Price cash flow ratio (PCF)For each index, we extract ten-year (2431 trading days) data from 2009 to 2018 and remove stocks with missing data. As a result, we have 111 stocks in SSE180, 28 in DJIA, 58 in FTSE100, 39 in HSI, and 201 in Nikkei225. For each dataset, we choose 2371 trading days as the in-sample period (i.e., training dataset) and use the last 60 trading days as out-of-sample period (i.e., test dataset).Table2 lists the number of constituent stocks (i.e., K) in the result portfolio.Table 2
Number of constituent stocks in the portfolio.
DatasetsNo. of constituent stocksKSSE18011110DJIA285FTSE100585HSI395Nikkei22520120All experiments run on a computer equipped with four processors, 8GiB RAM, 512 GB disk, and running windows 10. To ensure consistency, we run each algorithm five times and calculate the average of these five runs.


### 5.1.2. Performance Metrics

We use four metrics to evaluate the performance of the algorithms, namely, tracking errorTE [4, 16, 23], excess return ER [21], information ratio IR [2, 49], and the Sharp ratio SR [34, 36, 38], defined as follows:(i)
Tracking errorTE↓: the performance difference between the portfolio and the benchmark index, which measures the tracking accuracy of the portfolio. We have defined TE in equation (3) and want to minimize the value of TE.(ii)
Excess returnER↑: the average excess return per period achieved by the tracking portfolio compared to its benchmark index, which is defined in equation (4). We want to maximize the value of ER.(iii)
Information ratioIR↑: a measurement of portfolio returns beyond the returns of a benchmark index, compared to the volatility of those returns. IR during the time interval 1,T can be defined as(10)IR=ERTE,whereER is the excess return and TE is the tracking error. We want to maximize the value of SR.(iv)
Sharp ratioSR↑: a well-known measurement that indicates the performance of an investment (i.e. the portfolio in our case) compared to a risk-free asset, after adjusting for its risk. SR during the time interval 1,T is defined as(11)SR=Ertsrt,t∈1,T,whereE is expectation and s is the standard variance. We want to maximize the value of SR.The performance improvement of an algorithm over a baseline algorithm in comparison is defined as(12)Impbaseline=P−PbaselinePbaseline⋅100%,where Pbaseline is the performance of the baseline algorithm and P is that of the algorithm being evaluated.


### 5.1.3. Baseline Algorithms and Hyperparameters

Because IntelliPortfolio is a two-step optimization approach consisting of stock selection and weight estimation algorithms, we need to evaluate the performance of our stock selection algorithm first. Specifically, we compare it with four state-of-the-art methods, namely, random method (Random), industry-based method (Industry) [34], trading volume-based method (Volume) [23], and autoencoder-based method (Autoencoder) [4]. We provide a brief description for each method as follows and report its hyperparameters (including IntelliPortfolio) in Table 3.Random method (Random) randomly selects K constituent stocks from the benchmark indexIndustry-based method (Industry) selects K constituent stocks from the benchmark index considering the industry, the market capitalization, and the trading amount information for each stock in the marketTrading volume-based method (Volume) chooses the top K stocks from the benchmark index by sorting the total trading volume from large to small during a fixed periodAutoencoder-based method (Autoencoder) trains a encoder-decoder network using the historical dataset and selects K stocks with the largest and smallest training errorTable 3
Hyperparameters for stock selection methods.
AlgorithmHyperparametersRandomN/AIndustryN/AVolumeN/AAutoencoderHiddenUnitsNum: 640; CodeUnitsNum: 300; LearningRate: 0.001; TrainNum: 2000; TrainEpoch: 1IntelliPortfolioR: 3; τ: T−120; P: 120Finally, to evaluate the overall performance of our IntelliPortfolio method, we compare it with five state-of-the-art algorithms, namely, genetic algorithm and recurrent reinforcement learning (GA-RRL) [39], deep deterministic policy gradient (DDPG) [35], recurrent reinforcement learning (RRL) [38], DPG [34], and heuristic genetic algorithm (HGA) [21]. We provide a brief description for each algorithm as follows and report its hyperparameters (including IntelliPortfolio) in Table 4.GA-RRL uses a genetic algorithm (GA) to improve the trading results of a RRL-type equity trading system. It takes the advantage of GA’s capability to select an optimal combination of technical indicators, fundamental indicators, and volatility indicators for improving out-of-sample trading performance.DDPG adopts a deep deterministic policy gradient algorithm to implement portfolio management, in which the agent takes the stock data during a fixed time interval and the current stock weights as the observed environment, and derives the weights of portfolio for the next day.RRL uses trading volume-based method to select constituent stocks of a portfolio and adopts the recurrent reinforcement learning and LSTM model to implement portfolio management.DPG is a financial-model-free reinforcement learning framework to provide a deep machine learning solution to the portfolio management problem. It consists of the Ensemble of Identical Independent Evaluators (EIIE) topology, a Portfolio-Vector Memory (PVM), an Online Stochastic Batch Learning (OSBL) scheme, and a fully exploiting and explicit reward function.HGA selects stocks and determines portfolio weights based on the genetic algorithm (GA) and uses a heuristic method to update the population.Table 4
Hyperparameters forEIT algorithms.
AlgorithmsHyperparametersGA-RRLSequenceStep:30; WindowLen:20; LearningRate: 0.0001; stddev: 0.05; ElitistsNum: 10; ChoosenEliNum: 4; TrainEpoch: 15; TradeEpoch: 10; PopulationSize: 50; GenerationNum: 20; CrossoverProb: 0.5; MutationProb: 0.2DDPGλ: 0.3; MaxEpisodes: 1000; MaxEpSteps: 200; LrA: 0.001; LrC: 0.002; γ: 0.9; τ: 0.1; MemoryCapacity: 1000; BatchSize: 32RRLLearningRate: 0.0001DPGTrainingSteps: 8000; LearningRate: 0.0001; BatchSize: 40; FeatureNum: 3HGAEpsilon: 0.01; delta: 0.5; WinLen: 300; gamma: 0.1; Lambda: 0.3,α: 2.0; PopuationSize: 100; LoopNum: 10000; CrossoverProb: 0.5; MutationProb: 0.5


## 5.1.1. Datasets and Running Environment

We choose five well-known stock indices in the international stock markets as our datasets to evaluate our IntelliPortfolio algorithm, namely, SSE constituent index (SSE180) [44], Dow Jones Industrial Average (DJIA) [45], Financial Time Stock Exchange 100 Index (FTSE100) [46], Hang Seng Index (HSI) [47], and Nikkei stock average (Nikkei225) [48]:(i)
SSE180 chooses 180 sample stocks from all 1000 A-share stocks registered Shanghai, China. It reflects the profile and operation of the Shanghai stock market.(ii)
DJIA consists of stocks of 30 representative large industrial and commercial companies, which can roughly reflect the price level of the entire industrial and commercial stocks in the United States.(iii)
FTSE100 contains 100 representative stocks of influential companies in European. It is one of the most important indicators for global investors to observe the trend of European stocks [21].(iv)
HSI is an important indicator of Hong Kong stock market prices and represents 63% of the 12-month average market capitalization rate of all listed companies on the Hong Kong Stock Exchange; it contains 50 representative stocks.(v)
Nikkei225 contains 225 stocks with good continuity and comparability. It is the most common and reliable indicator for examining and analyzing the long-term evolution and dynamics of the Japanese stock market.The available features of each dataset are shown in Table1.Table 1
Features of each dataset.
SSE180Other four indicesOpening priceClosing priceHighest priceLowest priceAverage priceVolumeTurnoverOpening priceUps and downsClosing priceQuote changeHighest priceHand turnover rateLowest priceA-share market capitalizationVolumeThe total market capitalizationAdjusted closing priceA-share tradable share capitalTotal share capitalPrice-to-earnings ratio (PE)Price-to-book ratio (PB)Price-to-sales ratio (PS)Price cash flow ratio (PCF)For each index, we extract ten-year (2431 trading days) data from 2009 to 2018 and remove stocks with missing data. As a result, we have 111 stocks in SSE180, 28 in DJIA, 58 in FTSE100, 39 in HSI, and 201 in Nikkei225. For each dataset, we choose 2371 trading days as the in-sample period (i.e., training dataset) and use the last 60 trading days as out-of-sample period (i.e., test dataset).Table2 lists the number of constituent stocks (i.e., K) in the result portfolio.Table 2
Number of constituent stocks in the portfolio.
DatasetsNo. of constituent stocksKSSE18011110DJIA285FTSE100585HSI395Nikkei22520120All experiments run on a computer equipped with four processors, 8GiB RAM, 512 GB disk, and running windows 10. To ensure consistency, we run each algorithm five times and calculate the average of these five runs.


## 5.1.2. Performance Metrics

We use four metrics to evaluate the performance of the algorithms, namely, tracking errorTE [4, 16, 23], excess return ER [21], information ratio IR [2, 49], and the Sharp ratio SR [34, 36, 38], defined as follows:(i)
Tracking errorTE↓: the performance difference between the portfolio and the benchmark index, which measures the tracking accuracy of the portfolio. We have defined TE in equation (3) and want to minimize the value of TE.(ii)
Excess returnER↑: the average excess return per period achieved by the tracking portfolio compared to its benchmark index, which is defined in equation (4). We want to maximize the value of ER.(iii)
Information ratioIR↑: a measurement of portfolio returns beyond the returns of a benchmark index, compared to the volatility of those returns. IR during the time interval 1,T can be defined as(10)IR=ERTE,whereER is the excess return and TE is the tracking error. We want to maximize the value of SR.(iv)
Sharp ratioSR↑: a well-known measurement that indicates the performance of an investment (i.e. the portfolio in our case) compared to a risk-free asset, after adjusting for its risk. SR during the time interval 1,T is defined as(11)SR=Ertsrt,t∈1,T,whereE is expectation and s is the standard variance. We want to maximize the value of SR.The performance improvement of an algorithm over a baseline algorithm in comparison is defined as(12)Impbaseline=P−PbaselinePbaseline⋅100%,where Pbaseline is the performance of the baseline algorithm and P is that of the algorithm being evaluated.


## 5.1.3. Baseline Algorithms and Hyperparameters

Because IntelliPortfolio is a two-step optimization approach consisting of stock selection and weight estimation algorithms, we need to evaluate the performance of our stock selection algorithm first. Specifically, we compare it with four state-of-the-art methods, namely, random method (Random), industry-based method (Industry) [34], trading volume-based method (Volume) [23], and autoencoder-based method (Autoencoder) [4]. We provide a brief description for each method as follows and report its hyperparameters (including IntelliPortfolio) in Table 3.Random method (Random) randomly selects K constituent stocks from the benchmark indexIndustry-based method (Industry) selects K constituent stocks from the benchmark index considering the industry, the market capitalization, and the trading amount information for each stock in the marketTrading volume-based method (Volume) chooses the top K stocks from the benchmark index by sorting the total trading volume from large to small during a fixed periodAutoencoder-based method (Autoencoder) trains a encoder-decoder network using the historical dataset and selects K stocks with the largest and smallest training errorTable 3
Hyperparameters for stock selection methods.
AlgorithmHyperparametersRandomN/AIndustryN/AVolumeN/AAutoencoderHiddenUnitsNum: 640; CodeUnitsNum: 300; LearningRate: 0.001; TrainNum: 2000; TrainEpoch: 1IntelliPortfolioR: 3; τ: T−120; P: 120Finally, to evaluate the overall performance of our IntelliPortfolio method, we compare it with five state-of-the-art algorithms, namely, genetic algorithm and recurrent reinforcement learning (GA-RRL) [39], deep deterministic policy gradient (DDPG) [35], recurrent reinforcement learning (RRL) [38], DPG [34], and heuristic genetic algorithm (HGA) [21]. We provide a brief description for each algorithm as follows and report its hyperparameters (including IntelliPortfolio) in Table 4.GA-RRL uses a genetic algorithm (GA) to improve the trading results of a RRL-type equity trading system. It takes the advantage of GA’s capability to select an optimal combination of technical indicators, fundamental indicators, and volatility indicators for improving out-of-sample trading performance.DDPG adopts a deep deterministic policy gradient algorithm to implement portfolio management, in which the agent takes the stock data during a fixed time interval and the current stock weights as the observed environment, and derives the weights of portfolio for the next day.RRL uses trading volume-based method to select constituent stocks of a portfolio and adopts the recurrent reinforcement learning and LSTM model to implement portfolio management.DPG is a financial-model-free reinforcement learning framework to provide a deep machine learning solution to the portfolio management problem. It consists of the Ensemble of Identical Independent Evaluators (EIIE) topology, a Portfolio-Vector Memory (PVM), an Online Stochastic Batch Learning (OSBL) scheme, and a fully exploiting and explicit reward function.HGA selects stocks and determines portfolio weights based on the genetic algorithm (GA) and uses a heuristic method to update the population.Table 4
Hyperparameters forEIT algorithms.
AlgorithmsHyperparametersGA-RRLSequenceStep:30; WindowLen:20; LearningRate: 0.0001; stddev: 0.05; ElitistsNum: 10; ChoosenEliNum: 4; TrainEpoch: 15; TradeEpoch: 10; PopulationSize: 50; GenerationNum: 20; CrossoverProb: 0.5; MutationProb: 0.2DDPGλ: 0.3; MaxEpisodes: 1000; MaxEpSteps: 200; LrA: 0.001; LrC: 0.002; γ: 0.9; τ: 0.1; MemoryCapacity: 1000; BatchSize: 32RRLLearningRate: 0.0001DPGTrainingSteps: 8000; LearningRate: 0.0001; BatchSize: 40; FeatureNum: 3HGAEpsilon: 0.01; delta: 0.5; WinLen: 300; gamma: 0.1; Lambda: 0.3,α: 2.0; PopuationSize: 100; LoopNum: 10000; CrossoverProb: 0.5; MutationProb: 0.5


## 5.2. Experiment Results

### 5.2.1. Hyperparameter Estimation Results for Stock Selection Algorithm

Two important hyperparameters, namely,τ and P, are involved in our stock selection algorithm. τ represents the start time point for stock selection process, and P denotes the length of the time interval for stock selection. Specially, we divide each dataset into three subsets: a validation set containing 60 days of data, a test set consisting of 60 days of data, and a training set containing all of the remaining data. In our experiment, we choose time intervals of 60, 90, and 120 days for stock selection (i.e., P  = 60/90/120), as suggested in [1, 21, 38, 39]. For each time interval, we try the first, the middle, and the last time point as our start time point for stock selection process.Based on the above experiment design, we have performed 45 = 5∗ 3 ∗ 3 groups of experiments, and only report the results on SSE180 dataset in Table 5 due to length limitations. Detailed results can be found in our online repository.Table 5
Hyperparameter estimation results for stock selection algorithm.
τPTE↓ER↑SR↑IR↑1600.00198−0.00026−0.132400.951681900.002210.000860.387200.8758411200.002930.001420.484431.373341156600.002220.000060.027330.868751156900.00144−0.00045−0.308750.7304911561200.004280.000180.043021.058092251600.005410.001010.187151.560982221900.004950.000660.132931.4556121911200.004650.001150.247051.57182We can see from Table5 that the results during the last stages containing 120 days (i.e., τ = 2191 and P = 120, denoted as 2191-120) outperform other eight combinations by obtaining three out of four best values of our performance metrics, with the only exception of the TE. Considering the TE values obtained by these combinations are not significantly different and all others are, we can safely take TE as an unimportant metrics. Moreover, in terms of SR metric, which reflects both the risks and the benefits of a portfolio, the results of 2191-120 combination outperform others significantly.The above results are reasonable because of the following. (1) The latest time point can reflect the recent trend of stock market. This is consistent with the findings of many previous studies in [1, 23, 35]. (2) The longest period of time interval can fully reflect the trends of stock, which are in turn utilized by our LSTM model. In summary, we make a conclusion that we should use the latest 120 days of data for stock selection, which is adopted in the following experiments.


### 5.2.2. Comparison Results with Different Stock Selection Algorithms

To prove the effectiveness and the robustness of our selection algorithm, we mix five stock selection algorithms (i.e., Random, Industry, Volume, Autoencoder, and IntelliPortfolio), fiveEIT algorithms requiring stock selection process (i.e., GA-RRL, DDPG, RRL, DPG, and IntelliPortfolio), and five dataset (i.e., SSE180, DJIA, FTSE100, HSI, and Nikkei225) together and conduct 225 groups of tests. Due to limited space, Table 6 shows the 25 groups of testing results on the SSE180 dataset and highlights the best values. For the complete experimental results, please check our online repository.Table 6
Results of different selection algorithms on the SSE180 dataset.
IntelliPortfolioSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.001161.765070.24298Random0.002000.000020.448140.01141Industry0.00215−0.001200.87021−0.55862Volume0.00171−0.000300.62009−0.17336Autoencoder0.004750.000551.265640.09968GA-RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.011030.000940.586420.11496Random0.005100.000500.244460.09727Industry0.00546−0.001440.35697−0.26416Volume0.004410.000110.354480.02391Autoencoder0.008180.000840.522520.07605DDPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.024310.000470.162690.01950Random0.003650.000120.078260.03227Industry0.00581−0.000170.05993−0.02978Volume0.00296−0.00006−0.23251−0.02252Autoencoder0.017850.00021−0.170500.01179RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.040020.001170.022980.01953Random0.01092−0.00011−0.01936−0.01017Industry0.01738−0.00008−0.03844−0.00483Volume0.010290.00019−0.049260.01857Autoencoder0.045930.000900.020320.00753DPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002660.00118−0.037300.36666Random0.00179−0.00024−0.14548−0.13338Industry0.00085−0.00018−0.36048−0.21024Volume0.001410.00008−0.171270.05529Autoencoder0.002250.00060−0.051510.26669We can see from Table6 that our stock selection algorithm outperforms other four algorithms on five EIT algorithms over four performance metrics, i.e., obtaining 14 out of 20 best values in all. Note that the volume algorithm outperforms other algorithms on TE metric; this is because it only considers the trading volume while choosing stocks, and stocks with large trading volume are influencing factors for index pricing. Although volume algorithm performs well on TE, it is underperforming in other three metrics. Another important observation from Table 6 is that our stock selection algorithm achieves more significant improvements over the other algorithms on the SR metric, which means our algorithm has better performance when considering the TE and ER metrics simultaneously. In summary, the above results indicate that our selection algorithm not only has better performance than others but also has strong generality and is suitable for many EIT algorithms.For a better illustration, we plot the four normalized performance metrics of five stock selection algorithms on SSE180 dataset in Figures4(a)–4(e), respectively. In each figure, the x-axis lists the five algorithms and the y-axis represents the measurements of the four performance metrics. We conclude from Figure 4 that our stock selection algorithm achieves stable improvements compared with the other five algorithms, and the improvements are more significant in SR and IR metrics.Figure 4
Results for stock selection algorithms.
(a)(b)(c)(d)(e)


### 5.2.3. Overall Algorithm Performance Results

Finally, we compare our IntelliPortfolio algorithm with five state-of-the-artEIT algorithms on five international stock markets, and the results are listed in Table 7.Table 7
Final results on five datasets.
SSE180AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.000551.765060.19968DPG0.005595.68095e − 05−0.212280.09699RRL0.010290.00019−0.049260.01857DDPG0.024310.000470.162680.01950GA-RRL0.004410.000100.354480.02391HGA0.04434−0.010760.07013−0.24273Nikkei225AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.001140.001161.126800.05055DPG0.00096−0.00142−0.20583−1.48279RRL0.01669−0.00150−0.02886−0.08960DDPG0.010550.000330.133470.03162GA-RRL0.00483−0.000980.43392−0.20310HGA0.01521−0.01194−0.10225−0.78510HSIAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002870.000720.664670.25105DPG0.00109−0.00155−0.10316−1.42760RRL0.00694−0.00147−0.02697−0.21127DDPG0.002800.000060.088230.02068GA-RRL0.00185−0.001840.08630−0.99876HGA0.01133−0.010460.03701−0.92311DJIAAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.003750.000630.412090.16682DPG0.00167−0.00014−0.18196−0.08172RRL0.014340.00008−0.06911−0.00553DDPG0.01403−0.000480.13292−0.03438GA-RRL0.00289−0.002230.22810−0.77050HGA0.01046−0.00951−0.20269−0.90926FTSE100AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.00238−0.000020.43635−0.00683DPG0.00212−0.00080−0.07507−0.37783RRL0.02067−0.000280.00667−0.01370DDPG0.00156−0.00049−0.05788−0.31460GA-RRL0.00516−0.000600.40223−0.11589HGA0.01884−0.008550.07314−0.45402We can see from Table7 that IntelliPortfolio outperforms other five algorithms on five datasets over four performance metrics, i.e., obtaining 16 out of 20 best values in all. Specifically, in terms of ER, our algorithm achieves an average performance improvement of 178.90% over DPG, 29.3% over RRL, 260.90% over DDPG, 98.01% over GA-RRL, and 89.16% over HGA; in terms of SR, our algorithm achieves an average performance improvement of 665.97% over DPG, 364.57% over RRL, 136.47% over DDPG, 69.47% over GA-RRL, and 130.73% over HGA; in terms of IR, our algorithm achieves an average performance improvement of 120.20% over DPG, 98.54% over RRL, 8.78% over DDPG, 86.57% over GA-RRL, and 37.71% over HGA. Note that although DPG and DDPG algorithms outperform other algorithms on TE metric, they are still underperforming in other three metrics. Such results illustrates the significant and consistent performance superiority of the IntelliPortfolio algorithm in comparison with five state-of-the-art algorithms.Figure5 illustrates the average performance measurements of different algorithms. We observe from Figure 5 that IntelliPortfolio outperforms all other five algorithms, followed by GA-RRL, DDPG, PG, RRL, and HGA. The difference between IntelliPortfolio and other algorithms is significant, and all others are not. Such results indicate that IntelliPortfolio is stable and robust on different datasets in comparison with other algorithms.Figure 5
Average measurements of different algorithms on five databases.
(a)(b)(c)(d)


## 5.2.1. Hyperparameter Estimation Results for Stock Selection Algorithm

Two important hyperparameters, namely,τ and P, are involved in our stock selection algorithm. τ represents the start time point for stock selection process, and P denotes the length of the time interval for stock selection. Specially, we divide each dataset into three subsets: a validation set containing 60 days of data, a test set consisting of 60 days of data, and a training set containing all of the remaining data. In our experiment, we choose time intervals of 60, 90, and 120 days for stock selection (i.e., P  = 60/90/120), as suggested in [1, 21, 38, 39]. For each time interval, we try the first, the middle, and the last time point as our start time point for stock selection process.Based on the above experiment design, we have performed 45 = 5∗ 3 ∗ 3 groups of experiments, and only report the results on SSE180 dataset in Table 5 due to length limitations. Detailed results can be found in our online repository.Table 5
Hyperparameter estimation results for stock selection algorithm.
τPTE↓ER↑SR↑IR↑1600.00198−0.00026−0.132400.951681900.002210.000860.387200.8758411200.002930.001420.484431.373341156600.002220.000060.027330.868751156900.00144−0.00045−0.308750.7304911561200.004280.000180.043021.058092251600.005410.001010.187151.560982221900.004950.000660.132931.4556121911200.004650.001150.247051.57182We can see from Table5 that the results during the last stages containing 120 days (i.e., τ = 2191 and P = 120, denoted as 2191-120) outperform other eight combinations by obtaining three out of four best values of our performance metrics, with the only exception of the TE. Considering the TE values obtained by these combinations are not significantly different and all others are, we can safely take TE as an unimportant metrics. Moreover, in terms of SR metric, which reflects both the risks and the benefits of a portfolio, the results of 2191-120 combination outperform others significantly.The above results are reasonable because of the following. (1) The latest time point can reflect the recent trend of stock market. This is consistent with the findings of many previous studies in [1, 23, 35]. (2) The longest period of time interval can fully reflect the trends of stock, which are in turn utilized by our LSTM model. In summary, we make a conclusion that we should use the latest 120 days of data for stock selection, which is adopted in the following experiments.


## 5.2.2. Comparison Results with Different Stock Selection Algorithms

To prove the effectiveness and the robustness of our selection algorithm, we mix five stock selection algorithms (i.e., Random, Industry, Volume, Autoencoder, and IntelliPortfolio), fiveEIT algorithms requiring stock selection process (i.e., GA-RRL, DDPG, RRL, DPG, and IntelliPortfolio), and five dataset (i.e., SSE180, DJIA, FTSE100, HSI, and Nikkei225) together and conduct 225 groups of tests. Due to limited space, Table 6 shows the 25 groups of testing results on the SSE180 dataset and highlights the best values. For the complete experimental results, please check our online repository.Table 6
Results of different selection algorithms on the SSE180 dataset.
IntelliPortfolioSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.001161.765070.24298Random0.002000.000020.448140.01141Industry0.00215−0.001200.87021−0.55862Volume0.00171−0.000300.62009−0.17336Autoencoder0.004750.000551.265640.09968GA-RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.011030.000940.586420.11496Random0.005100.000500.244460.09727Industry0.00546−0.001440.35697−0.26416Volume0.004410.000110.354480.02391Autoencoder0.008180.000840.522520.07605DDPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.024310.000470.162690.01950Random0.003650.000120.078260.03227Industry0.00581−0.000170.05993−0.02978Volume0.00296−0.00006−0.23251−0.02252Autoencoder0.017850.00021−0.170500.01179RRLSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.040020.001170.022980.01953Random0.01092−0.00011−0.01936−0.01017Industry0.01738−0.00008−0.03844−0.00483Volume0.010290.00019−0.049260.01857Autoencoder0.045930.000900.020320.00753DPGSelection algorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002660.00118−0.037300.36666Random0.00179−0.00024−0.14548−0.13338Industry0.00085−0.00018−0.36048−0.21024Volume0.001410.00008−0.171270.05529Autoencoder0.002250.00060−0.051510.26669We can see from Table6 that our stock selection algorithm outperforms other four algorithms on five EIT algorithms over four performance metrics, i.e., obtaining 14 out of 20 best values in all. Note that the volume algorithm outperforms other algorithms on TE metric; this is because it only considers the trading volume while choosing stocks, and stocks with large trading volume are influencing factors for index pricing. Although volume algorithm performs well on TE, it is underperforming in other three metrics. Another important observation from Table 6 is that our stock selection algorithm achieves more significant improvements over the other algorithms on the SR metric, which means our algorithm has better performance when considering the TE and ER metrics simultaneously. In summary, the above results indicate that our selection algorithm not only has better performance than others but also has strong generality and is suitable for many EIT algorithms.For a better illustration, we plot the four normalized performance metrics of five stock selection algorithms on SSE180 dataset in Figures4(a)–4(e), respectively. In each figure, the x-axis lists the five algorithms and the y-axis represents the measurements of the four performance metrics. We conclude from Figure 4 that our stock selection algorithm achieves stable improvements compared with the other five algorithms, and the improvements are more significant in SR and IR metrics.Figure 4
Results for stock selection algorithms.
(a)(b)(c)(d)(e)


## 5.2.3. Overall Algorithm Performance Results

Finally, we compare our IntelliPortfolio algorithm with five state-of-the-artEIT algorithms on five international stock markets, and the results are listed in Table 7.Table 7
Final results on five datasets.
SSE180AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.005540.000551.765060.19968DPG0.005595.68095e − 05−0.212280.09699RRL0.010290.00019−0.049260.01857DDPG0.024310.000470.162680.01950GA-RRL0.004410.000100.354480.02391HGA0.04434−0.010760.07013−0.24273Nikkei225AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.001140.001161.126800.05055DPG0.00096−0.00142−0.20583−1.48279RRL0.01669−0.00150−0.02886−0.08960DDPG0.010550.000330.133470.03162GA-RRL0.00483−0.000980.43392−0.20310HGA0.01521−0.01194−0.10225−0.78510HSIAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.002870.000720.664670.25105DPG0.00109−0.00155−0.10316−1.42760RRL0.00694−0.00147−0.02697−0.21127DDPG0.002800.000060.088230.02068GA-RRL0.00185−0.001840.08630−0.99876HGA0.01133−0.010460.03701−0.92311DJIAAlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.003750.000630.412090.16682DPG0.00167−0.00014−0.18196−0.08172RRL0.014340.00008−0.06911−0.00553DDPG0.01403−0.000480.13292−0.03438GA-RRL0.00289−0.002230.22810−0.77050HGA0.01046−0.00951−0.20269−0.90926FTSE100AlgorithmsTE↓ER↑SR↑IR↑IntelliPortfolio0.00238−0.000020.43635−0.00683DPG0.00212−0.00080−0.07507−0.37783RRL0.02067−0.000280.00667−0.01370DDPG0.00156−0.00049−0.05788−0.31460GA-RRL0.00516−0.000600.40223−0.11589HGA0.01884−0.008550.07314−0.45402We can see from Table7 that IntelliPortfolio outperforms other five algorithms on five datasets over four performance metrics, i.e., obtaining 16 out of 20 best values in all. Specifically, in terms of ER, our algorithm achieves an average performance improvement of 178.90% over DPG, 29.3% over RRL, 260.90% over DDPG, 98.01% over GA-RRL, and 89.16% over HGA; in terms of SR, our algorithm achieves an average performance improvement of 665.97% over DPG, 364.57% over RRL, 136.47% over DDPG, 69.47% over GA-RRL, and 130.73% over HGA; in terms of IR, our algorithm achieves an average performance improvement of 120.20% over DPG, 98.54% over RRL, 8.78% over DDPG, 86.57% over GA-RRL, and 37.71% over HGA. Note that although DPG and DDPG algorithms outperform other algorithms on TE metric, they are still underperforming in other three metrics. Such results illustrates the significant and consistent performance superiority of the IntelliPortfolio algorithm in comparison with five state-of-the-art algorithms.Figure5 illustrates the average performance measurements of different algorithms. We observe from Figure 5 that IntelliPortfolio outperforms all other five algorithms, followed by GA-RRL, DDPG, PG, RRL, and HGA. The difference between IntelliPortfolio and other algorithms is significant, and all others are not. Such results indicate that IntelliPortfolio is stable and robust on different datasets in comparison with other algorithms.Figure 5
Average measurements of different algorithms on five databases.
(a)(b)(c)(d)


## 6. Conclusion and Future Work

In this study, we propose an learning-based approach named IntelliPortfolio for theEIT problem. It applies principal component analysis (PCA) and k-means clustering algorithm to automatically select constituent stocks for the portfolio from the benchmark index and uses long short term memory (LSTM) network to determine the investment weight for each constituent stock in the portfolio. We conducted extensive experiments on five real-world datasets of international stock market. The superiority of IntelliPortfolio was illustrated with four performance metrics in comparison with five state-of-the-art EIT algorithms.It is of our future interest to make IntelliPortfolio more reactive by learning previous patterns of stock market and supporting automatic adjustments according to future market prediction. We will also explore the possibility of proposing practical reinforcement learning-based algorithms to make more intelligent and adaptive portfolio decisions.



---

*Source: 3751452-2022-04-14.xml*