Multi-stream association method, device, electronic device and computer-readable storage medium
By selecting the main data stream with high correlation from multiple real-time data streams in the big data real-time processing engine, and saving target data that meets the conditions, and making associations based on preset rules, multiple data stream associations in the prior art are solved The problem of poor results improves the comprehensiveness and accuracy of the associated results.
Patent Information
- Application Number
- CN202110152426.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-03
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-02-03
AI Technical Summary
The existing big data real-time processing engine is not effective when processing multiple data streams associations, especially when the scene is complex, it cannot provide good correlation effects.
By obtaining the main data stream with the correlation number not less than the preset threshold from multiple real-time data streams, and saving the target data that meets the preset cache conditions in other real-time data streams in the cache, it is based on the preset association rules and the main data stream. Make association and output association results.
It improves the comprehensiveness and accuracy of the association results of multiple data streams, ensures that the main data stream is related to other data streams, and enhances the accuracy of the association results.
Smart Images

Figure CN114595250B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology. Specifically, the present application relates to a multi-stream association method, device, electronic device, and computer-readable storage medium. Background Art
[0002] In the field of real-time computing, real-time statistical analysis of user behavior and pushing the most relevant products to users based on their behavior is a very important part of various service industries. In practical applications, it is usually necessary to combine multiple user data streams from different channels to infer the user's current actions and make product recommendations based on the current actions.
[0003] Currently, mainstream big data real-time processing engines all support the association of real-time data streams from two different channels. The association of two data streams can meet some application scenarios, but when the factors that need to be considered in the scenario increase and three or more data streams are introduced, the existing technology cannot provide a good association effect. Summary of the invention
[0004] The present application provides a method, device, electronic device and computer-readable storage medium for associating multiple streams, which can solve the problem of associating multiple data streams. The technical solution is as follows:
[0005] In a first aspect, a multi-stream association method is provided, the method comprising:
[0006] Obtaining a main data stream from multiple real-time data streams; wherein the correlation coefficient between the main data stream and the other real-time data streams is not less than a first preset threshold; the other real-time data streams are real-time data streams other than the main data stream in the multiple real-time data streams;
[0007] Obtain target data that meets preset cache conditions from data of other real-time data streams, and save the target data in the cache;
[0008] Based on the preset association rules, the main data stream is associated with the target data in sequence, and the association results are output.
[0009] In a second aspect, a multi-stream association device is provided, the device comprising:
[0010] An acquisition module, used to acquire a main data stream from multiple real-time data streams; wherein the correlation coefficient between the main data stream and the other real-time data streams is not less than a first preset threshold; and the other real-time data streams are real-time data streams other than the main data stream in the multiple real-time data streams;
[0011] A saving module is used to obtain target data that meets preset cache conditions from data of other real-time data streams and save the target data in a cache;
[0012] The output module is used to associate the main data stream with the target data in sequence based on the preset association rules, and output the association results.
[0013] In a third aspect, an electronic device is provided, the electronic device comprising:
[0014] one or more processors;
[0015] Memory;
[0016] One or more applications, wherein the one or more applications are stored in a memory and configured to be executed by one or more processors, and the one or more programs are configured to perform operations corresponding to the multi-stream association method shown in the first aspect of the present application.
[0017] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the multi-stream association method shown in the first aspect of the present application is implemented.
[0018] The beneficial effects of the technical solution provided by this application are:
[0019] The present application obtains a real-time data stream with a correlation coefficient not less than a first preset threshold value as a main data stream from multiple real-time data streams, so that the main data stream is connected with other real-time data, thereby improving the comprehensiveness of the correlation result, and saves the target data that meets the caching conditions in other real-time data streams in the cache, and uses the main data stream to associate with the target data based on the preset association rules, thereby improving the accuracy of the association result. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0021] Figure 1 A schematic diagram of a multi-stream association method provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of the association relationship between real-time data streams provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of storing target data in a cache provided in an embodiment of the present application;
[0024] Figure 4 A flowchart of another multi-stream association method provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of the structure of a multi-stream association device provided in an embodiment of the present application;
[0026] Figure 6 A schematic diagram of the structure of a multi-stream associated electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.
[0028] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0029] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0030] The multi-stream association method, device, electronic device, and computer-readable storage medium provided in the present application are intended to solve the above technical problems in the prior art.
[0031] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0032] The present application provides a method for associating multiple streams. Figure 1 As shown, the method includes:
[0033] Step S101: obtaining a main data stream from multiple real-time data streams; wherein the correlation coefficient between the main data stream and other real-time data streams is not less than a first preset threshold; and other real-time data streams are real-time data streams other than the main data stream in the multiple real-time data streams.
[0034] Among them, the real-time data stream may include the data stream involved in the application currently being used by the user. The correlation coefficient between the main data stream and the other real-time data streams is not less than the first preset threshold value. It can be understood that the main data stream is the data stream that appears more times in the data streams involved in the application currently being used by the user, that is, the main data stream can be associated with other real-time data streams; other real-time data streams are real-time data streams other than the main data stream among multiple real-time data streams.
[0035] It can be understood that in the process of associating multiple data streams, compared with blindly and baselessly associating data, by first selecting a main data stream with a larger correlation coefficient and then associating the main data stream with the data in other data streams, the accuracy and efficiency of the association can be improved.
[0036] In one embodiment of the present application, obtaining a main data stream from multiple real-time data streams includes:
[0037] (1) For any real-time data stream, determine the association relationship between the real-time data stream and real-time data streams other than the real-time data stream.
[0038] (2) Determine the correlation coefficient corresponding to each correlation relationship.
[0039] (3) The real-time data stream whose correlation coefficient is not less than the first preset threshold is determined as the main data stream.
[0040] It can be understood that, in the process of acquiring the main data stream, for each real-time data stream in the real-time data stream, the correlation coefficient of the real-time data stream is determined according to the correlation relationship between the real-time data stream and other real-time data streams.
[0041] For example, taking the scenario of ordering food in a shopping mall, multiple real-time data streams include the user's real-time location stream, i.e., the user's current location, the first real-time business stream, i.e., the application that locks the user's order in the ordering system, and the second real-time business stream, i.e., the application currently used by the user (such as a game program).
[0042] like Figure 2 As shown, Figure 2 It shows the association relationship between multiple real-time data streams and the association coefficient corresponding to each real-time data stream. Among them, the location stream has an association relationship with both the first real-time service stream and the second real-time service stream, that is, the association coefficient of the real-time location stream is 2, and the association coefficient of the first real-time service stream and the second real-time service stream is 1, so the user's real-time location stream can be determined as the main data stream.
[0043] Step S102: acquiring target data satisfying a preset cache condition from data of other real-time data streams, and storing the target data in a cache.
[0044] It is understandable that in the process of associating multiple data streams, the feasibility of associating the data in the multiple data streams needs to be considered, that is, the data in the real-time data stream that meets the preset caching conditions can be determined as the target data that can be associated. Furthermore, the target data that can be associated can also be saved in the cache to cope with subsequent possible association operations.
[0045] In one embodiment of the present application, target data in the cache whose storage time exceeds the storage time threshold may be deleted based on the set storage time threshold.
[0046] It is understandable that if all data that meets the preset caching conditions are saved in the cache, as the data flow increases, the amount of data becomes larger and larger, which may cause memory leakage problems. Therefore, a storage time threshold can be set, such as 10 minutes. If the storage time of the target data saved in the cache exceeds ten minutes, the target data whose storage time exceeds the storage time threshold can be automatically deleted.
[0047] In one embodiment of the present application, obtaining target data that meets a preset cache condition from data of other real-time data streams and storing the target data in a cache includes:
[0048] For each first real-time data stream in other real-time data streams, if the timestamp of the data in the first real-time data stream is greater than the watermark time set for the first real-time data stream, the data in the first real-time data stream is determined as target data and the target data is saved in the cache.
[0049] Among them, each real-time data stream generally includes multiple data, each of which has its own timestamp, that is, the production time when the data is produced; each real-time data stream includes a watermark time set for the real-time data stream, that is, the threshold time of the real-time data stream.
[0050] It can be understood that the preset caching condition can be that the timestamp of the data in the first real-time data stream is earlier than the watermark time of the first real-time data stream, the data determined as the target data can be the data in the first real-time data stream that has not undergone data delay, and the determined target data is saved in the cache.
[0051] like Figure 3 As shown, Figure 3 A schematic diagram of storing target data in a cache.
[0052] Among them, the watermark time of the first real-time data stream is T1, and the first real-time data stream includes data 1, data 2 and other data. The timestamp of data 1 is t1, the timestamp of data 2 is t2, and t1 is earlier than T1, and t2 is later than T1. Therefore, data 1 can be determined as the target data and data 1 can be saved in the cache.
[0053] For the second real-time data stream, the watermark time of the second real-time data stream is T2. The second real-time data stream includes data 3, data 4 and other data. The timestamp of data 3 is t3, the timestamp of data 4 is t4, and t3 is earlier than T2, and t4 is later than T2. Therefore, data 3 can be determined as the target data and data 3 can be saved in the cache.
[0054] It should be noted that, in one embodiment of the present application, in order to ensure the accuracy of the recommended data output after the data stream is associated, for delayed data, that is, data whose timestamp is later than the watermark time of the data stream corresponding to the data, the timestamp of the data within the delay threshold range can be modified according to the preset delay threshold, and the data after the timestamp is modified can meet the preset caching conditions and be saved in the cache as target data.
[0055] Step S103: Based on the preset association rules, the main data stream is associated with the target data in sequence, and the association result is output.
[0056] The preset association rule includes a set association order, and the association result includes the recommended data output after the main data stream is sequentially associated with the target data.
[0057] It can be understood that since the target data included in the cache has a set storage time, when associating the main data stream with the target data in the cache, the target data in the cache can be associated in sequence according to the size of the remaining time of the target data to ensure the comprehensiveness of the association result; optionally, the target data in the cache can also be associated in sequence according to the degree of association between the target data and the data in the main data stream to ensure the accuracy of the association result.
[0058] The present application obtains a real-time data stream with a correlation coefficient not less than a first preset threshold value as a main data stream from multiple real-time data streams, so that the main data stream is connected with other real-time data, thereby improving the comprehensiveness of the correlation result, and saves the target data that meets the caching conditions in other real-time data streams in the cache, and uses the main data stream to associate with the target data based on the preset association rules, thereby improving the accuracy of the association result.
[0059] In one embodiment of the present application, if the association result after the association is completed meets the preset output condition, the association result is output.
[0060] The preset output condition may be that the subject performing the association operation is consistent, that is, the real-time data stream is a data stream for the same terminal, or the output time of the association result to be output is within a set time range.
[0061] Taking the ordering scenario in a shopping mall as an example, multiple real-time data streams include the user's real-time location stream, i.e., the user's current location, the first real-time business stream, i.e., the application that locks the user's sorting in the ordering system, and the second real-time business stream, i.e., the application currently used by the user (such as a game program). The data stream included in the output association result can be a recommended traffic package or a lighter game program. At this time, the output condition of the association result can be that the user is still sorting in the ordering system, or that the currently used application is stuck.
[0062] In one embodiment of the present application, if the association result after the association is completed does not meet the preset output condition, the first data in the main data stream is extracted, and the first data is resent to the main data stream, so that the main data stream is associated with the target data according to the re-received first data to obtain a first association result;
[0063] If the first association result meets the preset output condition, the first association result is output.
[0064] It is understandable that if the results of the upstream data association flow to the downstream very late, and the downstream data has been cleaned up due to expiration, the accuracy of the association result at this time will be reduced, and the association result can be considered to not meet the preset output conditions. At this time, the association result can be directly discarded, or the cleaned data can be replayed and associated again.
[0065] Specifically, in one embodiment of the present application, the first data may be data that is in the downstream of the main data stream and has not yet been associated. Resending the first data to the main data stream can be understood as modifying the timestamp of the first data in the main data stream, so that the first data can continue to be associated with the target data in the cache to ensure the accuracy of the output association result.
[0066] It should be noted that, in one embodiment of the present application, if the target data in the cache is automatically cleared due to not waiting for the association result of the upstream data, it will also cause inaccurate association results. Therefore, the target data in the cache that has been cleared but not yet associated can also be replayed, that is, the timestamp of the target data that has been cleared but not yet associated can be modified so that these data can continue to be associated with the data in the main data stream to ensure the accuracy of the output association results.
[0067] In one embodiment of the present application, extracting first data from a main data stream and resending the first data to the main data stream includes:
[0068] The number of extractions of data in the main data stream is obtained. If the number of extractions is less than a preset extraction number threshold, the first data in the main data stream is extracted and the first data is resent to the main data stream.
[0069] It is understandable that in order to prevent an infinite loop, a threshold value for the number of extractions of data can be set, that is, a threshold value for the number of data playbacks can be set. Specifically, for the main data stream, a threshold value for the number of extractions of data in the main data stream can be set. When the obtained association result still does not meet the preset output condition and the number of extractions is less than the preset extraction threshold value, the data in the main data stream can be extracted, and the extracted data can be re-associated with the target data in the cache to obtain a highly accurate association result.
[0070] In order to better understand the present application, the present application provides a specific embodiment of multi-stream association, such as Figure 4 shown.
[0071] Specifically, in the process of multi-stream association, initialization can be performed first, that is, the main data stream is determined, and the target data in other real-time data streams that meet the preset caching conditions are saved in the cache, wherein the preset caching conditions can be that the timestamp of the data in each real-time data stream is earlier than the watermark time set for the real-time data stream.
[0072] Then the main data stream is associated with the target data in the cache. Specifically, when associating the main data stream with the target data in the cache, certain association rules can be used, such as associating according to the early and late timestamps of each data in the cache, or associating according to the remaining storage time of each data.
[0073] After obtaining the associated result, it can be further determined whether the associated result meets the preset output conditions, such as whether the subject performing the associated operation is consistent, whether the output time of the output associated result is within the set time range, etc.
[0074] If the above-mentioned preset output conditions are met, the association results can be directly output. If the above-mentioned preset output conditions are not met, it can be further determined whether the data needs to be replayed. It can be understood that for the main data stream and the destination data, if some delayed data is not associated, or the destination data in the cache is automatically cleared, resulting in the inability to output the association results, then these data can be replayed, that is, the data can be associated again.
[0075] If the data does not need to be replayed, the association operation can be terminated directly. If the data needs to be replayed, it is also necessary to determine whether the maximum number of replays has been reached. It is understandable that if the playback is unlimited, it will lead to an infinite loop of data. Therefore, when the number of revisits is less than the set number of replays, the data that has not been associated but has been cleaned up in the main data stream can be extracted and put back into the main data stream, so that the main data stream can be re-associated with the target data in the cache to obtain accurate association results.
[0076] The present application embodiment provides a multi-stream association device, such as Figure 5 As shown, the multi-stream association device 50 may include: an acquisition module 501, a storage module 502 and an output module 503, wherein:
[0077] The acquisition module 501 is used to acquire a main data stream from multiple real-time data streams; wherein the correlation coefficient between the main data stream and other real-time data streams is not less than a first preset threshold; and other real-time data streams are real-time data streams other than the main data stream in the multiple real-time data streams.
[0078] Among them, the real-time data stream may include the data stream involved in the application currently being used by the user. The correlation coefficient between the main data stream and the other real-time data streams is not less than the first preset threshold value. It can be understood that the main data stream is the data stream that appears more times in the data streams involved in the application currently being used by the user, that is, the main data stream can be associated with other real-time data streams; other real-time data streams are real-time data streams other than the main data stream among multiple real-time data streams.
[0079] It can be understood that in the process of associating multiple data streams, compared with blindly and baselessly associating data, by first selecting a main data stream with a larger correlation coefficient and then associating the main data stream with the data in other data streams, the accuracy and efficiency of the association can be improved.
[0080] In one embodiment of the present application, the acquisition module 501 includes:
[0081] The first determining submodule is used to determine, for any real-time data stream, an association relationship between the real-time data stream and other real-time data streams except the real-time data stream.
[0082] The second determining submodule is used to determine the correlation coefficient corresponding to each correlation relationship.
[0083] The third determination submodule is used to determine the real-time data flow whose correlation coefficient is not less than the first preset threshold as the main data flow.
[0084] It can be understood that, in the process of acquiring the main data stream, for each real-time data stream in the real-time data stream, the correlation coefficient in the real-time data is determined according to the correlation relationship between the real-time data stream and other real-time data streams.
[0085] For example, taking the scenario of ordering food in a shopping mall, multiple real-time data streams include the user's real-time location stream, i.e., the user's current location, the first real-time business stream, i.e., the application that locks the user's order in the ordering system, and the second real-time business stream, i.e., the application currently used by the user (such as a game program).
[0086] like Figure 2 As shown, Figure 2 It shows the association relationship between multiple real-time data streams and the association coefficient corresponding to each real-time data stream. Among them, the location stream is associated with both the first real-time service stream and the second real-time service stream, and the first real-time service stream has no association with the second real-time service stream, that is, the association coefficient of the real-time location stream is 2, and the association coefficient of the first real-time service stream and the second real-time service stream is 1, so the user's real-time location stream can be determined as the main data stream.
[0087] The saving module 502 is used to obtain target data that meets the preset cache condition from the data of other real-time data streams, and save the target data in the cache.
[0088] It is understandable that in the process of associating multiple data streams, the feasibility of associating the data in the multiple data streams needs to be considered, that is, the data in the real-time data stream that meets the preset caching conditions can be determined as the target data that can be associated. Furthermore, the target data that can be associated can also be saved in the cache to cope with subsequent possible association operations.
[0089] In one embodiment of the present application, the multi-stream association device 50 includes:
[0090] The deletion module is used to delete target data in the cache whose storage time exceeds the storage time threshold based on the set storage time threshold.
[0091] It is understandable that if all data that meets the preset caching conditions are saved in the cache, as the data flow increases, the amount of data becomes larger and larger, which may cause memory leakage problems. Therefore, a storage time threshold can be set, such as 10 minutes. If the storage time of the target data saved in the cache exceeds ten minutes, the target data whose storage time exceeds the storage time threshold can be automatically deleted.
[0092] In one embodiment of the present application, the storage module 502 includes:
[0093] The saving submodule is used to determine the data in the first real-time data stream as target data and save the target data in the cache for each first real-time data stream in other real-time data streams if the timestamp of the data in the first real-time data stream is greater than the watermark time set for the first real-time data stream.
[0094] Among them, each real-time data stream generally includes multiple data, each of which has its own timestamp, that is, the production time when the data is produced; each real-time data stream includes a watermark time set for the real-time data stream, that is, the threshold time of the real-time data stream.
[0095] It can be understood that the preset caching condition can be that the timestamp of the data in the first real-time data stream is earlier than the watermark time of the first real-time data stream, the data determined as the target data can be the data in the first real-time data stream that has not undergone data delay, and the determined target data is saved in the cache.
[0096] It should be noted that, in one embodiment of the present application, in order to ensure the accuracy of the recommended data output after the data stream is associated, for delayed data, that is, data whose timestamp is later than the watermark time of the data stream corresponding to the data, the timestamp of the data within the delay threshold range can be modified according to the preset delay threshold, and the data after the timestamp is modified can meet the preset caching conditions and be saved in the cache as target data.
[0097] like Figure 3 As shown, Figure 3 A schematic diagram of storing target data in a cache.
[0098] Among them, the watermark time of the first real-time data stream is T1, and the first real-time data stream includes data 1, data 2 and other data. The timestamp of data 1 is t1, the timestamp of data 2 is t2, and t1 is earlier than T1, and t2 is later than T1. Therefore, data 1 can be determined as the target data and data 1 can be saved in the cache.
[0099] For the second real-time data stream, the watermark time of the second real-time data stream is T2. The second real-time data stream includes data 3, data 4 and other data. The timestamp of data 3 is t3, the timestamp of data 4 is t4, and t3 is earlier than T2, and t4 is later than T2. Therefore, data 3 can be determined as the target data and data 3 can be saved in the cache.
[0100] The output module 501 is used to associate the main data stream with the target data in sequence based on a preset association rule, and output the association result.
[0101] The preset association rule includes a set association order, and the association result includes the recommended data output after the main data stream is sequentially associated with the target data.
[0102] It can be understood that since the target data included in the cache has a set storage time, when associating the main data stream with the target data in the cache, the target data in the cache can be associated in sequence according to the size of the remaining time of the target data to ensure the comprehensiveness of the association result; optionally, the target data in the cache can also be associated in sequence according to the degree of association between the target data and the data in the main data stream to ensure the accuracy of the association result.
[0103] The present application obtains a real-time data stream with a correlation coefficient not less than a first preset threshold value as a main data stream from multiple real-time data streams, so that the main data stream is connected with other real-time data, thereby improving the comprehensiveness of the correlation result, and saves the target data that meets the caching conditions in other real-time data streams in the cache, and uses the main data stream to associate with the target data based on the preset association rules, thereby improving the accuracy of the association result.
[0104] In one embodiment of the present application, the output module 503 includes:
[0105] The first output submodule is used to output the association result if the association result after the association is completed meets the preset output condition.
[0106] The preset output condition may be that the subject performing the association operation is consistent, that is, the real-time data stream is a data stream for the same terminal, or the output time of the association result to be output is within a set time range.
[0107] Taking the ordering scenario in a shopping mall as an example, multiple real-time data streams include the user's real-time location stream, i.e., the user's current location, the first real-time business stream, i.e., the application that locks the user's sorting in the ordering system, and the second real-time business stream, i.e., the application currently used by the user (such as a game program). The data stream included in the output association result can be a recommended traffic package or a lighter game program. At this time, the output condition of the association result can be that the user is still sorting in the ordering system, or that the currently used application is stuck.
[0108] In one embodiment of the present application, the output module 503 includes:
[0109] An extraction submodule, configured to extract the first data in the main data stream and resend the first data to the main data stream if the association result after the association does not meet the preset output condition, so that the main data stream is associated with the target data according to the re-received first data to obtain a first association result;
[0110] The second output submodule is used to output the first association result if the first association result meets a preset output condition.
[0111] It is understandable that if the results of the upstream data association flow to the downstream very late, and the downstream data has been cleaned up due to expiration, the accuracy of the association result at this time will be reduced, and the association result can be considered to not meet the preset output conditions. At this time, the association result can be directly discarded, or the cleaned data can be replayed and associated again.
[0112] Specifically, in one embodiment of the present application, the first data may be data that is in the downstream of the main data stream and has not yet been associated. Resending the first data to the main data stream can be understood as modifying the timestamp of the first data in the main data stream, so that the first data can continue to be associated with the target data in the cache to ensure the accuracy of the output association result.
[0113] It should be noted that, in one embodiment of the present application, if the target data in the cache is automatically cleared due to not waiting for the association result of the upstream data, it will also cause inaccurate association results. Therefore, the target data in the cache that has been cleared but not yet associated can also be replayed, that is, the timestamp of the target data that has been cleared but not yet associated can be modified so that these data can continue to be associated with the data in the main data stream to ensure the accuracy of the output association results.
[0114] In one embodiment of the present application, the extraction submodule includes:
[0115] The sending unit is used to obtain the number of extractions for the data in the main data stream, and if the number of extractions is less than a preset extraction number threshold, extract the first data in the main data stream and resend the first data to the main data stream.
[0116] It is understandable that in order to prevent an infinite loop, a threshold value for the number of extractions of data can be set, that is, a threshold value for the number of data playbacks can be set. Specifically, for the main data stream, a threshold value for the number of extractions of data in the main data stream can be set. When the obtained association result still does not meet the preset output condition and the number of extractions is less than the preset extraction threshold value, the data in the main data stream can be extracted, and the extracted data can be re-associated with the target data in the cache to obtain a highly accurate association result.
[0117] An electronic device is provided in an embodiment of the present application. The electronic device includes: a memory and a processor; at least one program stored in the memory, and when executed by the processor, compared with the prior art, the following can be achieved:
[0118] The present application obtains a real-time data stream with a correlation coefficient not less than a first preset threshold value as a main data stream from multiple real-time data streams, so that the main data stream is connected with other real-time data, thereby improving the comprehensiveness of the correlation result, and saves the target data that meets the caching conditions in other real-time data streams in the cache, and uses the main data stream to associate with the target data based on the preset association rules, thereby improving the accuracy of the association result.
[0119] In an alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0120] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0121] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0122] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0123] The memory 4003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the contents shown in the above method embodiment.
[0124] The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment. Compared with the prior art:
[0125] The present application obtains a real-time data stream with a correlation coefficient not less than a first preset threshold value as a main data stream from multiple real-time data streams, so that the main data stream is connected with other real-time data, thereby improving the comprehensiveness of the correlation result, and saves the target data that meets the caching conditions in other real-time data streams in the cache, and uses the main data stream to associate with the target data based on the preset association rules, thereby improving the accuracy of the association result.
[0126] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0127] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A multi-stream association method, characterized in that: include: For any real-time data stream, determining the association relationship between the real-time data stream and other real-time data streams except the real-time data stream according to the data dimension included in the real-time data stream; the real-time data stream includes the data stream involved in the application currently being used by the user; Determine a correlation coefficient corresponding to each correlation relationship, and determine the correlation coefficient of the real-time data stream according to the sum of the correlation coefficients corresponding to the various correlation relationships of the real-time data stream; Determine a real-time data stream whose correlation coefficient is not less than a first preset threshold as a main data stream; wherein the correlation coefficient between the main data stream and other real-time data streams is not less than the first preset threshold; and the other real-time data streams are real-time data streams other than the main data stream among multiple real-time data streams; Acquire target data that meets a preset cache condition from the data of the other real-time data streams, and store the target data in a cache; Based on the preset association rules, the main data stream is associated with the target data in sequence, and the association result is output.
2. The method according to claim 1, characterized in that The step of acquiring target data satisfying a preset cache condition from the data of the other real-time data streams and storing the target data in a cache comprises: For each first real-time data stream in the other real-time data streams, if the timestamp of the data in the first real-time data stream is greater than the watermark time set for the first real-time data stream, the data in the first real-time data stream is determined as the target data, and the target data is saved in the cache.
3. The method according to claim 2, characterized in that The method further comprises: Based on the set preservation time threshold, target data in the cache whose preservation time exceeds the preservation time threshold is deleted.
4. The method according to claim 1, characterized in that: The method of sequentially associating the main data stream with the target data based on a preset association rule and outputting an association result includes: If the association result after the association is completed meets the preset output condition, the association result is output.
5. The method according to claim 1, characterized in that The method of sequentially associating the main data stream with the target data based on a preset association rule and outputting an association result includes: If the association result after the association is completed does not meet the preset output condition, extract the first data in the main data stream, and resend the first data to the main data stream, so that the main data stream is associated with the target data according to the re-received first data to obtain a first association result; If the first association result meets the preset output condition, the first association result is output.
6. The method according to claim 5, characterized in that The extracting the first data from the main data stream and resending the first data to the main data stream comprises: The number of extractions of data in the main data stream is obtained. If the number of extractions is less than a preset extraction number threshold, the first data in the main data stream is extracted and the first data is resent to the main data stream.
7. A multi-stream association device, characterized in that: include: An acquisition module, for determining, for any real-time data stream, an association relationship between the real-time data stream and other real-time data streams except the real-time data stream according to data dimensions contained in the real-time data stream; the real-time data stream includes a data stream involved in an application currently being used by a user; Determine a correlation coefficient corresponding to each correlation relationship, and determine the correlation coefficient of the real-time data stream according to the sum of the correlation coefficients corresponding to the various correlation relationships of the real-time data stream; Determine a real-time data stream whose correlation coefficient is not less than a first preset threshold as a main data stream; wherein the correlation coefficient between the main data stream and other real-time data streams is not less than the first preset threshold; and the other real-time data streams are real-time data streams other than the main data stream among multiple real-time data streams; A storage module, used for acquiring target data satisfying a preset cache condition from the data of the other real-time data streams, and storing the target data in a cache; The output module is used to associate the main data stream with the target data in sequence based on a preset association rule, and output the association result.
8. An electronic device, characterized in that: It includes: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the multi-stream association method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the multi-stream association method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
An association completion method for multi-channel real-time stream data
CN109726237A
Data stream storage method and device
CN111240599A
Real-time recommendation system design method
CN111931066A