CN110309425B - Method and apparatus for storing data - Google Patents

Method and apparatus for storing data Download PDF

Info

Publication number
CN110309425B
CN110309425B CN201910602226.1A CN201910602226A CN110309425B CN 110309425 B CN110309425 B CN 110309425B CN 201910602226 A CN201910602226 A CN 201910602226A CN 110309425 B CN110309425 B CN 110309425B
Authority
CN
China
Prior art keywords
matrix
array
user
function
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910602226.1A
Other languages
Chinese (zh)
Other versions
CN110309425A (en
Inventor
王浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Douyin Vision Beijing Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910602226.1A priority Critical patent/CN110309425B/en
Publication of CN110309425A publication Critical patent/CN110309425A/en
Application granted granted Critical
Publication of CN110309425B publication Critical patent/CN110309425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the present disclosure disclose methods and apparatus for storing data. One embodiment of the method comprises: acquiring a matrix to be processed; acquiring an objective function which is pre-constructed based on a matrix to be processed, wherein the objective function is used for representing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix; adjusting the target function to determine a first matrix which enables the value of the target function to be minimum as a target first matrix; determining the sequence number of a non-zero first array of a target first matrix, selecting and storing a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array. The embodiment realizes the compressed storage of the matrix to be processed.

Description

Method and apparatus for storing data
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and an apparatus for storing data.
Background
In some cases, the amount of data to be processed is very large, which results in a long data processing process and requires more hardware and software resources. In still other cases, the data that needs to be processed cannot be completely statistical or is more difficult to completely statistical. Generally, for these cases, a sample extraction method is used to extract a part of data from the data to be processed as a sample for processing, and various attribute information of the data to be processed is analyzed according to the obtained processing result.
Disclosure of Invention
Embodiments of the present disclosure propose methods and apparatuses for storing data.
In a first aspect, an embodiment of the present disclosure provides a method for storing data, the method including: acquiring a matrix to be processed; acquiring an objective function which is pre-constructed based on a matrix to be processed, wherein the objective function is used for representing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix; adjusting the target function to determine a first matrix which enables the value of the target function to be minimum as a target first matrix; determining the sequence number of a non-zero first array of a target first matrix, selecting and storing a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
In some embodiments, the number and position of the non-zero elements included in the first matrix are used to control the value of the first sub-targeting function, and the number of the non-zero first arrays of the first matrix is used to control the value of the second sub-targeting function.
In some embodiments, the first sub-targeting function is a quadratic function.
In some embodiments, the first sub-targeting function is positively correlated with a sum of squares of elements comprised by a difference matrix, wherein the difference matrix is determined by a difference of the matrix to be processed and a product matrix, wherein the product matrix is determined by a product of the matrix to be processed and the first matrix.
In some embodiments, the second sub-targeting function is positively correlated to the sum of the two norms of the first arrays of the first matrix.
In some embodiments, the second sub-objective function is used to characterize a sum of the first function and the second function, wherein the decision variables of the objective function, the first function, and the second function comprise a first vector, wherein the number of non-zero first arrays of the first matrix is positively correlated with the number of non-zero elements of the first vector.
In some embodiments, the first function is positively correlated with a sum of a target number of quotient values, wherein the target number is a number of elements included in the first vector, and the target number of quotient values are a quotient of a square of a two-norm of each first array of the first matrix and an element included in the first vector and corresponding to the sequence number, respectively.
In some embodiments, the second function is positively correlated to a norm of the first vector.
In a second aspect, an embodiment of the present disclosure provides an apparatus for storing data, the apparatus including: a to-be-processed matrix acquisition unit configured to acquire a to-be-processed matrix; the target function acquisition unit is configured to acquire a target function which is constructed in advance based on a matrix to be processed, wherein the target function is used for representing the sum of a first sub-target function and a second sub-target function, and decision variables of the first sub-target function and the second sub-target function comprise a first matrix; an adjustment unit configured to adjust the objective function to determine a first matrix that minimizes a value of the objective function as a target first matrix; the storage unit is configured to determine a sequence number of a non-zero first array of a target first matrix, select and store a second array corresponding to the non-zero first array from the to-be-processed matrix according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
In some embodiments, the number and position of the non-zero elements included in the first matrix are used to control the value of the first sub-targeting function, and the number of the non-zero first arrays of the first matrix is used to control the value of the second sub-targeting function.
In some embodiments, the first sub-targeting function is a quadratic function.
In some embodiments, the first sub-targeting function is positively correlated with a sum of squares of elements comprised by a difference matrix, wherein the difference matrix is determined by a difference of the matrix to be processed and a product matrix, wherein the product matrix is determined by a product of the matrix to be processed and the first matrix.
In some embodiments, the second sub-targeting function is positively correlated to the sum of the two norms of the first arrays of the first matrix.
In some embodiments, the second sub-objective function is used to characterize a sum of the first function and the second function, wherein the decision variables of the objective function, the first function, and the second function comprise a first vector, wherein the number of non-zero first arrays of the first matrix is positively correlated with the number of non-zero elements of the first vector.
In some embodiments, the first function is positively correlated with a sum of a target number of quotient values, wherein the target number is a number of elements included in the first vector, and the target number of quotient values are a quotient of a square of a two-norm of each first array of the first matrix and an element included in the first vector and corresponding to the sequence number, respectively.
In some embodiments, the second function is positively correlated to a norm of the first vector.
In a third aspect, an embodiment of the present disclosure provides a method for pushing information, where the method includes: acquiring a first user identification set and a second user identification set; acquiring information to be pushed; the method comprises the steps of obtaining a user matrix, wherein each first array of the user matrix corresponds to a user indicated by a user identifier in a first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in a second user identifier set, and elements of the user matrix are used for representing operation data of information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; determining a user matrix as a matrix to be processed, and processing the user matrix by using the method according to any one of claims 1 to 8 to obtain a second array selected from the user matrix; and pushing information to be pushed to the terminal equipment corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second groups.
In a fourth aspect, an embodiment of the present disclosure provides an apparatus for pushing information, including: a user identification set acquisition unit configured to acquire a first user identification set and acquire a second user identification set; a to-be-pushed information acquisition unit configured to acquire information to be pushed; the user matrix obtaining unit is configured to obtain a user matrix, wherein each first array of the user matrix corresponds to a user indicated by a user identifier in a first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in a second user identifier set, and elements of the user matrix are used for representing operation data of information shared by the users indicated by the user identifiers in the first user identifier set to the users indicated by the user identifiers in the second user identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; a user matrix processing unit configured to determine a user matrix as a matrix to be processed, and process the user matrix by using the method described in any implementation manner in the first aspect to obtain a second array selected from the user matrix; and the pushing unit is configured to push the information to be pushed to the terminal equipment corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second groups.
In a fifth aspect, embodiments of the present disclosure provide a method for detecting an article, the method comprising: acquiring a target article identification set; acquiring an article matrix, wherein each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in a target article identifier set, and an element of the article matrix is used for representing an attribute value of the article indicated by the article identifier in the target article identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; determining an article matrix as a matrix to be processed, and processing the article matrix by using the method described in any implementation manner in the first aspect to obtain a second array selected from the article matrix; and sending an alarm signal in response to the fact that the number of the second arrays meeting the preset condition in the selected second arrays is smaller than a preset number threshold.
In a sixth aspect, embodiments of the present disclosure provide an apparatus for detecting an article, the apparatus comprising: an item identification set acquisition unit configured to acquire a target item identification set; an article matrix obtaining unit configured to obtain an article matrix, wherein each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in a target article identifier set, and an element of the article matrix is used for representing an attribute value of an article indicated by an article identifier in the target article identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; an article matrix processing unit configured to determine an article matrix as a to-be-processed matrix, and process the article matrix by using the method described in any implementation manner of the first aspect to obtain a second array selected from the article matrix; and the alarm unit is configured to send out an alarm signal in response to the fact that the number of the second arrays meeting the preset condition in the selected second arrays is smaller than a preset number threshold value.
In a seventh aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method as described in any of the implementations of the first, third, and fifth aspects.
In an eighth aspect, an embodiment of the present disclosure provides a computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the method as described in any implementation manner of the first, third, and fifth aspects.
According to the method and the device for storing data, the value of the objective function is minimized by adjusting the objective function constructed in advance based on the matrix to be processed, and the row or the column is selected from the matrix to be processed for storage according to the non-zero row or the non-zero column of the first matrix at the moment, so that the compressed storage of the matrix to be processed is realized, and the storage space is saved.
In addition, the method of compressing the matrix can be applied to various scenes of sampling to complete the sampling of the samples. Specifically, the data to be processed in the application scene may be represented in a matrix form, and then the obtained matrix is processed by using this method, and the selected column or row is used as sample data. And then, the selected sample data can be used for representing the data to be processed so as to reduce the number of the data needing to be processed, thereby increasing the data processing speed and reducing the resource consumption occupied by the data processing process.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method for storing data, according to the present disclosure;
FIG. 3 is a flow diagram for one embodiment of a method for pushing information, according to the present disclosure;
FIG. 4 is a schematic diagram of one application scenario of a method for pushing information, in accordance with an embodiment of the present disclosure;
FIG. 5 is a flow chart of one embodiment of a method for detecting an item according to the present disclosure;
FIG. 6 is a schematic block diagram illustrating one embodiment of an apparatus for storing data according to the present disclosure;
FIG. 7 is a schematic block diagram illustrating one embodiment of an apparatus for pushing information according to the present disclosure;
FIG. 8 is a schematic block diagram of one embodiment of an apparatus for detecting items according to the present disclosure;
FIG. 9 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary architecture 100 to which embodiments of the disclosed method for storing data or apparatus for storing data may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various client applications may be installed on the terminal devices 101, 102, 103. Such as browser-type applications, search-type applications, data processing-type applications, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices that support matrix processing, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as a server that provides data support for the terminal devices 101, 102, 103. The server can process the matrix to be processed sent by the terminal device based on the objective function so as to select rows or columns from the matrix to be processed for storage.
It should be noted that the pending matrices may also be directly stored locally in the server 105, and the server 105 may directly extract and process the locally stored pending matrices, in which case, the terminal devices 101, 102, and 103 and the network 104 may not be present.
It should be noted that the method for storing data provided by the embodiment of the present disclosure is generally performed by the server 105, and accordingly, the apparatus for storing data is generally disposed in the server 105.
It should be further noted that the terminal devices 101, 102, and 103 may also have a data processing application installed therein, and the terminal devices 101, 102, and 103 may also process the matrix to be processed based on the data processing application, in this case, the method for storing data may also be executed by the terminal devices 101, 102, and 103, and accordingly, the apparatus for storing data may also be installed in the terminal devices 101, 102, and 103. At this point, the exemplary system architecture 100 may not have the server 105 and the network 104.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for storing data in accordance with the present disclosure is shown. The method for storing data comprises the following steps:
step 201, a matrix to be processed is obtained.
In this embodiment, the matrix to be processed may be an arbitrary matrix. The execution agent of the method for storing data (e.g., server 105 shown in fig. 1) may obtain the pending matrix from a local or other storage device (e.g., terminal devices 101, 102, 103 shown in fig. 1) or the like.
Step 202, an objective function pre-constructed based on the matrix to be processed is obtained.
In this embodiment, the objective function may be pre-constructed by a technician according to a specific application scenario. The execution agent may retrieve the pre-constructed object function from a local or other storage device or the like. The execution body may also receive an objective function input by a user.
Wherein the objective function may be used to characterize the sum of the first sub-objective function and the second sub-objective function. The decision variables of the first sub-goal function and the second sub-goal function may comprise a first matrix. The first sub-targeting function and the second sub-targeting function may also be pre-constructed.
For convenience of description of the two sub-target functions, one of the sub-target functions is named as a first sub-target function, and the other sub-target function is named as a second sub-target function. It should be understood by those skilled in the art that the terms "first" and "second" do not constitute a specific limitation on the sub-objective function.
Step 203, the objective function is adjusted to determine a first matrix which minimizes the value of the objective function as a target first matrix.
In this embodiment, according to the actual application requirement, the objective function may be adjusted by using various existing applications or algorithms (such as a gradient descent method, etc.) that may be used to optimize the objective function, so as to find the minimum value of the objective function. At this time, the corresponding first matrix may be taken as the target first matrix.
And 204, determining the sequence number of the non-zero first array of the target first matrix, and selecting and storing a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number.
In this embodiment, the first array may be one of a row and a column of the matrix, and the second array may be the other of the row and the column of the matrix. That is, in one case, the first array may represent rows of a matrix and the second array may represent columns of the matrix. Alternatively, the first array may represent columns of a matrix and the second array may represent rows of the matrix.
The sequence number of the second array selected from the to-be-processed matrix may be the same as the sequence number of the corresponding non-zero first array. The sequence number may refer to a row sequence number or a column sequence number. Wherein the serial number may be pre-specified by a technician. For example, in general, starting from the top left corner of the matrix, there may be a first column, a second column, a third column, etc. in sequence from left to right, and a first row, a second row, a third row, etc. in sequence from top to bottom.
Taking the first array to represent the rows of the matrix and the second array to represent the columns of the matrix as an example, the row sequence numbers of the non-zero rows of the target first matrix may be determined first, and then the columns with the column sequence numbers respectively the same as the row sequence numbers of the non-zero rows of the first matrix may be selected from the matrix to be processed.
In some optional implementations of this embodiment, the number and the position of the non-zero elements included in the first matrix may be used to control the value of the first sub-targeting function, and the number of the non-zero first arrays of the first matrix may be used to control the value of the second sub-targeting function.
At this time, the value of the first sub-targeting function may be controlled by adjusting the number of non-zero elements included in the first matrix, so that the value of the first sub-targeting function is minimum, and the number of non-zero elements included in the first matrix is as large as possible. Therefore, the number of non-zero elements included in the row or the column selected from the matrix to be processed according to the first matrix is larger, and the compression of the matrix to be processed is realized.
Meanwhile, the value of the first sub-targeting function can be controlled by adjusting the position of the non-zero element included in the first matrix, so that the value of the first sub-targeting function is minimum, and the position of the non-zero element included in the first matrix meets the preset condition as much as possible. Therefore, the non-zero elements included in the row or the column selected from the matrix to be processed according to the first matrix correspondence meet the preset condition.
The preset condition can be set according to the actual application requirement. In different application scenarios, there may be different optimization objectives. For example, in some application scenarios, it is desirable that the non-zero elements be relatively concentrated, but not too dispersed. For another example, in some application scenarios, it is desirable that the non-zero elements are evenly distributed in each row or column.
In addition, the value of the second sub-targeting function can be controlled by adjusting the number of the non-zero first arrays of the first matrix, so that the value of the first sub-targeting function is minimum, and simultaneously, the number of the non-zero rows or non-zero columns of the first matrix is as much as possible. Thereby, the row or the column selected from the matrix to be processed according to the first matrix is as few as possible, thereby realizing the compression of the matrix to be processed.
Since the objective function is represented as the sum of the first sub-objective function and the second sub-objective function. Thus, the minimum of the objective function, i.e. the first matrix, is adjusted such that the sum of the first sub-objective function and the second sub-objective function is minimized. In combination with the above analysis, the objective function is adjusted so that when the value of the objective function is minimum, the number of non-zero elements of the first matrix is as large as possible, and the number of non-zero rows or non-zero columns of the first matrix is as large as possible, thereby achieving a better compression effect.
In some optional implementations of this embodiment, the first sub-targeting function may be a quadratic function. For quadratic functions, it is relatively easy to find the minimum.
In some optional implementations of this embodiment, the first sub-targeting function may be positively correlated with a sum of squares of elements comprised by the difference matrix. The difference matrix may be determined by a difference between the to-be-processed matrix and the product matrix. The product matrix may be determined by multiplying the to-be-processed matrix by the first matrix.
The specific representation mode of the first sub-targeting function can be flexibly set. For example, the first sub-targeting function may be directly expressed as a sum of squares of elements comprised by the difference matrix. Also for example, the first sub-targeting function may be expressed as a product of a sum of squares of elements included in the difference matrix and a preset adjustment parameter, or the like.
Similarly, the specific representation of the difference matrix can be flexibly set. For example, the difference matrix may be represented as a difference between the to-be-processed matrix and the product matrix, or may be represented as a difference between the to-be-processed matrix and the product matrix, a product of a preset adjustment parameter, or the like.
Similarly, the specific representation of the product matrix can also be flexibly set. For example, the product matrix may be represented as a product of the to-be-processed matrix and the first matrix, or as a sum of a product of the to-be-processed matrix and the first matrix and a preset adjustment parameter, or the like.
It should be understood that the first sub-objective function, the difference matrix, the product matrix, the adjustment parameter, etc. can be flexibly set according to the actual application requirement.
One specific example is taken as an illustration. The matrix to be processed is: x, the first matrix is: A. then, the product matrix can be expressed as: XA. The difference matrix can be expressed as: X-XA. Correspondingly, the first sub-targeting function may be expressed as:
Figure BDA0002119660770000101
where N may represent the total number of columns of matrix X and the total number of rows of matrix a. i may represent the row number of matrix X or the column number of matrix a. XiMay represent the ith column of the matrix X. A. theiThe ith row of matrix a may be represented.
Wherein the content of the first and second substances,
Figure BDA0002119660770000111
can represent a vector (X)i-X Ai) Is the square of the two norms.
Taking the above example as an illustration, the selection of the columns in the pending matrix may be controlled by using non-zero elements in the first matrix. Meanwhile, the value of the objective function is enabled to be as small as possible by optimizing the objective function, and the characteristic information of all columns can be represented as much as possible by each column selected from the matrix to be processed, so that excessive information is prevented from being lost in the process of compressing the matrix.
To illustrate by way of an example, if ten columns of data in the pending matrix are almost identical. In this case, ideally, only one column of the ten columns needs to be selected to represent the ten columns of data. The above-mentioned method can select some representative columns from the matrix to be processed as much as possible, so as to use the selected columns to characterize all data in the matrix to be processed as much as possible.
In some optional implementations of this embodiment, the second sub-targeting function may be positively correlated with a sum of two norms of the first arrays of the first matrix. The specific representation mode of the second sub-targeting function can be flexibly set. For example, the second sub-targeting function may be represented as a sum of two norms of the first arrays of the first matrix. For another example, the second sub-targeting function may be expressed as a sum of a normal form of each first array of the first matrix and a sum of preset tuning parameters.
One specific example is taken as an illustration. The first matrix is: A. then the second sub-targeting function may be:
Figure BDA0002119660770000112
where N may represent the total number of rows and the total number of columns of matrix a. i may represent the row number of matrix a. A. theiThe ith row of matrix a may be represented.
||Ai||2The corresponding two-norm of the ith row of matrix a can be represented.
The row of the matrix represented by the first array is taken as an explanation, and the number of the columns selected from the matrix to be processed can be further controlled by controlling the number of the non-zero rows of the first matrix, so that the data in the matrix to be processed can be represented by selecting few columns as far as possible, and the storage space occupied by the compressed matrix is further reduced.
In some optional implementations of this embodiment, the second sub-goal function may be used to characterize the sum of the first function and the second function. The decision variables of the objective function, the first function and the second function may include a first vector. Wherein the number of non-zero first arrays of the first matrix may be positively correlated with the number of non-zero elements of the first vector.
Wherein the first function and the second function may be preset by a technician. By setting the number of non-zero first arrays of the first matrix to be positively correlated with the number of non-zero elements of the first vector, the number of non-zero rows or non-zero columns of the first matrix can be controlled by adjusting the number of non-zero elements of the first vector.
In some optional implementations of this embodiment, the first function may be positively correlated with a sum of the target number of quotient values. The target number may be the number of elements included in the first vector, and the quotient of the target number is the quotient of the square of the two norms of each first array of the first matrix and the elements included in the first vector and corresponding to the sequence number.
Wherein, the first array represents a row of the first matrix to illustrate the corresponding relationship. Each quotient value may be a quotient of the two norms of a row of the first matrix and the elements of the first vector that comprise the corresponding sequence number. Wherein, the corresponding sequence number may refer to an element corresponding to a row sequence number of a row of the first matrix. If the first vector is a row vector, the element corresponding to the sequence number may refer to an element having a column sequence number identical to a row sequence number of a row of the first matrix. If the first vector is a column vector, the element corresponding to the sequence number may refer to an element having a row sequence number identical to a row sequence number of a row of the first matrix.
The specific representation mode of the first function can be flexibly set. For example, the first function may be expressed as a sum of the target number of quotient values. For another example, the first function may be expressed as a product of a sum of the target number of quotient values and a preset adjustment parameter, and the like.
A specific example is given as an illustration. The first matrix may be: A. the first vector may be: B. the first function may be expressed as:
Figure BDA0002119660770000121
where N may represent the total number of rows, the total number of columns of matrix a, and the total number of elements of vector B. i may represent the row sequence number of matrix a and j may represent the column sequence number of matrix a and the element sequence number of vector B. A. thei,jMay represent an element of the ith row and the jth column of matrix a. B isiThe jth element of vector B may be represented.
Illustratively, the first array represents rows of the matrix in such a way that the two-norm of each row of the first matrix is constrained to the element of the first vector that is included in the corresponding sequence number. Therefore, the value of the second norm of each row of the first matrix can be controlled by adjusting the value of each element included in the first vector, namely the value of the second sub-objective function.
In some alternative implementations of this embodiment, the second function may be positively correlated with a norm of the first vector. The specific representation mode of the second function can be flexibly set. For example, the second function may be represented as a norm of the first vector. For another example, the second function may also be expressed as a product of a norm of the first vector and a preset adjustment parameter.
A specific example is given as an illustration. The first vector is: B. the second function may be expressed as:
γ|B|1
wherein γ may be a preset adjustment parameter.
|B|1A norm of vector B may be represented.
Taking the first array as an example to represent rows of the matrix, this way may control values of elements of the first vector, so that when a value of the objective function is small, values of elements of the first vector are also relatively small, so that a sum of two norms affecting each row of the first matrix is also relatively small, that is, the number of zero elements included in each row of the first matrix is controlled to be as large as possible, and non-zero rows are controlled to be as large as possible.
The method comprises the steps of selecting a first sub-target function and a second sub-target function from a first matrix, wherein the first sub-target function and the second sub-target function are restricted with each other, so that the rows as few as possible are selected from the first matrix, and the columns of a matrix to be processed corresponding to the selected rows can represent the data characteristics of the columns of the matrix to be processed as much as possible.
In the method for storing data provided in the above embodiment of the present disclosure, a pre-established objective function is adjusted, so that a row or a column is selected from a matrix to be processed for storage according to a non-zero row or a non-zero column of a first matrix that minimizes a value of the objective function, thereby implementing compressed storage of the matrix to be processed, and saving a storage space.
In addition, the method for storing data provided by the above-described embodiment of the present disclosure may be applied as a method of extracting a sample. Specifically, the data to be processed in practical application may be represented in a matrix form, and then the obtained matrix is processed by using this method, and the selected column or row is used as sample data. And then, the selected sample data can be used for representing the data to be processed so as to reduce the number of the data needing to be processed, thereby increasing the data processing speed and reducing the resource consumption occupied by the data processing process.
With continued reference to fig. 3, a flow 300 of yet another embodiment of a method for pushing information is shown. The flow 300 of the method for pushing information includes the following steps:
step 301, a first user identifier set is obtained, and a second user identifier set is obtained.
In this embodiment, the execution subject of the method for pushing information may be the server 105 shown in fig. 1, or may be other electronic devices. The user identities in the first set of user identities and the second set of user identities may be various identities that may be used to characterize a user. For example, the user identifier may be an identifier (such as a unique device identifier) of a terminal device corresponding to the user, or may be a user name, a user mailbox, and the like corresponding to the user.
The executing agent may retrieve the first set of subscriber identities and the second set of subscriber identities from a local or other storage device. The execution subject may also obtain the first set of subscriber identities and the second set of subscriber identities from a third party data platform. The first user identification set and the second user identification set may be obtained from the same electronic device or from different electronic devices.
The user indicated by the user identifier in the first user identifier set and the user indicated by the user identifier in the second user identifier set may be determined according to actual application requirements. The first and second sets of subscriber identities may be the same or different. The first subscriber identity set and the second subscriber identity set may or may not have an intersection.
It should be noted that, for convenience of describing two sets of user identifiers, one set of user identifiers is named as a first set of user identifiers, and the other set of user identifiers is named as a second set of user identifiers. It should be understood by those skilled in the art that the terms "first" and "second" are not intended to be limiting.
Step 302, obtaining information to be pushed.
In this embodiment, the information to be pushed may be any information. For example, the information to be pushed may be pictures, text, video, audio, and so on. Likewise, the executing agent may obtain the information to be pushed from a local storage device, another storage device or a third-party data platform.
Step 303, a user matrix is obtained.
In this embodiment, the execution subject may obtain the user matrix from a local storage device, another storage device, or a third-party data platform. Each first array of the user matrix may respectively correspond to a user indicated by a user identifier in the first user identifier set. Each second group of the user matrix may correspond to a user indicated by a user identifier in the second set of user identifiers, respectively. The elements of the user matrix may be used to represent operation data of information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set.
The first array may be one of a row and a column of the matrix, and the second array may be the other of the row and the column of the matrix.
The information shared by the user may refer to any information displayed according to the instruction of the user. The form of the shared information varies according to the specific application scenario. For example, a user may share information with a user's home page registered in some applications. For another example, a user may share information by recording videos through some video-like applications.
The operation data may refer to various data related to user operations. The user operation may be various user operations such as a click operation, a slide operation, a collection operation, a browsing operation, a comment operation, and the like.
The operational data may be determined according to actual application requirements. For example, the operation data may refer to whether the user indicated by the user identifier in the first user identifier set performs any user operation in a preset user operation set on the information shared by the user indicated by the user identifier in the second user identifier set. If the user indicated by the user identifier in the first user identifier set performs any user operation on the information shared by the user indicated by the user identifier in the second user identifier set, the corresponding operation data may be set to 1. If the user indicated by the user identifier in the first user identifier set does not perform any user operation on the information shared by the user indicated by the user identifier in the second user identifier set, the corresponding operation data may be set to 0.
For another example, the operation data may also refer to the number of clicks of the information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set.
Step 304, the user matrix is processed to obtain a second array selected from the user matrix.
In this embodiment, the user matrix may be processed by using the method for storing data described in the embodiment corresponding to fig. 2 as a matrix to be processed. Thereby, a row or column selected from the user matrix can be obtained.
Step 305, pushing information to be pushed to the terminal device corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second group.
In this embodiment, the second array is used to represent the columns of the matrix as an example, and three columns are selected from the user matrix. Then, the information to be pushed may be pushed to the terminal devices corresponding to the users indicated by the user identifiers in the second user identifier sets respectively corresponding to the three columns.
With continued reference to fig. 4, fig. 4 is a schematic diagram 400 of an application scenario of the method for pushing information according to the present embodiment. In the application scenario of fig. 4, an executing entity (such as the server 105 shown in fig. 1) of the method for pushing information may first obtain a first set of user identities 401 and a second set of user identities 402. As shown in the figure, the first set of user identities 401 comprises 3 user identities, "D", "E", "F", respectively. The second set of subscriber identities 402 comprises 3 subscriber identities, respectively "a", "B", "C".
Thereafter, a user matrix 403 may be obtained. As shown in the figure, the first row of the user matrix 403 corresponds to the user indicated by the user identifier "D", the second row corresponds to the user indicated by the user identifier "E", and the third row corresponds to the user indicated by the user identifier "F". The first column of the user matrix 403 corresponds to the user indicated by the user identifier "a", the second column corresponds to the user indicated by the user identifier "B", and the third column corresponds to the user indicated by the user identifier "C".
An element in the user matrix 403 is used to indicate the number of clicks of the information shared by the user corresponding to the row where the element is located and the user corresponding to the column where the element is located. As shown in the figure, the number of clicks of the user indicated by the user identifier "D" on the information shared by the user indicated by the user identifier "a" is 20, the number of clicks of the information shared by the user indicated by the user identifier "B" is 10, and the information shared by the user indicated by the user identifier "C" has not been clicked.
The number of clicks of the user indicated by the user identifier "E" on the information shared by the user indicated by the user identifier "a" is 10, and the information shared by the users indicated by the user identifier "B" and the user identifier "C" has not been clicked.
The number of clicks of the information shared by the user indicated by the user identifier "C" by the user indicated by the user identifier "F" is 10, and the information shared by the users indicated by the user identifier "a" and the user identifier "B" has not been clicked.
Then, the pre-constructed objective function f (T) may be adjusted to determine the corresponding matrix T when the objective function f (T) takes the minimum value (as shown by reference numeral 404). As shown in the figure, the non-zero rows of the matrix T include a first row and a third row.
Thus, as shown by reference numeral 405, a first column and a third column may be selected from the user matrix 403. The first column of the user matrix corresponds to the user indicated by the user identifier "a", and the third column corresponds to the user indicated by the user identifier "C". Thereafter, the previously acquired push information 406 may be pushed to the terminal device 407 corresponding to the user indicated by the user identifier "a", and the previously acquired push information 406 may be pushed to the terminal device 408 corresponding to the user indicated by the user identifier "C".
The method provided by the above embodiment of the present disclosure processes the user matrix by using the method described in the embodiment corresponding to fig. 2, so that a part of rows or columns can be selected from the user matrix. Based on this, the users corresponding to the selected row or column can be used as sample representatives of all users corresponding to the row or column of the user matrix, and only the information is pushed to the target users, so that the number of users receiving the pushed information is reduced, and the resource load in the information pushing process is reduced.
With continued reference to FIG. 5, a flow 500 of yet another embodiment of a method for detecting an item is shown. The process 500 of the method for detecting an item includes the steps of:
step 501, obtaining a target item identification set.
In this embodiment, the execution subject of the method for detecting an article may be the server 105 shown in fig. 1, or may be other electronic devices. The execution principal may retrieve the target item identification set from a local or other storage device or the like.
The object identifiers in the target object identifier set may be a set formed by some object identifiers specified in advance by a technician, or a set formed by object identifiers corresponding to some objects selected according to a preset screening condition. The article identifier may be any information capable of identifying different articles. For example, the item identification may be a code of the item, or the like.
Step 502, an item matrix is obtained.
In this embodiment, the executing agent may obtain the commodity matrix from a local or other storage device. Each first array of the commodity matrix may correspond to an attribute in the preset attribute set, respectively. Each second group of the item matrix may correspond to an item indicated by an item identifier in the target item identifier set. The elements of the item matrix may be used to represent attribute values of items indicated by the item identifications in the target item identification set.
The first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix. Wherein the set of preset attributes may be preset by a technician. For example, the preset attribute set includes weight, volume, and the like.
Step 503, the commodity matrix is processed to obtain a second array selected from the commodity matrix.
In this embodiment, the method described in the embodiment corresponding to fig. 2 may be used to treat the commodity matrix as a matrix to be treated, so as to obtain rows or columns selected from the commodity matrix.
Step 504, in response to determining that the number of second arrays meeting the preset condition in the selected second arrays is smaller than a preset number threshold, an alarm signal is sent.
In this embodiment, the preset condition and the number threshold may be set by a technician according to a specific application scenario. The alert signal may be a variety of alert signals. For example, the alert signal may be a preset audio or the like.
A specific example is illustrated. Each column of the article matrix corresponds to a respective article. Each row of the article matrix corresponds to the weight of the article and the volume of the article, respectively. At this point, a partial column may be selected from the commodity matrix using the method described in the embodiment corresponding to FIG. 2.
The preset conditions may be used to represent a range of values for the weight and a range of values for the volume of the item. At this time, the specific values of the weight and the volume in each selected column may be checked to determine whether the values satisfy the value ranges respectively corresponding to the weight and the volume defined by the preset condition. Furthermore, the corresponding columns with the weight and the volume meeting the preset conditions can be selected from the selected columns.
If the weight and volume of the article produced can be used to characterize the mass of the article. If the number of the rows meeting the preset condition is smaller than the preset number threshold, it indicates that there are more articles with quality problems in the articles respectively corresponding to the rows of the article matrix. Therefore, the related personnel can be prompted to carry out maintenance treatment and the like on the batch of articles corresponding to the article matrix by sending out the alarm signal.
The above-described embodiments of the present disclosure provide methods for processing an article matrix using the method described in the corresponding embodiment of fig. 2, so that a portion of a row or column can be selected from the article matrix. Based on this, the article corresponding to the selected row or column can be used as a sample representative of all articles corresponding to each row or column of the article matrix. And detecting the attribute values of the articles represented by the selected rows or columns to determine whether the number of the articles with the attribute values which do not meet the preset condition is large in the articles corresponding to the selected rows or columns. If the number of the articles with the attribute values not meeting the preset conditions is too large, an alarm signal can be sent out to prompt related personnel to further detect or otherwise process the articles in time, so that the loss caused by the articles (such as defective articles) with the excessive attribute values not meeting the preset conditions is avoided.
With further reference to fig. 6, as an implementation of the method shown in fig. 2 described above, the present disclosure provides an embodiment of an apparatus for storing data, which corresponds to the embodiment of the method shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 6, the apparatus 600 for storing data provided by the present embodiment includes a pending matrix obtaining unit 601, an objective function obtaining unit 602, an adjusting unit 603, and a storage unit 604. Wherein, the pending matrix obtaining unit 601 is configured to obtain a pending matrix; the objective function obtaining unit 602 is configured to obtain an objective function pre-constructed based on a matrix to be processed, where the objective function is used to characterize a sum of a first sub-objective function and a second sub-objective function, and a decision variable of the first sub-objective function and the second sub-objective function includes a first matrix; the adjusting unit 603 is configured to adjust the objective function to determine a first matrix that minimizes a value of the objective function as a target first matrix; the storage unit 604 is configured to determine a sequence number of a non-zero first array of the target first matrix, select and store a second array corresponding to the non-zero first array from the to-be-processed matrix according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
In the present embodiment, in the apparatus for storing data 600: the detailed processing and the technical effects of the to-be-processed matrix obtaining unit 601, the objective function obtaining unit 602, the adjusting unit 603, and the storage unit 604 can refer to the related descriptions of step 201, step 202, step 203, and step 204 in the corresponding embodiment of fig. 2, and are not described herein again.
In some optional implementations of this embodiment, the number and the position of the non-zero elements included in the first matrix are used to control the value of the first sub-targeting function, and the number of the non-zero first array of the first matrix is used to control the value of the second sub-targeting function.
In some optional implementations of this embodiment, the first sub-targeting function is a quadratic function.
In some optional implementations of the embodiment, the first sub-targeting function is positively correlated with a sum of squares of elements included in a difference matrix, where the difference matrix is determined by a difference between the matrix to be processed and a product matrix, where the product matrix is determined by a product of the matrix to be processed and the first matrix.
In some optional implementations of this embodiment, the second sub-objective function is positively correlated with a sum of two norms of the first arrays of the first matrix.
In some optional implementations of the embodiment, the second sub-objective function is configured to characterize a sum of the first function and the second function, wherein the decision variables of the objective function, the first function, and the second function include a first vector, and wherein the number of non-zero first arrays of the first matrix is positively correlated to the number of non-zero elements of the first vector.
In some optional implementations of the embodiment, the first function is positively correlated with a sum of target number quotient values, where the target number is a number of elements included in the first vector, and the target number quotient values are quotient values of a square of a two-norm of each first array of the first matrix and an element included in the first vector and corresponding to the sequence number, respectively.
In some optional implementations of this embodiment, the second function is positively correlated with a norm of the first vector.
In the apparatus provided by the foregoing embodiment of the present disclosure, a to-be-processed matrix is acquired by a to-be-processed matrix acquisition unit; the method comprises the steps that an objective function pre-constructed based on a matrix to be processed is obtained by an objective function obtaining unit, wherein the objective function is used for representing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix; the adjusting unit adjusts the target function to determine a first matrix which enables the value of the target function to be minimum as a target first matrix; the storage unit determines the sequence number of a non-zero first array of a target first matrix, selects and stores a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array, so that the compressed storage of the matrix to be processed is realized, and the storage space is saved.
With further reference to fig. 7, as an implementation of the method shown in fig. 3, the present disclosure provides an embodiment of an apparatus for pushing information, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 3, and the apparatus may be applied to various electronic devices in particular.
As shown in fig. 7, the apparatus 700 for pushing information provided by this embodiment includes a user identifier set acquisition unit 701, an information to be pushed acquisition unit 702, a user matrix acquisition unit 703, a user matrix processing unit 704, and a pushing unit 705. Wherein, the user identifier set obtaining unit 701 is configured to obtain a first user identifier set, and obtain a second user identifier set; the information to be pushed acquisition unit 702 is configured to acquire information to be pushed; the user matrix obtaining unit 703 is configured to obtain a user matrix, where each first array of the user matrix corresponds to a user indicated by a user identifier in a first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in a second user identifier set, and an element of the user matrix is used to represent operation data of information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set, where the first array is one of a row and a column of the matrix, and the second array is another of the row and the column of the matrix; the user matrix processing unit 704 is configured to determine a user matrix as a matrix to be processed, and process the user matrix by using the method described in any implementation manner of the first aspect to obtain a second array selected from the user matrix; the pushing unit 705 is configured to push the information to be pushed to the terminal device corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second group.
In the present embodiment, in the apparatus 700 for pushing information: specific processing of the user identifier set obtaining unit 701, the information to be pushed obtaining unit 702, the user matrix obtaining unit 703, the user matrix processing unit 704, and the pushing unit 705 and technical effects brought by the processing can refer to the related descriptions of step 301, step 302, step 303, step 304, and step 305 in the corresponding embodiment of fig. 3, which are not described herein again.
In the apparatus provided by the foregoing embodiment of the present disclosure, a user identifier set obtaining unit obtains a first user identifier set, and obtains a second user identifier set; the information to be pushed acquiring unit acquires information to be pushed; the user matrix obtaining unit obtains a user matrix, wherein each first array of the user matrix corresponds to a user indicated by a user identifier in a first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in a second user identifier set, and elements of the user matrix are used for representing operation data of information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; the user matrix processing unit determines a user matrix as a matrix to be processed, and processes the user matrix by using the method described in the embodiment corresponding to fig. 2 to obtain a second array selected from the user matrix; the pushing unit pushes the information to be pushed to the terminal equipment corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second group, so that the information is pushed to only part of the users indicated by the user identifier in the second user identifier set, the number of the users receiving the pushed information is reduced, and the resource load in the information pushing process is reduced.
With further reference to fig. 8, as an implementation of the method illustrated in fig. 5 described above, the present disclosure provides one embodiment of an apparatus for detecting an article, which corresponds to the method embodiment illustrated in fig. 5, and which may be applied in various electronic devices in particular.
As shown in fig. 8, the apparatus 800 for detecting an item provided by the present embodiment includes an item identifier set acquiring unit 801, an item matrix acquiring unit 802, an item matrix processing unit 803, and an alerting unit 804. Wherein the item identification set acquisition unit 801 is configured to acquire a target item identification set; the article matrix obtaining unit 802 is configured to obtain an article matrix, where each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in a target article identifier set, and an element of the article matrix is used to represent an attribute value of an article indicated by an article identifier in the target article identifier set, where the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; the commodity matrix processing unit 803 is configured to determine a commodity matrix as a to-be-processed matrix, and process the commodity matrix by using the method as described in any implementation manner of the first aspect to obtain a second array selected from the commodity matrix; the alarm unit 804 is configured to issue an alarm signal in response to determining that the number of second arrays, which meet a preset condition, of the selected second arrays is less than a preset number threshold.
In the present embodiment, in the apparatus for detecting an article 800: the specific processing of the item identifier set obtaining unit 801, the item matrix obtaining unit 802, the item matrix processing unit 803, and the alarm unit 804 and the technical effects thereof may refer to the related descriptions of step 501, step 502, step 503, and step 504 in the corresponding embodiment of fig. 5, which are not described herein again.
In the apparatus provided by the above embodiment of the present disclosure, the object identifier set is obtained by the object identifier set obtaining unit; the method comprises the steps that an article matrix obtaining unit obtains an article matrix, wherein each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in a target article identifier set, and elements of the article matrix are used for representing attribute values of the articles indicated by the article identifier in the target article identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix; the commodity matrix processing unit determines the commodity matrix as a matrix to be processed, and processes the commodity matrix by using the method described in the embodiment corresponding to fig. 2 to obtain a second array selected from the commodity matrix; and the alarm unit sends an alarm signal in response to the fact that the number of the second arrays which meet the preset condition in the selected second arrays is smaller than the preset number threshold, so that when the number of the articles of which the attribute values do not meet the preset condition is detected to be excessive, the alarm unit sends the alarm signal in time to prompt related personnel to further perform detailed detection or other processing on the articles, and loss caused by the occurrence of the articles of which the attribute values do not meet the preset condition (such as defective articles) is avoided.
Referring now to FIG. 9, shown is a schematic diagram of an electronic device (e.g., the server of FIG. 1) 900 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a notebook computer, a PDA (personal digital assistant), a PAD (PAD), a vehicle-mounted terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The server shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 9, the electronic device 900 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 901 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage means 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are also stored. The processing apparatus 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
Generally, the following devices may be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 907 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 908 including, for example, magnetic tape, hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic apparatus 900 to perform wireless or wired communication with other apparatuses to exchange data. While fig. 9 illustrates an electronic device 900 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 9 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. The computer program, when executed by the processing apparatus 901, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a matrix to be processed; acquiring an objective function which is pre-constructed based on a matrix to be processed, wherein the objective function is used for representing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix; adjusting the target function to determine a first matrix which enables the value of the target function to be minimum as a target first matrix; determining the sequence number of a non-zero first array of a target first matrix, selecting and storing a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a matrix to be processed acquisition unit, an objective function acquisition unit, an adjustment unit, and a storage unit. Here, the names of the units do not constitute a limitation to the unit itself in some cases, and for example, the pending matrix acquisition unit may also be described as a "unit that acquires a pending matrix".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (22)

1. A method for storing data, comprising:
acquiring a matrix to be processed;
acquiring an objective function which is pre-constructed based on the matrix to be processed, wherein the objective function is used for representing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix;
adjusting the objective function to determine a first matrix which enables the value of the objective function to be minimum as a target first matrix;
determining the sequence number of the non-zero first array of the target first matrix, selecting a second array corresponding to the non-zero first array from the matrix to be processed according to the determined sequence number, and storing the selected second array, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
2. The method of claim 1, wherein the first matrix comprises a number and a position of non-zero elements for controlling a value of the first sub-targeting function, and the number of non-zero first arrays of the first matrix is for controlling a value of the second sub-targeting function.
3. The method of claim 1, wherein the first sub-targeting function is a quadratic function.
4. The method of claim 1, wherein the first sub-targeting function is positively correlated with a sum of squares of elements comprised by a difference matrix, wherein the difference matrix is determined by a difference of the matrix to be processed and a product matrix, wherein the product matrix is determined by a product of the matrix to be processed and the first matrix.
5. The method of claim 1, wherein the second sub-targeting function positively correlates to a sum of two norms of each first array of the first matrix.
6. The method of claim 1, wherein the second sub-objective function is used to characterize a sum of a first function and a second function, wherein the decision variable based on the objective function, the first function, and the second function that is pre-constructed based on the matrix to be processed comprises a first vector, wherein the number of non-zero first arrays of the first matrix is positively correlated to the number of non-zero elements of the first vector.
7. The method of claim 6, wherein the first function is positively correlated with a sum of a target number of quotient values, wherein the target number is a number of elements included in the first vector, and the target number of quotient values are quotient values of a square of a two-norm of each first array of the first matrix and an element of the first vector, which is included in the corresponding sequence number, respectively.
8. The method of claim 6, wherein the second function is positively correlated with a norm of the first vector.
9. An apparatus for storing data, comprising:
a to-be-processed matrix acquisition unit configured to acquire a to-be-processed matrix;
an objective function obtaining unit configured to obtain an objective function pre-constructed based on the to-be-processed matrix, wherein the objective function is used for characterizing the sum of a first sub-objective function and a second sub-objective function, and decision variables of the first sub-objective function and the second sub-objective function comprise a first matrix;
an adjusting unit configured to adjust the objective function to determine a first matrix that minimizes a value of the objective function as a target first matrix;
the storage unit is configured to determine a sequence number of a non-zero first array of the target first matrix, select a second array corresponding to the non-zero first array from the to-be-processed matrix according to the determined sequence number, and store the selected second array, wherein the first array is one of a row and a column of the matrix, the second array is the other of the row and the column of the matrix, and the sequence number of the selected second array is the same as the sequence number of the corresponding non-zero first array.
10. The apparatus of claim 9, wherein the first matrix comprises a number and a position of non-zero elements for controlling a value of the first sub-targeting function, and the number of non-zero first arrays of the first matrix is for controlling a value of the second sub-targeting function.
11. The apparatus of claim 9, wherein the first sub-targeting function is a quadratic function.
12. The apparatus of claim 9, wherein the first sub-targeting function is positively correlated with a sum of squares of elements comprised by a difference matrix, wherein the difference matrix is determined by a difference of the matrix to be processed and a product matrix, wherein the product matrix is determined by a product of the matrix to be processed and the first matrix.
13. The apparatus of claim 9, wherein the second sub-targeting function is positively correlated to a sum of two norms of each first array of the first matrix.
14. The apparatus of claim 9, wherein the second sub-objective function is configured to characterize a sum of a first function and a second function, wherein the decision variable based on the pre-constructed objective function, first function, and second function of the matrix to be processed comprises a first vector, wherein a number of non-zero first arrays of the first matrix is positively correlated to a number of non-zero elements of the first vector.
15. The apparatus of claim 14, wherein the first function is positively correlated with a sum of a target number of quotient values, wherein the target number is a number of elements included in the first vector, and the target number of quotient values are quotient values of a square of a two-norm of each first array of the first matrix and an element of the first vector, which is included in the corresponding sequence number, respectively.
16. The apparatus of claim 14, wherein the second function is positively correlated with a norm of the first vector.
17. A method for pushing information, comprising:
acquiring a first user identification set and a second user identification set;
acquiring information to be pushed;
acquiring a user matrix, wherein each first array of the user matrix corresponds to a user indicated by a user identifier in the first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in the second user identifier set, and elements of the user matrix are used for representing operation data of information shared by the users indicated by the user identifiers in the first user identifier set to the users indicated by the user identifiers in the second user identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix;
determining the user matrix as a matrix to be processed, and processing the user matrix by using the method according to any one of claims 1 to 8 to obtain a second array selected from the user matrix;
and pushing the information to be pushed to the terminal equipment corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second number groups.
18. An apparatus for pushing information, comprising:
a user identification set acquisition unit configured to acquire a first user identification set and acquire a second user identification set;
a to-be-pushed information acquisition unit configured to acquire information to be pushed;
a user matrix obtaining unit configured to obtain a user matrix, wherein each first array of the user matrix corresponds to a user indicated by a user identifier in the first user identifier set, each second array of the user matrix corresponds to a user indicated by a user identifier in the second user identifier set, and an element of the user matrix is used to represent operation data of information shared by the user indicated by the user identifier in the first user identifier set to the user indicated by the user identifier in the second user identifier set, where the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix;
a user matrix processing unit configured to determine the user matrix as a matrix to be processed, and process the user matrix by using the method according to any one of claims 1 to 8 to obtain a second array selected from the user matrix;
and the pushing unit is configured to push the information to be pushed to the terminal equipment corresponding to the user indicated by the user identifier in the second user identifier set respectively corresponding to the selected second number groups.
19. A method for detecting an item, comprising:
acquiring a target article identification set;
acquiring an article matrix, wherein each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in the target article identifier set, and an element of the article matrix is used for representing an attribute value of the article indicated by the article identifier in the target article identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix;
determining the commodity matrix as a pending matrix, processing the commodity matrix by using the method according to any one of claims 1 to 8 to obtain a second array selected from the commodity matrix;
and sending an alarm signal in response to the fact that the number of the second arrays meeting the preset condition in the selected second arrays is smaller than a preset number threshold.
20. An apparatus for detecting an item, comprising:
an item identification set acquisition unit configured to acquire a target item identification set;
an article matrix obtaining unit configured to obtain an article matrix, wherein each first array of the article matrix corresponds to an attribute in a preset attribute set, each second array of the article matrix corresponds to an article indicated by an article identifier in the target article identifier set, and an element of the article matrix is used to represent an attribute value of an article indicated by an article identifier in the target article identifier set, wherein the first array is one of a row and a column of the matrix, and the second array is the other of the row and the column of the matrix;
an commodity matrix processing unit configured to determine the commodity matrix as a pending matrix, the commodity matrix being processed by the method according to any one of claims 1 to 8 to obtain a second array selected from the commodity matrix;
and the alarm unit is configured to send out an alarm signal in response to the fact that the number of the second arrays meeting the preset condition in the selected second arrays is smaller than a preset number threshold value.
21. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8, 17, 19.
22. A computer-readable medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1-8, 17, 19.
CN201910602226.1A 2019-07-05 2019-07-05 Method and apparatus for storing data Active CN110309425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910602226.1A CN110309425B (en) 2019-07-05 2019-07-05 Method and apparatus for storing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910602226.1A CN110309425B (en) 2019-07-05 2019-07-05 Method and apparatus for storing data

Publications (2)

Publication Number Publication Date
CN110309425A CN110309425A (en) 2019-10-08
CN110309425B true CN110309425B (en) 2021-08-24

Family

ID=68078372

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910602226.1A Active CN110309425B (en) 2019-07-05 2019-07-05 Method and apparatus for storing data

Country Status (1)

Country Link
CN (1) CN110309425B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269517B (en) * 2020-11-16 2022-03-01 北京百度网讯科技有限公司 Generation method and device of interactive interface

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630742A (en) * 2015-12-28 2016-06-01 广州酷狗计算机科技有限公司 Feature vector calculation method and device
CN107220656A (en) * 2017-04-17 2017-09-29 西北大学 A kind of multiple labeling data classification method based on self-adaptive features dimensionality reduction
CN107563841A (en) * 2017-08-03 2018-01-09 电子科技大学 A kind of commending system decomposed that scored based on user
CN109063374A (en) * 2018-08-31 2018-12-21 中国地质大学(武汉) A kind of coupling matrix extracting method based on parameter optimization, equipment and storage equipment
CN109299341A (en) * 2018-10-29 2019-02-01 山东师范大学 One kind confrontation cross-module state search method dictionary-based learning and system
CN109615452A (en) * 2018-10-29 2019-04-12 华中科技大学 A kind of Products Show method based on matrix decomposition

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10346405B2 (en) * 2016-10-17 2019-07-09 International Business Machines Corporation Lower-dimensional subspace approximation of a dataset
US10332234B2 (en) * 2017-02-14 2019-06-25 International Business Machines Corporation Matrix factorization with approximate computing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630742A (en) * 2015-12-28 2016-06-01 广州酷狗计算机科技有限公司 Feature vector calculation method and device
CN107220656A (en) * 2017-04-17 2017-09-29 西北大学 A kind of multiple labeling data classification method based on self-adaptive features dimensionality reduction
CN107563841A (en) * 2017-08-03 2018-01-09 电子科技大学 A kind of commending system decomposed that scored based on user
CN109063374A (en) * 2018-08-31 2018-12-21 中国地质大学(武汉) A kind of coupling matrix extracting method based on parameter optimization, equipment and storage equipment
CN109299341A (en) * 2018-10-29 2019-02-01 山东师范大学 One kind confrontation cross-module state search method dictionary-based learning and system
CN109615452A (en) * 2018-10-29 2019-04-12 华中科技大学 A kind of Products Show method based on matrix decomposition

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An Optimization Method of Deterministic Measurement Matrix in Distributed Compressed Video Sensing;Jiawei Qin;《Proceedings of the 2018 2nd International Conference on Electrical Engineering and Automation》;20180831;第176-179页 *
基于压缩采样的测量矩阵的性能分析;王楠楠;《杭州电子科技大学》;20130131;第7-12页 *
大规模稀疏线性系统的并行求解方法研究;宋丽翠;《华北电力大学》;20190331;第9-11页、第17-28页 *

Also Published As

Publication number Publication date
CN110309425A (en) 2019-10-08

Similar Documents

Publication Publication Date Title
CN105787077B (en) Data synchronization method and device
US10547618B2 (en) Method and apparatus for setting access privilege, server and storage medium
CN109255337B (en) Face key point detection method and device
CN110516678B (en) Image processing method and device
CN109377508B (en) Image processing method and device
CN110288625B (en) Method and apparatus for processing image
CN111831855B (en) Method, apparatus, electronic device, and medium for matching videos
CN109862100B (en) Method and device for pushing information
CN110866040B (en) User portrait generation method, device and system
CN110619078B (en) Method and device for pushing information
CN108595448B (en) Information pushing method and device
CN108600780B (en) Method for pushing information, electronic device and computer readable medium
CN115825313B (en) Chromatographic information detection method, device, electronic equipment and computer readable medium
US11588822B2 (en) Right control method and apparatus for terminal device
WO2020088048A1 (en) Method and apparatus for processing information
CN107402878B (en) Test method and device
CN110309425B (en) Method and apparatus for storing data
CN111160410A (en) Object detection method and device
CN110809166B (en) Video data processing method and device and electronic equipment
CN112449217B (en) Method and device for pushing video, electronic equipment and computer readable medium
CN111831448A (en) Request processing method and device and electronic equipment
US11403835B2 (en) Method and device for processing feature point of image
CN110633411A (en) Method and device for screening house resources, electronic equipment and storage medium
CN112381184B (en) Image detection method, image detection device, electronic equipment and computer readable medium
CN110619079B (en) Method and device for pushing information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder