Method and device for stock trend analysis using machine learning
The machine learning-based method enhances stock trend prediction accuracy by dividing a target model into sub-models and combining their results, addressing the inconsistency of traditional methods.
Patent Information
- Application Number
- JP2025505508
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2025-08-20
- Estimated Expiration
- 2042-08-09
AI Technical Summary
Existing stock trend prediction methods are inaccurate due to individual understanding levels, leading to inconsistent and unreliable prediction results.
A machine learning-based method that involves acquiring stock data, dividing a target model into sub-target models, and determining multiple trend forecast results, which are then combined to produce an accurate target trend forecast result.
Improves the accuracy of stock trend prediction by processing stock data using a machine learning model, reducing memory usage and costs, and ensuring timely model updates.
Smart Images

Figure 2025527228000001_ABST
Abstract
Description
[Technical Field]
[0001] The present application relates to the field of stock analysis technology, and more particularly to a method, device, electronic device, and storage medium for stock trend analysis using machine learning. [Background technology]
[0002] Mobile stock trading has become a major channel for shareholders to buy and sell stocks, and mobile stock trading software provides shareholders with technical stock data, making it easier for shareholders to predict stock trends.
[0003] Currently, shareholders mainly use a voting method for stock trend prediction, which means that multiple people analyze the technical data of a stock (including the indicators and forms corresponding to the stock), obtain multiple trend prediction results, and select the trend prediction result that the majority of people agree on as the final stock trend prediction result.
[0004] However, when predicting stock trends using the above method, the prediction results are significantly affected by the individual's level of understanding, resulting in inaccurate prediction results. Summary of the Invention [Problem to be solved by the invention]
[0005] Embodiments of the present application provide a method, device, electronic device, and storage medium for stock trend analysis using machine learning, which improve the accuracy of stock trend prediction. [Means for solving the problem]
[0006] In a first aspect, an embodiment of the present application provides a machine learning stock trend analysis method applied to an electronic device, the method comprising: acquiring stock data corresponding to a target model and a target stock, where the stock data is determined based on technical indicator data and performance data of the target stock; dividing the target model to obtain a plurality of sub-target models; determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend forecast results; and determining a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results.
[0007] In a second aspect, an embodiment of the present application provides a machine learning stock trend analysis device, the device comprising: a data acquisition module for acquiring stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and performance data of the target stock; a model division module for dividing the target model to obtain a plurality of sub-target models; a trend forecasting module for determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend forecast results; a target trend determination module for determining a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results.
[0008] In a third aspect, an embodiment of the present application provides an electronic device including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and arranged to be executed by the processor, and the programs include instructions for performing steps of a method according to the first aspect of the embodiment of the present application.
[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium being for storing a computer program, the computer program being executed by a processor to implement some or all of the steps described in the method of the first aspect of the embodiment of the present application.
[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, the computer program product including a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being operable to cause a computer to perform some or all of the steps of the method according to the first aspect of the embodiment of the present application, the computer program product may be a software package. [Effects of the Invention]
[0011] The adoption of the embodiment of the present application has the following beneficial effects.
[0009] Embodiments of the present application provide a method, device, electronic device, and storage medium for stock trend analysis using machine learning, which includes: obtaining a target model and stock data corresponding to the target stock; dividing the target model to obtain a plurality of sub-target models; determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-target models; and finally determining a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results. The present application processes stock data using a data model generated based on machine learning and outputs a trend analysis result corresponding to the target stock, thereby improving the accuracy of the forecast result and providing users with accurate and sufficient market price information. [Brief explanation of the drawings]
[0012] In order to more clearly describe the technical solutions in the embodiments of the present application or the prior art, the following will briefly describe the drawings that need to be used in the description of the embodiments or the prior art. It is obvious that the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings based on these drawings without any creative labor. [Figure 1] 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application; [Figure 2] 1 is a flowchart of a stock trend analysis method using machine learning according to an embodiment of the present application. [Figure 3] 1 is a flowchart of obtaining a target model according to an embodiment of the present application; [Figure 4] FIG. 1 is a schematic diagram of Tesla's technical indicator interpretation page according to an embodiment of the present application. [Figure 5] FIG. 1 is a schematic diagram of a Tesla technical form decoding page according to an embodiment of the present application. [Figure 6] 1 is a flowchart of another machine learning stock trend analysis method according to an embodiment of the present application. [Figure 7] 1 is a flowchart of another machine learning stock trend analysis method according to an embodiment of the present application. [Figure 8] 1 is a flowchart of model training according to an embodiment of the present application. [Figure 9] 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application; [Figure 10] FIG. 1 is a configuration block diagram of functional units of a stock trend analysis device using machine learning according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0013] The electronic devices may include mobile terminals (such as mobile phones and tablets) with various wireless communication capabilities, in-vehicle devices, wearable devices (such as smart watches and smart glasses), computing devices or other processing devices connected to wireless modems, and various forms of user devices (UE), mobile stations (MS), virtual reality / augmented reality devices, terminal devices, etc., and the electronic device may also be a server.
[0014] The embodiments of the present invention will be described in detail below.
[0015] As shown in Figure 1, Figure 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application, which includes a processor, a memory, a random access memory (RAM), and a display, where the memory, RAM, and display are all connected to the processor.
[0016] Furthermore, the electronic device may further include a speaker, a microphone, a camera, a communication interface, a signal processing device, and a sensor, wherein the speaker, microphone, camera, signal processing device, and sensor are all connected to the processor, and the communication interface is connected to the signal processing device.
[0017] Here, the processor is the control center of the electronic device, and connects each part of the entire electronic device using various interfaces and lines, and monitors the entire electronic device by running or executing software programs and / or modules stored in memory, calling up data stored in memory, and executing various functions and processing data of the electronic device.
[0018] The memory is used to store software programs and / or modules, and the processor executes the software programs and / or modules stored in the memory to perform various functional applications and data processing of the electronic device. The memory mainly includes a program storage area that can store an operating system, software programs required for at least one function, etc., and a data storage area that can store data created in response to the use of the electronic device. The memory can include high-speed random access memory and can also include non-volatile memory such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0019] According to the electronic device shown in FIG. acquiring stock data corresponding to a target model and a target stock, where the stock data is determined based on technical indicator data and performance data of the target stock; dividing the target model to obtain a plurality of sub-target models; determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend forecast results; determining a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results.
[0020] As can be seen from the above, the electronic device described in the embodiment of the present application obtains a target model and stock data corresponding to the target stock, divides the target model to obtain multiple sub-target models, determines multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models, and finally determines a target trend prediction result corresponding to the target stock based on the multiple trend prediction results.The present application processes the stock data using a smart model (target model) to output a trend prediction result corresponding to the target stock, thereby improving the accuracy of the prediction result.
[0021] Please refer to Figure 2. Figure 2 shows a stock trend analysis method based on machine learning provided in an embodiment of the present application, which is applied to the electronic device shown in Figure 1, and specifically includes steps S201 to S204. In step S201, stock data corresponding to the target model and the target stock is obtained.
[0022] Here, the target model is obtained by training based on the random forest model. The specific training method of the random forest model will be described below, so it will not be described in detail here.
[0023] The model in this application is updated asynchronously, that is, the model needs to be updated periodically. However, due to research and development constraints, it is impossible to update the model every time a new version is updated. Therefore, the file data corresponding to the model needs to be stored in an external storage device or cloud platform, and the model needs to be updated in real time according to the training status, for example, by storing the model in an external storage device and performing hot updates.
[0024] Therefore, in this application, a model is hot-updated using a public cloud COS (Cloud Object Storage) bucket, and as shown in Figure 3, the system detects whether the latest version of the model is available each time before executing the algorithm in the background. That is, there are three methods for acquiring a target model. In the first method, it is first determined whether a target file corresponding to the target model exists locally, and a first determination result is obtained. If the first determination result is NO, the system downloads the target file from the COS bucket and unzips it, thereby acquiring the target model. In the second method, it is determined whether a target file corresponding to the target model exists locally, and a first determination result is obtained. If the first determination result is YES, it is determined whether the target file is the latest version, and a second determination result is obtained. If the second determination result is YES, the system acquires the target model from the target file. In the third type, it is determined whether a target file corresponding to the target model exists locally, and a first determination result is obtained; if the first determination result is YES, it is determined whether the target file is the latest version, and a second determination result is obtained; if the second determination result is NO, the target file is downloaded from the COS bucket and unzipped, thereby obtaining the target model.
[0025] As can be seen from the above description, if a target file corresponding to the target model does not exist locally, or if a target file exists locally but is not the latest version, the model can be updated by querying the model version through the COS bucket. The latest version detection process first obtains the MD5 value of the object and performs a comparison query to determine whether the model file is the latest version. If necessary, the user can directly download and unzip the target file from the COS bucket to obtain the target model. Furthermore, because the COS bucket stores and manages various versions of models, users can directly view previous versions of the model through the COS bucket. This reduces data redundancy and improves the system's disaster recovery capabilities.
[0026] Furthermore, the stock data includes the index data, the form data, the label data, and the derived index corresponding to the target stock. Here, the stock data is determined based on the technical index data and form data of the target stock. Acquiring stock data mainly includes the following steps: first, obtain the technical index data and form data of the target stock; then, for example, access the stock detailed quotation page directly from the entrance of the Futuniu app using mobile terminal software, as shown in Figures 4 and 5, and click to analyze. The technical corresponding index decipherment and form decipherment of the target stock (e.g., Tesla) can be directly displayed. Tesla's technical index data can be obtained through the index decipherment, and Tesla's technical form data can be obtained through the form decipherment. Then, based on the index data and the form data, the label data and derived index corresponding to the target stock are determined. Finally, the index data, form data, label data, and derived index are used as stock data.
[0027] Specifically, in this embodiment, the indicator data includes values corresponding to each indicator of the target stock. The shape data includes a specific shape distribution status of the target stock, such as whether it has a certain shape. The label data includes label values such as overbuy, severe overbuy, oversell, severe oversell, and neutral corresponding to the indicator data of the target stock. The derived data includes data combining historical data of the indicator data, shape data, and label data, such as overbuy, severe overbuy, oversell, severe oversell, neutral, price fluctuation range label values, historical opening price, historical closing price, and historical price fluctuation range.
[0028] In step S202, the target model is divided to obtain a plurality of sub-target models.
[0029] In step S203, a plurality of trend forecast results corresponding to the target stock are determined based on the stock data and the plurality of sub-target models.
[0030] In step S204, a target trend forecast result corresponding to the target stock is determined based on the plurality of trend forecast results.
[0031] Because the model is trained on historical data, over time, the old model may become distorted and the prediction accuracy may decrease. In this case, the model needs to be automatically trained on a scheduled basis. Furthermore, model updates should not interfere with the released version or the online main process. Therefore, this application adopts an asynchronous update model.
[0032] Before performing trend prediction for a target stock, the present application needs to detect whether the model has been updated. After obtaining the target model as described in the three methods of the previous embodiment, the target model is first divided into multiple sub-target models. Then, trend prediction for the target stock is performed by dividing and loading the multiple sub-target models, thereby obtaining multiple trend prediction results, where the multiple sub-target models correspond one-to-one to the multiple trend prediction results. By adopting the method of dividing and loading the target model, the present application can reduce memory usage and cost requirements.
[0033] In practical applications, the memory required to load the original model was too large (e.g., about 27GB) and the loading time was slow (e.g., an average of about 10 minutes). Therefore, we solved the model from the algorithmic foundation and rewrote the calculation logic code. The current algorithm reduces the total memory requirement to about 4GB, and the calculation results are almost identical to the original model with extremely small error (the maximum error is less than ±2.22e-16).
[0034] Further, please refer to Figure 6. Taking the target model as a random forest model as an example, the splitting and loading of the target model will be described, and the process of determining the target trend prediction result corresponding to the target stock by the target model after splitting and loading will be specifically as follows:
[0035] After obtaining a random forest model, first determine that the number of trees in the random forest model is m, where m is a positive integer, and then divide the m trees in the random forest model as needed, where the division method can be equal or unequal and is determined according to specific needs. If necessary, divide the m trees into thirds to obtain three sub-random forest models, which are a first random forest model, a second random forest model, and a third random forest model, and each of the first random forest model, the second random forest model, and the third random forest model each contains m / 3 trees.
[0036] After dividing the random forest model, the first random forest model, the second random forest model, and the third random forest model are sequentially loaded in order, i.e., stock data is input into the first random forest model, the second random forest model, and the third random forest model, respectively, to output a first trend prediction result, a second trend prediction result, and a third trend prediction result. The first trend prediction result, the second trend prediction result, and the third trend prediction result are then combined to obtain a plurality of trend prediction results, and a target trend prediction result corresponding to the target stock is determined based on the plurality of trend prediction results.
[0037] Furthermore, after obtaining a plurality of trend forecast results, the plurality of trend forecast results need to be statistically analyzed to obtain the target trend forecast result, where the statistical analysis is not limited to methods such as average value calculation, and the target trend forecast result includes the upward and downward fluctuation trends of the target stock within a future predetermined time period and the probability values corresponding to the upward and downward fluctuation trends.
[0038] Furthermore, trend prediction results are obtained based on each sub-target model, and the prediction results are comprehensively determined based on the trend prediction results. Then, the correlation Con(Tre_i, Tar) between the feature vector Tre_i corresponding to the k trend prediction results and the feature vector Tar corresponding to the target trend prediction result is calculated as follows: JPEG2025527228000002.jpg19170, where α and β respectively represent the feature values corresponding to the feature vectors of each prediction result, i represents the identifier corresponding to the sub-target model, and k represents the number of sub-target models. After calculating and obtaining the correlation Con_i corresponding to each sub-model, the correlation is used as the accuracy rate of the sub-model corresponding to the trend prediction result, and the accuracy rates corresponding to each sub-model are calculated and used as the analysis weight of each trend prediction result in the next comprehensive analysis. Furthermore, the obtained corresponding target trend prediction result Tar is JPEG2025527228000003.jpg20170
[0039] The feature vector corresponding to the prediction result in the above formula is the vector sum between the feature vectors corresponding to each target trend prediction result.
[0040] In addition, in this embodiment, the model effect of each sub-model can be evaluated based on the accuracy rate and a preset threshold value, and if the accuracy rate is smaller than the preset threshold value, the sub-model is trained in a targeted manner to improve the accuracy of the sub-model, and then the accuracy of the entire model is improved.
[0041] Please refer to Figure 7. Figure 7 shows another machine learning stock trend analysis method according to an embodiment of the present application, which is applied to the electronic device shown in Figure 1, and specifically includes the following steps:
[0042] In step S701, an initial model and training data are obtained.
[0043] Here, the initial model is a random forest model.
[0044] In the present application, obtaining the training data includes the following steps: obtaining k-line data, calculating initial index data and initial shape data according to the k-line data, cleaning the initial index data and the initial shape data to obtain target index data and target shape data, and finally determining the training data based on the target index data and the target shape data.
[0045] Here, the step of determining the training data based on the target indicator data and the target shape data includes the steps of first determining label data based on the target indicator data, the target shape data, and a first preset threshold, then combining the label data and history data to obtain a derived indicator, and further combining the target indicator data, the target shape data, the label data, and the derived indicator to obtain the training data.
[0046] Please refer to Figure 8. The training data acquisition process is described in detail below. Before training the initial model, training data must be acquired. Here, the acquisition of training data mainly involves first acquiring k-line data, directly calculating initial indicator data and initial shape data using the k-line data, and then cleaning the initial indicator data and initial shape data to obtain 14 target indicator data and 8 target shape data. Here, the target shape refers to the k-line itself or the derived lines generated by the k-line having special shapes such as intersections and extreme points. In this case, these special shapes can be understood as signals for overbuying or overselling. The target indicator is obtained based on the numerical calculation of the historical k-line and is distinct from the shape. The indicator has a specific value, and different threshold ranges can be set for the indicator according to the historical market performance. Within different ranges, the indicator can be interpreted as conclusions such as severe overselling, overselling, neutral, severe overbuying, and overbuying.
[0047] The target indicator data and the target form data can both determine corresponding label data according to their own states or value ranges, where the label data indicates the degree of overbuying or overselling of the target indicator data and the target form data, so that the target indicator data and the target form data can be respectively compared with a first preset threshold value, and the label data corresponding to the target indicator data and the target form data can be directly determined, that is, belonging to serious overselling, overselling, neutral, serious overbuying or overbuying.
[0048] After determining the label data, a derived index can be obtained based on a combination of the label data and historical data, where the historical data includes at least a historical opening price, a historical closing price, and a historical price fluctuation range. After the target index data, the target shape data, the label data, and the derived index are sequentially obtained through the above steps, the target index data, the target shape data, the label data, and the derived index are combined to obtain the training data.
[0049] As can be seen from the above description, in addition to the 14 target indicator data and 8 target form data included, the label data in this embodiment further includes a threshold value (i.e., a first preset threshold value) established based on each indicator form, thereby forming label values such as overbuy, severe overbuy, oversell, severe oversell, and neutral.
[0050] For example, the derived data in this embodiment further includes historical data such as the price fluctuation range, opening price, and closing price for the past three trading days, the difference values for the past three trading days of all 14 target indicator data, the price fluctuation range, and the original values for the past three trading days, for a total of 295 different indicator dimensions. Specifically, the overbuying / overselling indicators in this embodiment include, but are not limited to, a homeostasis indicator, a random indicator, a relative strength / weakness indicator, a Williams indicator, a deviation rate, a willingness indicator, a volume anomaly, a psychological line index, a fluctuation index, and a popularity index.
[0051] In step S702, the training data is used to train the initial model to obtain the target model.
[0052] After obtaining training data, the training data is directly input into the random forest model, and a grid search is employed to optimize hyperparameters in the random forest model, and the target model can be obtained when the hyperparameters reach a second preset threshold, where the hyperparameters can include, but are not limited to, model complexity, maximum complexity, maximum feature parameters, etc.
[0053] In step S703, stock data corresponding to the target model and the target stock is obtained.
[0054] In step S704, the target model is divided to obtain a plurality of sub-target models.
[0055] In step S705, a plurality of trend forecast results corresponding to the target stock are determined based on the stock data and the plurality of sub-target models.
[0056] In step S706, a target trend forecast result corresponding to the target stock is determined based on the plurality of trend forecast results.
[0057] The contents described in steps S703 to S706 are the same as those in steps S201 to S204, and will not be described again here.
[0058] As can be seen from the above, in the machine learning stock trend analysis method described in the embodiments of the present application, a target model and stock data corresponding to the target stock are obtained, the target model is divided to obtain multiple sub-target models, and multiple trend prediction results corresponding to the target stock are determined based on the stock data and the multiple sub-target models, and finally, a target trend prediction result corresponding to the target stock is determined based on the multiple trend prediction results.The present application processes stock data using a smart model (target model) to output a trend prediction result corresponding to the target stock, thereby improving the accuracy of the prediction result.
[0059] It should be understood that the magnitude of the numbers of each step in the above embodiment does not indicate the order of execution, and the order of execution of each process does not in any way limit the implementation procedure of the embodiment of the present invention, but should be determined based on its function and inherent logic.
[0060] The following are examples of the apparatus of the present invention, and for details not described in detail therein, please refer to the corresponding method examples described above.
[0061] Please refer to Figure 9. Figure 9 is a structural schematic diagram of an electronic device according to an embodiment of the present application, and as shown in the figure, the electronic device includes a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and arranged to be executed by the processor, and the programs are for executing instructions corresponding to the method of Figure 1, and will not be described again here.
[0062] Please refer to Figure 10. Figure 10 shows a machine learning stock trend analysis device according to an embodiment of the present application, which is applied to an electronic device. The device includes a data acquisition module 1001, a model division module 1002, a trend prediction module 1003, and a target trend determination module 1004. Here, the data acquisition module 1001 is used to acquire stock data corresponding to the target model and the target stock, where the stock data is determined based on the technical indicator data and the profile data of the target stock. The model division module 1002 is used to divide the target model to obtain multiple sub-target models. The trend prediction module 1003 is used to determine a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-target models, where the plurality of sub-target models correspond one-to-one to the plurality of trend prediction results. The target trend determination module 1004 is used to determine a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results.
[0063] Optionally, the data acquisition module 1001 a first determination sub-module for determining whether a target file corresponding to the target model exists locally and obtaining a first determination result; a first decision-making submodule for obtaining the target model based on the first determination result.
[0064] Optionally, the first decision-making submodule: A first decision-making unit is included for downloading and unzipping the target file from a COS bucket, thereby obtaining the target model, if the first determination result is NO.
[0065] Optionally, the first decision-making unit: a first determining subunit for determining whether the target file is the latest version and obtaining a second result when the first determining result is YES; a first decision-making subunit for obtaining the target model from the target file if the second determination result is YES.
[0066] Optionally, the first decision-making submodule: If the second result is NO, a second decision-making unit is included for downloading and unzipping the target file from a COS bucket, thereby obtaining the target model.
[0067] Optionally, the data acquisition module 1001 a data acquisition sub-module for acquiring technical indicator data and profile data of the target stock; a data generation sub-module for determining label data and derived indices corresponding to the target stock based on the index data and the morphology data; and a stock data determination submodule for determining the index data, the shape data, the label data, and the derived index as the stock data.
[0068] Optionally, the trend prediction module 1003: a model processing sub-module for inputting the stock data into each sub-goal model among the plurality of sub-goal models to obtain a trend forecast result corresponding to each sub-goal model; and a trend prediction sub-module for aggregating trend prediction results corresponding to the sub-target models to obtain the plurality of trend prediction results.
[0069] Optionally, the target trend determination module 1004: and a target trend determination sub-module for performing statistical analysis on the plurality of trend prediction results to obtain the target trend prediction result, wherein the target trend prediction result includes the upward and downward fluctuation trend of the target stock within a future predetermined time period and a probability value corresponding to the upward and downward fluctuation trend.
[0070] Optionally, before the data acquisition module 1001, a model acquisition module and a model training module are included; The model acquisition module is used for acquiring an initial model and training data, where the initial model is a random forest model; The model training module is used to train the initial model using the training data to obtain the target model.
[0071] Selectable, the model acquisition module, a data acquisition sub-module for acquiring k-line data; an index calculation submodule for calculating initial index data and initial shape data according to the k-line data; a data cleaning submodule for cleaning the initial indicator data and the initial shape data to obtain target indicator data and target shape data; and a training data acquisition sub-module for determining the training data based on the target indicator data and the target shape data.
[0072] Optionally, the training data acquisition sub-module includes: a label data determining unit, a derivative indicator determining unit, and a training data acquiring unit; the label data determining unit is used to determine label data according to the target indicator data, the target form data and a first preset threshold value, wherein the label data is for indicating the degree of overbuying or overselling of the target indicator data and the target form data; The derived indicator determination unit is used to combine the label data and history data to obtain a derived indicator, where the history data includes at least a historical opening price, a historical closing price, and a historical price fluctuation range; The training data acquisition unit is used to assemble the target indicator data, the target shape data, the label data and the derived indicators to obtain the training data.
[0073] Optionally, the model training module a data input submodule for inputting the training data into the random forest model and employing grid search to optimize hyperparameters in the random forest model; and a target model determination submodule for obtaining the target model when the hyperparameter reaches a second preset threshold.
[0074] As can be seen from the above, the machine learning stock trend analysis device described in the embodiments of the present application is applied to an electronic device, acquires a target model and stock data corresponding to the target stock, divides the target model to obtain multiple sub-target models, determines multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models, and determines a target trend prediction result corresponding to the target stock based on the multiple trend prediction results.The stock data is processed by a smart model (target model) to output a trend prediction result corresponding to the target stock, thereby improving the accuracy of the prediction result.
[0075] It should be noted that the functions of each program module of the machine learning stock trend analysis device of this embodiment can be specifically implemented based on the method in the above method embodiment, and the specific process can be referred to the relevant description of the above method embodiment, and will not be described again here.
[0076] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is for storing a computer program for use in converting electronic data, and wherein the computer program causes a computer to perform some or all of the steps described in the electronic device in the above method embodiment.
[0077] An embodiment of the present application further provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being operable to cause a computer to perform some or all of the steps described in the electronic device in the above method. The computer program product may be a software package.
[0078] The steps of the method or algorithm described in the embodiments of the present application may be implemented in hardware or software instructions executed by a processor. The software instructions may be configured into corresponding software modules, which may be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, a hard disk, a removable hard disk, a read-only optical disk (CD-ROM), or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor such that the processor can read information from and write information to the storage medium. Of course, the storage medium may be a component of the processor. The processor and the storage medium may be in an ASIC. Furthermore, the ASIC may reside in an access network device, a target network device, or a core network device. Of course, the processor and the storage medium may reside as separate components in the access network device, the target network device, or the core network device.
[0079] Those skilled in the art should recognize that in one or more of the above examples, all or part of the functionality described by the embodiments of the present application can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, all or part of the functionality can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. By loading the computer program instructions into a computer and executing them, all or part of the functionality is generated as shown in the flowcharts and functions described in the embodiments of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, radio, microwave). The computer-readable storage medium may be any available medium that can be accessed by a computer, or may be a data storage device in which one or more available media are integrated, such as a server, a data center, etc. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)).
[0080] The specific embodiments described above further explain the purpose, technical means and beneficial effects of the embodiments of the present application in detail, but what has been described above is only a specific embodiment of the embodiments of the present application, and does not limit the scope of protection of the embodiments of the present application. It is understood that any modifications, equivalent substitutions, improvements, etc. made based on the technical means of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.
Claims
1. A stock trend analysis method using machine learning that is applied to an electronic device, the stock trend analysis method using machine learning comprising: Acquiring stock data corresponding to a target model and a target stock, where the stock data is determined according to technical index data and morphology data of the target stock, the target model is hot-updated in a COS (Cloud Object Storage) bucket of a public cloud, an MD5 value of the target model is stored in the COS bucket of the public cloud, and determining whether the target model needs to be hot-updated according to the MD5 value; dividing the target model to obtain a plurality of sub-target models; determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend forecast results; and determining a target trend prediction result corresponding to the target stock based on the plurality of trend prediction results.
2. The step of obtaining the target model includes: determining whether a target file corresponding to the target model exists locally, and obtaining a first determination result; The method for analyzing stock trends using machine learning according to claim 1, further comprising: a step of acquiring the target model based on the first determination result.
3. The step of acquiring the target model based on the first determination result includes: The method for stock trend analysis using machine learning according to claim 2, further comprising the step of downloading and unzipping the target file from an object bucket, thereby obtaining the target model, if the first judgment result is NO.
4. The step of acquiring the target model based on the first determination result includes: If the first result is YES, determining whether the target file is the latest version to obtain a second result; 3. The method for analyzing stock trends using machine learning according to claim 2, further comprising: if the second determination result is YES, acquiring the target model from the target file.
5. The step of acquiring the target model based on the first determination result includes:
5. The method for analyzing stock trends using machine learning according to claim 4, further comprising the step of downloading and unzipping the target file from an object bucket, thereby obtaining the target model, if the second result is NO.
6. The step of obtaining stock data corresponding to the target stock includes: Obtaining technical indicator data and profile data of the target stock; determining label data and derived indices corresponding to the target stock based on the index data and the morphology data; The method for stock trend analysis using machine learning according to claim 1, further comprising a step of using the index data, the morphology data, the label data, and the derived index as the stock data.
7. determining a plurality of trend forecast results corresponding to the target stock based on the stock data and the plurality of sub-target models, inputting the stock data into each sub-goal model among the plurality of sub-goal models to obtain a trend forecast result corresponding to each sub-goal model; The stock trend analysis method using machine learning according to claim 1, further comprising a step of aggregating trend prediction results corresponding to each of the sub-target models to obtain the plurality of trend prediction results.
8. determining a target trend forecast result corresponding to the target stock based on the plurality of trend forecast results, 2. The method for stock trend analysis using machine learning according to claim 1, further comprising a step of performing statistical analysis on the plurality of trend prediction results to obtain the target trend prediction result, wherein the target trend prediction result includes an upward and downward fluctuation trend of the target stock within a predetermined future time period and a probability value corresponding to the upward and downward fluctuation trend.
9. Before obtaining the stock data corresponding to the target model and target stock, obtaining an initial model, which is a random forest model, and training data; The method for stock trend analysis using machine learning according to any one of claims 1 to 8, further comprising: training the initial model using the training data to obtain the target model.
10. The step of obtaining training data is acquiring k-line data; calculating initial index data and initial shape data according to the k-line data; cleaning the initial indicator data and the initial shape data to obtain target indicator data and target shape data; The method for analyzing stock trends using machine learning according to claim 9, further comprising: determining the training data based on the target indicator data and the target shape data.
11. The step of determining the training data based on the target indicator data and the target form data includes: determining label data based on the target indicator data, the target form data, and a first preset threshold, wherein the label data indicates the degree of overbuying or overselling of the target indicator data and the target form data; combining the label data and historical data to obtain a derived indicator, wherein the historical data includes at least a historical opening price, a historical closing price, and a historical price fluctuation range; The method for stock trend analysis using machine learning according to claim 10, further comprising a step of compiling the target indicator data, the target shape data, the label data and the derived indicators to obtain the training data.
12. training the initial model using the training data to obtain the target model, inputting the training data into the random forest model and employing grid search to optimize hyperparameters in the random forest model; and obtaining the target model when the hyperparameter reaches a second preset threshold.
13. A stock trend analysis device using machine learning, a data acquisition module used to acquire stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical index data and morphology data of the target stock, the target model is hot-updated in a COS (Cloud Object Storage) bucket of a public cloud, an MD5 value of the target model is stored in the COS bucket of the public cloud, and the data acquisition module determines whether the target model needs to be hot-updated according to the MD5 value; a model division module used for dividing the target model to obtain a plurality of sub-target models; a trend prediction module used to determine a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results; A machine learning stock trend analysis device comprising: a target trend determination module used to determine a target trend prediction result corresponding to the target stock based on the plurality of trend prediction results.
14. 13. An electronic device comprising: a processor, a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and arranged to be executed by the processor, the programs comprising instructions for executing steps in a method for stock trend analysis using machine learning according to any one of claims 1 to 12.
15. 13. A computer-readable storage medium, the computer-readable storage medium being used to store a computer program, the computer program being executed by a processor to realize the stock trend analysis method using machine learning according to any one of claims 1 to 12.
Citation Information
Patent Citations
Stock market investment decision-making method based on network analysis and multi-model fusion
CN103985055A
Analysis system for performance prediction
JP2007509447A
Distributed processing system, learning model creating method, data processing method, learning model creating program, and data processing program
JP2017068710A
Pain determination using trend analysis, medical device incorporating machine learning, economic discriminant model, and iot, tailormade machine learning, and novel brainwave feature quantity for pain determination
WO2019009420A1