Neural network processing method and device applied in online system
Through discrete training and solid loading of neural networks in online systems, the problem of inconsistent and time-consuming applications of neural networks in business environments is solved, and efficient operation and rapid response of neural networks in online systems are achieved.
Patent Information
- Application Number
- CN201910163118.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-05
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-03-05
AI Technical Summary
The existing technology makes it difficult to directly apply offline trained neural networks to business environments, resulting in inconsistent neural networks and offline training in business scenarios, which is time-consuming and difficult to meet business needs.
By conducting discrete training of neural networks and solidifying model files in the online system, and loading and running these model files in the online system, the structure and parameter consistency of the neural network are ensured, and multi-threading is used to load and run model files to improve response speed. .
It achieves the consistency of training results between the neural network in the online system and the offline environment, reduces development costs, shortens the online cycle, and significantly improves the response speed.
Smart Images

Figure CN109947985B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of neural networks, and in particular to a neural network processing method and device applied in an online system. Background Art
[0002] As neural networks continue to develop in the field of academic research, their application scenarios are increasing. However, the structure of neural networks is complex, and their native offline training environment cannot be directly transplanted to the business environment. Therefore, it is difficult to directly apply the trained neural network to business scenarios for forward prediction. The separation of offline training and forward prediction of neural networks in engineering has brought new problems to its application.
[0003] In order to solve this technical problem, the existing technology can use open source frameworks to perform offline training of neural networks, reconstruct the trained neural networks in actual business scenarios, and perform forward prediction based on matrix operation libraries. However, the network structure based on the matrix library is not flexible enough, it is difficult to ensure the consistency of the neural network in the business scenario with the offline trained neural network, and it is time-consuming. Summary of the invention
[0004] The present invention provides a neural network processing method and device applied in an online system and a recommendation system based on the neural network.
[0005] In a first aspect, the present invention provides a neural network processing method applied in an online system, the method comprising:
[0006] Acquire a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network;
[0007] Obtaining a model file corresponding to the target network by solidifying the model graph, wherein the model file includes a network structure and network parameters of the target network;
[0008] The model file is loaded and run in an online system, wherein the online system includes a running environment of the model file.
[0009] A second aspect provides a neural network processing device applied in an online system, the device comprising:
[0010] A discrete training module, used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network;
[0011] A solidification module, used for obtaining a model file corresponding to the target network by solidifying the model graph, wherein the model file includes a network structure and network parameters of the target network;
[0012] The running module is used to load and run the model file in an online system, and the online system includes a running environment for the model file.
[0013] A third aspect provides a recommendation system based on a neural network, the system comprising:
[0014] A discrete training module, used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network;
[0015] A solidification module, used for obtaining a model file corresponding to the target network by solidifying the model graph, wherein the model file includes a network structure and network parameters of the target network;
[0016] The running module is used to load and run the model file in the online component of the recommendation system, and the online component of the recommendation system includes the running environment of the model file.
[0017] A fourth aspect provides a computer-readable storage medium for storing a program, which, when executed, implements a neural network processing method applied in an online system.
[0018] The neural network processing method and device and the recommendation system based on the neural network provided by the present invention are applied to the online system. By improving each link of the neural network, such as discrete training, solidification loading, and online application, the consistency between the neural network applied by the online system and the neural network obtained by discrete environment training is ensured, the online development cost is reduced, the online development cycle of the neural network obtained by discrete environment training is shortened, and its online response speed is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 It is a flow chart of a neural network processing method applied in an online system provided by the present invention;
[0021] Figure 2 It is a flow chart of an online system construction method provided by the present invention;
[0022] Figure 3 It is a flow chart of a neural network loading and running method based on multi-process provided by the present invention;
[0023] Figure 4 It is a flow chart of loading a new model file by a loading thread provided by the present invention;
[0024] Figure 5 It is a flow chart of training the neural network model based on the training samples to obtain a discrete training target network provided by the present invention;
[0025] Figure 6 It is a block diagram of a neural network processing device applied in an online system provided by the present invention;
[0026] Figure 7 is a block diagram of a discrete training module provided by the present invention;
[0027] Figure 8 It is an interaction diagram of the recommendation system modules provided by the present invention;
[0028] Fig. 9 It is a schematic diagram of the basic structure of the Tensorflow cluster provided by the present invention;
[0029] Fig.10 It is a block diagram of the curing module provided by the present invention;
[0030] Fig.11 It is a block diagram of the operation module provided by the present invention;
[0031] Fig.12 It is a block diagram of the working modules provided by the present invention;
[0032] Fig.13 It is a schematic diagram of the process of online recommendation provided by the present invention;
[0033] Fig.14 It is a schematic diagram of recommendation results of a neural network-based recommendation system for recommending videos to users provided by the present invention.
[0034] Fig.15 It is a schematic diagram of the hardware structure of a device provided by the present invention for implementing the method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0037] Neural networks trained in offline environments are difficult to be directly applied to business environments. There may be various reasons for this. For example, when applying deep learning models to online recommendation systems, in the process of applying neural networks in offline environments to business environments, it is necessary to overcome many problems, such as the incompatibility between the programming language used to build neural networks in offline environments and the business environment, the difficulty of loading neural networks in offline environments online, and the inability to meet the time-consuming requirements of the business using offline neural networks reconstructed online. In order to solve the technical problem that it is difficult to use neural networks trained in offline environments in business environments, an embodiment of the present invention provides a neural network processing method applied to an online system, such as Figure 1 As shown, the method includes:
[0038] S101. Obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network.
[0039] Specifically, the embodiments of the present invention do not limit the specific type of neural network model. The neural network model includes but is not limited to a deep learning neural network model, a reinforcement learning neural network model, a transfer learning neural network model or a deep reinforcement learning neural network model. The business environments in which various neural network models are applicable and the problems they solve may be different, and they can be selected according to the actual business scenario.
[0040] Furthermore, each neural network model may include one or more specific network structures. On the basis of selecting the neural network model, a specific network structure can also be selected according to the actual business scenario. Taking the deep learning neural network model as an example, it can be a specific network structure such as Wide&Deep, DeepFM, LSTM, etc.
[0041] The Wide&Deep model consists of two parts, the Wide part and the Deep part, which aims to enable the trained model to acquire both memorization and generalization capabilities.
[0042] The DeepFM model consists of two parts: a neural network part and a factorization machine part, which are responsible for extracting low-order features and high-order features respectively. These two parts share the same input, which is suitable for better mining user preferences in the recommendation system.
[0043] LSTM is a long short-term memory network, a time recursive neural network that is suitable for processing and predicting important events with relatively long intervals and delays in time series. In the recommendation system, it is suitable for application in serialized prediction scenarios.
[0044] Step S101 may be performed in a discrete environment. In order to obtain the target network continuously, step S101 may be performed at a fixed frequency. The specific execution method will be described in detail below.
[0045] S103. Obtain a model file corresponding to the target network by solidifying the model graph, wherein the model file includes a network structure and network parameters of the target network.
[0046] The network structure of the discrete training target network may include multiple neural nodes, and each neural node has its own corresponding parameters. The network parameters in this step include the parameters of each neural node. The embodiment of the present invention does not specifically limit the parameters of the neural nodes. The type of parameters is related to the specific type and specific structure of the target network. For example, the parameters can be the weight, threshold, number of links, etc. of the node.
[0047] Specifically, in the embodiment of the present invention, the network parameters and the network structure are integrated, the model parameters are solidified in the network structure of the target network by converting them into constants, and the consistency of the structure of the target network and the neural network used online in the business scenario is ensured by loading the model file in the business scenario. By loading the model file, the business environment can simultaneously obtain the network structure and network parameters of the target network.
[0048] S105. Load and run the model file in an online system, where the online system includes a running environment for the model file.
[0049] Specifically, the embodiment of the present invention enables the target network obtained by discrete training to be applied to the online system by loading the model file in the online system, and enables the online system to complete relevant business functions based on the target network by running the model file. Specifically, in order to enable the online system to run the model file, the embodiment of the present invention also provides an online system construction method, the method is as follows Figure 2 As shown, including:
[0050] S10. Extract the operators required by the neural network model and generate an operator library based on the extraction results.
[0051] Specifically, the operator is an operator required for the operation of the neural network model. The operations in various neural networks can be obtained according to the combination of related operators.
[0052] S20. Extract the network structure of the neural network model, and build an application basic library based on the extraction results and the operator library.
[0053] Specifically, the application base library is the basis for the online system to run the model file.
[0054] The network structure of the neural network model can be extracted from the neural network of the prior art through open source components, and the extracted results can be obtained by adaptively modifying the online system. The online system is used to provide users with various business services, so the application base library can be used in the form of a static library as the operating environment of the online system.
[0055] Specifically, before the static library is compiled, the operator library obtained in step S102 can be loaded into the system in the form of a compiled file, and the extraction result obtained in step S104 and the operator library can be compiled together in the form of a static library. The static library is used in the embodiment of the present invention because in the linking stage, the target file generated by the assembly will be linked and packaged into an executable file together with the referenced static library, which is more friendly to the use of the online system.
[0056] After the above-mentioned construction process, the online system in the embodiment of the present invention can support the model files obtained by various neural networks, thereby decoupling the online system from the neural network obtained in the discrete environment, and enabling the online system to have the ability to quickly provide business services based on the model files, thereby reducing business time consumption.
[0057] Furthermore, in order to enable the online system to provide continuous services to users, the embodiment of the present invention completes the loading and running of the model file based on multi-threading. During the process of the loading thread loading the model file, the running thread continuously provides business services to users based on the current model file of the online system until the loading thread completes loading the new model file, and the running thread switches to use the new model file to provide business services to users. Specifically, the embodiment of the present invention provides a neural network loading and running method based on multi-process, such as Figure 3 As shown, the method includes:
[0058] S1051. The running thread provides services based on the current model file of the online system, and the loading thread loads a new model file.
[0059] Specifically, the new model file may be the model file obtained in step S102. In order to timely obtain the model file obtained in the offline environment, the running thread in the embodiment of the present invention detects whether a new model file is generated at a preset time interval, and if so, starts the loading process.
[0060] Specifically, in order to provide business services to multiple users in parallel, there may be more than one loading thread and more than one running thread in the embodiment of the present invention.
[0061] Specifically, the running thread is used to obtain relevant information of the user, construct features according to the relevant information, and provide services based on the features and the model file.
[0062] S1053. If the new model file is loaded, the loading thread triggers the running thread to use the new model file to provide business services.
[0063] Specifically, the loading thread may trigger the running thread to use the new model file by modifying the update flag in the online system, or may trigger the running thread to use the new model file by sending a loading completion notification to the running thread.
[0064] Specifically, the loading thread loads a new model file, such as Figure 4 As shown, including:
[0065] S10511. Obtain a first summary of the model file.
[0066] Specifically, the first summary of the model file may be generated in step S103 and transmitted to the online system in step S105.
[0067] S10513. Extract key parameters of the model file, and determine whether the values of the key parameters are within a preset legal threshold to obtain a first prediction result.
[0068] In a feasible implementation manner, if the values of the key parameters are all within a preset legal threshold, the first prediction result is true, otherwise, it is false.
[0069] S10515. Obtain a second summary of the model file in the online system, and compare the first summary with the second summary to obtain a second prediction result.
[0070] In the feasible implementation manner, if the difference between the first digest and the second digest is smaller than a preset threshold, the second prediction result is true, otherwise, it is false.
[0071] S10517. Determine whether the model file is a model file to be loaded based on the first prediction result and the second prediction result.
[0072] In the feasible implementation manner, whether to load the model file can be determined based on the AND logical value of the first prediction result and the second prediction result. If the AND logical value is true, the model file is determined to be the model file to be loaded, and the model file can be loaded.
[0073] By using the first prediction result and the second prediction result to judge the model file before loading, logical errors caused by loading abnormal model files can be avoided, and loading of model files obtained by offline training failure can be avoided, as well as loading of model files whose file sizes do not meet the requirements can be avoided.
[0074] S10519. If yes, load the model file.
[0075] Further, if not, the model file is no longer loaded.
[0076] Furthermore, the neural network model is trained based on the training samples to obtain a discrete training target network such as Figure 5 As shown, including:
[0077] S1011. Obtain training data.
[0078] Specifically, the training data can be obtained by collecting big data and filtering out dirty data in the big data. In the embodiment of the present invention, the dirty data can be data that lacks key information or data generated by illegal behavior of users.
[0079] S1013. Sample the training data according to the acquired neural network model.
[0080] Specifically, sampling includes sampling positive and negative samples of training data, and the ratio of positive and negative samples is reasonable relative to the training of the neural network model, and the sampling process includes downsampling and oversampling.
[0081] S1015. Extract information from the sampling results to construct features, and train the neural network model based on the features. The feature construction method is the same as the feature construction method used in the online system.
[0082] Specifically, the feature construction method used in step S1015 is the same as the feature construction method used by the running thread, thereby ensuring that the offline trained neural network can be accurately and quickly applied to the online system.
[0083] The embodiment of the present invention provides a neural network processing method applied to an online system. By improving various links such as discrete training, solidification loading, and online application of the neural network, the consistency of the neural network applied by the online system and the neural network obtained by discrete environment training is ensured, the online development cost is reduced, the online development cycle of the neural network obtained by discrete environment training is shortened, and its online response speed is significantly improved.
[0084] Another embodiment of the present invention provides a neural network processing device applied in an online system, such as Figure 6 As shown, the device comprises:
[0085] The discrete training module 201 is used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network.
[0086] The solidification module 202 is used to obtain the model file corresponding to the target network by solidifying the model graph, and the model file includes the network structure and network parameters of the target network.
[0087] The running module 203 is used to load and run the model file in an online system, and the online system includes a running environment for the model file.
[0088] The embodiments of a neural network processing device and method for use in an online system disclosed in the embodiments of the present invention are based on the same inventive concept.
[0089] The neural network processing device and method applied to the online system described in the embodiment of the present invention can be used to provide users with a variety of business services. As a preferred implementation, the embodiment of the present invention specifically provides a recommendation system based on a neural network, and the recommendation system includes:
[0090] The discrete training module 301 is used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network.
[0091] Specifically, the discrete training module 301 is as follows: Figure 7As shown, including:
[0092] The model selection unit 3011 is used to select a neural network model for training.
[0093] The training data acquisition unit 3012 is used to acquire training data. The training unit 3011 can be used to effectively pre-process the original data to improve the training accuracy, and fuse the user's exposure log, playback log, video positive index and portrait feature log according to the user device number, and remove the dirty data with missing valid single features to ensure that the valid single feature information of each sample is not missing.
[0094] The sampling unit 3013 is used to sample the training data according to the obtained neural network model. In the specific sampling process, the sampling unit 3013 should not only keep the positive and negative samples in a reasonable ratio, but also filter the samples according to the requirements of the recommendation system. For example, for recommended videos, it is necessary to filter the samples whose playing time is below a certain threshold, and adopt a segmented threshold positive and negative sample setting scheme for different video lengths and viewing times. The specific execution also needs to be comprehensively considered in combination with the selected neural network model.
[0095] The first feature construction unit 3014 is used to construct features according to the information in the sampling result.
[0096] The model training unit 3015 trains the neural network model based on the features.
[0097] Specifically, Figure 8 As shown, the training data acquisition unit 3012, the sampling unit 3013 and the first feature construction unit 3014 of the discrete training module 301 can all be implemented based on the Spark offline computing cluster. Spark is a unified analysis engine for large-scale data processing and a fast and general cluster computing platform; and the model selection unit 3011 and the model training unit 3015 can be implemented based on the Tensorflow cluster. The Tensorflow cluster is an open source component that can be used for processing neural networks, such as Fig. 9 As shown, it shows the infrastructure of the Tensorflow cluster, which includes a user-oriented application logic layer that supports Phthon and C++ languages, a TensorAPI (application programming interface) that provides an interface for the application logic layer, and underlying Distributed master (distributed server), Dataflowexecutor (data flow executor), Network layers (network layer), and Device layers (hardware layer).
[0098] The solidification module 302 is used to obtain the model file corresponding to the target network by solidifying the model graph, and the model file includes the network structure and network parameters of the target network.
[0099] Specifically, the curing module 302 is as follows: Fig.10 As shown, including:
[0100] The solidification unit 3021 is used to obtain the model file; the model push unit 3022 is used to push the model file to the running module 303. Specifically, the model push unit 3022 pushes the finally obtained binary model file to the running module 303 by day or hour through a scheduled task according to a preset frequency, and at the same time generates a summary of the model file content and transmits it together to prepare for subsequent model verification.
[0101] The solidification unit 3021 and the model pushing unit 3022 are both implemented based on the Tensorflow cluster.
[0102] The running module 303 is used to load and run the model file in the online component of the recommendation system, and the online component of the recommendation system includes the running environment of the model file.
[0103] Specifically, the operation module 303 is as follows: Fig.11 As shown, including:
[0104] The operating environment component 3031 is used for the operators required by the neural network model and generates an operator library based on the extraction results; extracts the network structure of the neural network model and builds an application basic library based on the extraction results and the operator library.
[0105] The update module 3032 is used for verifying and loading new model files by the loading thread.
[0106] Working module 3033 is used to provide recommendation services to users based on the model file.
[0107] Specifically, the working module 3033 is as follows Fig.12 As shown, including:
[0108] The candidate pool unit 30331 is used to obtain user related information.
[0109] Specifically, the specific functions of the candidate pool unit 30331 may be related to the specific needs of the recommendation system. For example, the candidate pool unit 30331 may be applied to the recall or sorting functions of the recommendation system. When applied to the recall function, the candidate pool unit 30331 may pre-screen a portion of the information content based on the user's interest portrait; when applied to the sorting function, the candidate pool unit 30331 is the information content returned during the recall process.
[0110] The second feature construction unit 30332 is used to construct features based on user-related information. Specifically, the second feature construction unit 30332 is the same as the first feature construction unit 3014. Taking the DeepFM model for recommendation as an example, the operation module 303 receives user requests, obtains user-related information, and pre-recalls video information related to each user's interest when requested, and pulls out relevant features of each video information, which can be combined with user features to obtain a consistent feature format obtained by the first feature construction unit 3014.
[0111] The online prediction module 30333 is used to provide recommendation services to users through forward prediction of neural networks. Taking the DeepFM network as an example, when making recommendations, the predicted click-through rate score of the pre-recall video information of each user's relevant interest can be predicted, and the top N video information can be obtained as the final result according to the order of the scores.
[0112] Please refer to Fig.13 , which shows a flow chart for implementing online recommendation based on the functional modules of the above recommendation system. In the flow chart, the three steps of selecting a training model from the training library, sampling and obtaining training data, and constructing features based on the sampling information are sequentially executed in the Spark cluster; the model is trained in the Tensorflow cluster according to the model selection results and feature construction results to obtain the model, and subsequent solidification and model push are performed, wherein the results of the model selection are also pushed to the online recommendation system for operator expansion. In the online recommendation system, the automatic update of the model is achieved by verifying, solidifying, loading, and replacing the model; and the library that supports the operation of the model is obtained by combining the results of the operator expansion with the static library; the content of the candidate pool and the features constructed according to the user information are input into the model to realize online recommendation.
[0113] like Fig.14 As shown, it shows the recommendation results of a neural network-based recommendation system for recommending videos to users based on an embodiment of the present invention.
[0114] The neural network-based recommendation system provided by the embodiment of the present invention innovatively proposes a framework of lightweight general neural network discrete training results suitable for application in personalized recommendation systems, which can conveniently and quickly apply offline trained neural networks to online recommendation systems. The solution can be well integrated with the existing recommendation system framework, so that the online recommendation system can complete the forward prediction of the model under the premise of ensuring that the low time consumption requirements are met. At the same time, the network structure consistency of the offline training model and the online prediction model is ensured by solidification, which greatly reduces the online development cost and shortens the model online experimental development cycle. The technical solution mentioned in the embodiment of the present invention has been tested with various types of models and can meet the requirements of the recommendation system, improve the overall performance of the recommendation system, and its application in specific businesses has led to a significant improvement in various core indicators.
[0115] An embodiment of the present invention further provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the steps of a neural network processing method applied to an online system described in an embodiment of the present invention. The specific execution process can be specifically described in the method embodiment, and will not be repeated here.
[0116] Further, Fig.15 The hardware structure diagram of a device for implementing the method provided by the embodiment of the present invention is shown. The device may be a computer terminal, a mobile terminal or a server. The device may also participate in constituting the apparatus or recommendation system provided by the embodiment of the present invention. Fig.15 As shown, the computer terminal 10 (or mobile device 10 or server 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Fig.15 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig.15 More or fewer components as shown, or with Fig.15 Different configurations shown.
[0117] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0118] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned neural network processing method applied to the online system. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0119] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0120] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0121] It should be noted that the sequence of the embodiments of the present invention described above is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0122] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0123] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0124] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A neural network processing method applied in an online system, characterized in that: The method comprises: Acquire a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network; A model file corresponding to the target network is obtained by solidifying the model graph, wherein the model file includes a network structure and network parameters of the target network, and the network parameters of the target network in the model file are solidified in the network structure of the target network by converting them into constants; When the running thread of the online system detects the model file corresponding to the target network, the first summary of the model file is obtained; the online system includes a running environment of the model file; the running thread is used to detect whether a new model file is generated at a preset time interval; the running thread is also used to obtain relevant information of the user, construct features according to the relevant information, and provide business services based on the features and the current model file; Extracting key parameters of the model file, and determining whether the values of the key parameters are within a preset legal threshold to obtain a first prediction result; Obtaining a second summary of the model file in the online system, and comparing the first summary with the second summary to obtain a second prediction result; According to the first prediction result and the second prediction result, determining whether the model file is a model file to be loaded; If yes, the model file is loaded by the loading thread of the online system; If the new model file is loaded completely, the loading thread modifies the update flag in the online system to trigger the running thread to use the new model file to provide business services.
2. The method according to claim 1, characterized in that: The step of constructing the online system is also included, and the step of constructing the online system includes: Extract the operators required by the neural network model and generate an operator library based on the extraction results; The network structure of the neural network model is extracted, and an application basic library is constructed according to the extraction result and the operator library.
3. The method according to claim 1, characterized in that The step of training the neural network model based on the training sample to obtain a target network includes: Get training data; Sampling the training data according to the acquired neural network model; Information in the sampling results is extracted to construct features, and the neural network model is trained based on the features. The method for constructing the features is the same as the method for constructing the features used in the online system.
4. The method according to claim 1, characterized in that: The operating environment includes an application basic library compiled in the form of a static library, and the application basic library is constructed based on the operators required by the neural network model and the network structure of the neural network model.
5. A neural network processing device used in an online system, characterized in that: The device comprises: A discrete training module, used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network; A curing module, used for obtaining a model file corresponding to the target network by curing the model graph, wherein the model file includes a network structure and network parameters of the target network, and the network parameters of the target network in the model file are converted into constants and cured in the network structure of the target network; A running module, used for obtaining a first summary of the model file when the running thread of the online system detects the model file corresponding to the target network; the online system includes a running environment for the model file; the running thread is used to detect whether a new model file is generated at a preset time interval; the running thread is also used to obtain relevant information of the user, construct features based on the relevant information, and provide business services based on the features and the current model file; extract key parameters of the model file, and determine whether the values of the key parameters are within a preset legal threshold to obtain a first prediction result; obtain a second summary of the model file in the online system, compare the first summary and the second summary to obtain a second prediction result; determine whether the model file is a model file to be loaded based on the first prediction result and the second prediction result; if so, the model file is loaded by the loading thread of the online system; if the new model file is loaded, the loading thread modifies the update flag in the online system to trigger the running thread to use the new model file to provide business services.
6. The device according to claim 5, characterized in that The operating environment includes an application basic library compiled in the form of a static library, and the application basic library is constructed based on the operators required by the neural network model and the network structure of the neural network model.
7. A recommendation system based on a neural network, characterized in that: The system comprises: A discrete training module, used to obtain a neural network model and training samples, and train the neural network model based on the training samples to obtain a target network; A curing module, used for obtaining a model file corresponding to the target network by curing the model graph, wherein the model file includes a network structure and network parameters of the target network, and the network parameters of the target network in the model file are converted into constants and cured in the network structure of the target network; A running module, used for obtaining a first summary of the model file when the running thread of the online system detects the model file corresponding to the target network; the online system includes a running environment for the model file; the running thread is used to detect whether a new model file is generated at a preset time interval; the running thread is also used to obtain relevant information of the user, construct features based on the relevant information, and provide business services based on the features and the current model file; extract key parameters of the model file, and determine whether the values of the key parameters are within a preset legal threshold to obtain a first prediction result; obtain a second summary of the model file in the online system, compare the first summary and the second summary to obtain a second prediction result; determine whether the model file is a model file to be loaded based on the first prediction result and the second prediction result; if so, the model file is loaded by the loading thread of the online system; if the new model file is loaded, the loading thread modifies the update flag in the online system to trigger the running thread to use the new model file to provide business services.
8. The system according to claim 7, characterized in that: The discrete training module includes: A model selection unit, used to select a neural network model for training; A training data acquisition unit, used to acquire training data; A sampling unit, used for sampling the training data according to the acquired neural network model; A first feature construction unit, used to construct features according to information in the sampling result; A model training unit is used to train the neural network model based on the features.
9. The system according to claim 7, characterized in that: The operation module includes: An operating environment component is used for the operators required by the neural network model, and generates an operator library based on the extraction results; extracts the network structure of the neural network model, and builds an application basic library based on the extraction results and the operator library; Update module, used for verifying and loading new model files by the loading thread; Working module, used to provide recommendation services to users based on model files; The working module includes: A candidate pool unit, used to obtain user related information; A second feature construction unit, used to construct features according to user related information, the second feature construction unit is the same as the first feature construction unit; The online prediction module is used to provide recommendation services to users through forward prediction of neural networks.
10. The system according to claim 7, characterized in that The operating environment includes an application basic library compiled in the form of a static library, and the application basic library is constructed based on the operators required by the neural network model and the network structure of the neural network model.
11. A computer-readable storage medium for storing a program, characterized in that: When the program is executed, the neural network processing method applied in an online system according to any one of claims 1 to 4 is implemented.
