A data processing method, a data processing device and a data processing device

By using clustering vectors to replace the first dimension of the original matrix in the output layer of the neural network, the problem of large computational load in the output layer is solved, the computational performance and processing efficiency of the neural network are improved, and it is suitable for image classification and natural language processing. scene.

CN111950688BActive Publication Date: 2024-09-27BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910399736.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-05-14
Publication Date
2024-09-27
Estimated Expiration
2040-03-24

AI Technical Summary

Technical Problem

The output layer of existing neural networks requires a large amount of calculations, resulting in low calculation performance. Especially when the input matrix size is large, the calculation time of the neural network is increased.

Method used

By using clustering vectors in the output layer of the neural network to replace the first dimension of the original matrix, the computational complexity of the output layer is reduced, thereby improving the computational performance of the neural network. The clustering vector is obtained by clustering the first dimension of the original matrix, with a lower order of magnitude, and is used in the process of determining the corresponding probability of the input vector.

Benefits of technology

It reduces the computational load of the output layer, improves the computational performance and processing efficiency of the neural network, and is suitable for application scenarios such as image classification and natural language processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111950688B
    Figure CN111950688B
Patent Text Reader

Abstract

The embodiment of the present invention provides a data processing method, device and device for data processing. The method is applied to a neural network, the neural network includes: a hidden layer and an output layer; the method includes: executing through the output layer of the neural network: receiving an input vector; the input vector is provided by the hidden layer; providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; according to the clustering vector and the input vector, determining the probability corresponding to the input vector. The embodiment of the present invention can reduce the amount of calculation of the output layer, and thus can improve the calculation performance and processing efficiency of the neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a data processing method, device and a device for data processing. Background Art

[0002] Deep learning technology is a type of artificial intelligence technology that has important applications in fields such as natural language processing. Neural networks are a common deep learning technology that is usually composed of layers of computing units called neurons, which are interconnected. Neural networks transform data until the network can output classifications. The neurons of a neural network multiply an initial value by a certain weight, add it to other values ​​entering the same neuron, adjust the result based on the neuron's bias, and then use an output layer to normalize the output. The output layer can "compress" a K-dimensional vector (K can be a natural number) containing arbitrary real numbers into another K-dimensional real vector, so that each element ranges between 0 and 1, and the sum of all elements is 1; in this way, each element represents the probability of belonging to a certain classification.

[0003] Currently, the processing process of the output layer may include: multiplying the input vector by the input matrix, and obtaining elements in the K-dimensional real vector according to the multiplication result.

[0004] In practical applications, affected by application requirements, the size of the input matrix may be relatively large, which will increase the amount of computation in the output layer, thus affecting the computing performance of the neural network. For example, the input matrix may be 33276×128, and the dimension of the input vector may be 128, then the amount of computation in the output layer can be expressed as: 128×33276=4259328, which is likely to increase the computing time of the neural network, resulting in low processing efficiency. Summary of the invention

[0005] The embodiments of the present invention provide a data processing method, a device and a device for data processing, which can reduce the amount of calculation of the output layer, thereby improving the calculation performance and processing efficiency of the neural network.

[0006] In order to solve the above problems, an embodiment of the present invention discloses a data processing method, which is applied to a neural network, wherein the neural network includes: a hidden layer and an output layer; the method includes:

[0007] The output layer of the neural network performs:

[0008] Receiving an input vector; the input vector is provided by the hidden layer;

[0009] Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector;

[0010] A probability corresponding to the input vector is determined according to the clustering vector and the input vector.

[0011] On the other hand, an embodiment of the present invention discloses a data processing device, which is applied to a neural network, wherein the neural network comprises: a hidden layer and an output layer; the device comprises:

[0012] A receiving module, used for receiving an input vector; the input vector is provided by the hidden layer;

[0013] A module is provided for providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; and

[0014] The probability determination module is used to determine the probability corresponding to the input vector based on the clustering vector and the input vector.

[0015] In another aspect, an embodiment of the present invention discloses a device for data processing, the device is applied to a neural network, the neural network includes: a hidden layer and an output layer; the device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:

[0016] Receiving an input vector; the input vector is provided by the hidden layer;

[0017] Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector;

[0018] A probability corresponding to the input vector is determined according to the clustering vector and the input vector.

[0019] On the other hand, an embodiment of the present invention discloses a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to perform one or more of the data processing methods described above.

[0020] The embodiments of the present invention include the following advantages:

[0021] The output layer of the embodiment of the present invention determines the probability corresponding to the input vector based on the clustering vector and the input vector. Since the clustering vector can be obtained by clustering the first dimension of the original matrix, the above clustering can compress the order of magnitude of the first dimension of the original matrix, thereby reducing the order of magnitude of the original matrix; on this basis, the clustering vector with a lower order of magnitude is applied to the determination process of the probability corresponding to the input vector, which can reduce the amount of calculation of the output layer, thereby improving the calculation performance and processing efficiency of the neural network. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0023] Figure 1 is a schematic diagram of the structure of an RNN according to an embodiment of the present invention;

[0024] Figure 2 It is a schematic diagram of a processing process of an output layer in the related art;

[0025] Figure 3 is a flow chart of steps of an embodiment of a data processing method of the present invention;

[0026] Figure 4 is a data flow chart of a data processing method according to an embodiment of the present invention;

[0027] Figure 5 is a structural block diagram of an embodiment of a data processing device of the present invention;

[0028] Figure 6 is a block diagram of an apparatus 800 for data processing according to the present invention; and

[0029] Figure 7 It is a schematic diagram of the structure of the server in some embodiments of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] The neural network of the embodiment of the present invention is also called ANN (Artificial Neural Network). It abstracts the human brain neural network from the perspective of information processing, establishes a simple model, and forms different networks according to different connection methods. A neural network is a computing model composed of a large number of nodes (or neurons) connected to each other. Each node represents a specific output function, called an activation function. The connection between each two nodes represents a weighted value for the signal passing through the connection, called a weight, which is equivalent to the memory of the neural network. The basis for determining the output of the network may include: the connection method of the network, the weight value and the activation function. The neural network itself is usually an approximation of a certain algorithm or function in nature, or it may be an expression of a logical strategy.

[0032] The neural network of the embodiment of the present invention may include: an input layer, a hidden layer and an output layer, wherein the layers are fully connected. Depending on whether the nodes between the layers are connected, the neural network can be divided into: RNN (Recurrent Neural Network) and ordinary neural network. The nodes between the layers of RNN are connected; the nodes between the layers of ordinary neural network are not connected.

[0033] Reference Figure 1 , showing a schematic diagram of the structure of an RNN according to an embodiment of the present invention. Wherein, x is a vector, which represents the value of the input layer; s is a vector, which represents the value of the hidden layer. It can be understood that the hidden layer may include multiple nodes, and the number of nodes matches the dimension of the vector s; U is the weight matrix from the input layer to the hidden layer, o is also a vector, which represents the value of the output layer; V is the weight matrix from the hidden layer to the output layer. The value s of the hidden layer depends not only on the current input x, but also on the value s of the hidden layer last time; the weight matrix W can be used to characterize the weight of the last value of the hidden layer as the input this time. RNN can be used to process sequence data. For example, to predict what the next word of a sentence is, the previous word is generally needed, because the previous and next words in a sentence are not independent.

[0034] The output layer can normalize the output of the hidden layer. Specifically, the output layer can "compress" a K-dimensional vector containing any real number into another K-dimensional real vector, so that each element ranges between 0 and 1, and the sum of all elements is 1.

[0035] In the embodiment of the present invention, variants of RNN may include: LSTM (Long Short-Term Memory), GRU (Gated Recurrent Unit) network, etc. It can be understood that the embodiment of the present invention can be applied to any neural network.

[0036] At present, the processing process of the output layer may include: multiplying the input vector with the input matrix, and obtaining the elements in the K-dimensional real vector according to the multiplication result. The output layer may use an activation function to obtain the elements in the K-dimensional real vector according to the multiplication result. The optional activation function may include: any one of the sigmoid function (S-type function), tanh function (hyperbolic tangent function), relu (rectified linear unit) function, and softmax function (normalized exponential function).

[0037] Reference Figure 2 , shows a schematic diagram of the processing process of an output layer in the related art, where W[T×N] represents the input matrix, X[N×1] represents the input vector, and the output layer can multiply the input matrix and the input vector to obtain logits[T×1]; Softmax will perform probability normalization on logits[T×1] to obtain prob[T×1]. Each value of the vector prob[T×1] represents the probability that each sample of the input vector belongs to each class. The size of each value in the vector ranges from 0 to 1, and the sum of all vectors is 1.

[0038] In practical applications, affected by application requirements, the size of the input matrix may be relatively large, which will increase the amount of computation in the output layer, thus affecting the computing performance of the neural network. Assuming T is 33276 and N is 128, the amount of computation in the output layer can be expressed as: 128*33276=4259328. The above amount of computation is likely to increase the computing time of the neural network.

[0039] In view of the technical problem that the amount of computation in the output layer is large, an embodiment of the present invention provides a data processing method, which is applied to a neural network. The neural network may specifically include: a hidden layer and an output layer; the method may specifically include:

[0040] The output layer of the neural network performs:

[0041] Receiving an input vector; the input vector is provided by the hidden layer;

[0042] Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector;

[0043] A probability corresponding to the input vector is determined according to the clustering vector and the input vector.

[0044] The output layer of the embodiment of the present invention determines the probability corresponding to the input vector based on the clustering vector and the input vector. Since the clustering vector can be obtained by clustering the first dimension of the original matrix, the above clustering can compress the order of magnitude of the first dimension of the original matrix, thereby reducing the order of magnitude of the original matrix; on this basis, applying the clustering vector with a lower order of magnitude to the determination process of the probability corresponding to the input vector can reduce the amount of calculation of the output layer, thereby improving the calculation performance of the neural network.

[0045] The embodiments of the present invention can be applied to application scenarios such as image classification and natural language processing. It can be understood that any application scenario compatible with the neural network is within the protection scope of the application scenario of the embodiments of the present invention.

[0046] Natural language processing application scenarios may include: the word formation process of the input method, the association process of the input method, or the candidate item frequency modulation process of the input method, etc.

[0047] In a natural language processing application scenario, the probability corresponding to the input vector may specifically include: the probability of a word under a preset condition. The preset condition may be determined according to a specific application scenario.

[0048] Taking the word grouping process of the input method as an example, the input method program can receive the user's input string, and then query whether there is an entry corresponding to the input string in the vocabulary. If not, the input string is intelligently grouped according to the n-gram model to obtain multiple word grouping results, and the word grouping paths corresponding to the multiple word grouping results are sorted to determine the word grouping result with the optimal word grouping path, and the word grouping result with the optimal word grouping path is displayed to the user.

[0049] For example, for the input string "feijizhengzaihuaxing", the input method program performs syllable segmentation on the input string, and the following pinyin string "feiji'zhengzai'huaxing" can be obtained. Since the vocabulary stores relatively short basic terms, there is no long term corresponding to the pinyin string, so the input method program needs to intelligently group the input string "feijizhengzaihuaxing" according to the n-gram model. Specifically, by querying the vocabulary, the terms corresponding to the syllable "feiji" include: "airplane", "Fiji", "fat chicken", etc.; the terms corresponding to the syllable "zhengzai" include: "being"; the terms corresponding to the syllable "huaxing" include: "sliding", "Huaxing", "flower shape", etc. The n-gram model determines the word grouping results with better word grouping paths based on the binary or multi-element relationship between the terms, including: "the plane is in Huaxing", "the plane is taxiing", "the plane is in flower shape", etc.

[0050] Since the n-gram model is based on the assumption that the appearance of the nth word is only related to the previous n-1 words, and not to any other words, in addition, for n-gram models higher than ternary (such as tetragrams, quintuples, etc.), not only does the training process require a huge corpus, but the data is also severely sparse, the time complexity is high, and the accuracy is not improved much, so it is rarely used. The bi-gram model and the tri-gram model are more common. Among them, if the appearance of a word depends only on the word that appears before it, it is called Bi-Gram. If the appearance of a word depends only on the two words that appear before it, it is called Tri-Gram. Therefore, the n-gram model often does not consider the dependency between distant words in the process of word formation. The distant words refer to non-adjacent words in a long entry. For example, in the long entry "the plane is in Huaxing", "the plane" and "Huaxing" are distant words. In the process of word formation, if n=2, the n-gram model does not consider whether there is a dependency between "the plane" and "Huaxing". Therefore, the n-gram model sorts the above word formation results according to the word formation path, and the word formation result with the best word formation path may be "the plane is in Huaxing". Therefore, the input method program displays the word formation result "the plane is in Huaxing" to the user, but what the user actually wants to input is "the plane is taxiing". In addition, when the user wants to input a longer entry or a sentence, even the ternary n-gram model still cannot obtain the dependency between distant words, such as "collecting the masses' urgent needs", and the n-gram model does not consider whether there is a dependency between "collect" and "urgent".

[0051] In order to enable the input method program to display more reasonable word combination results that meet user needs to the user, after obtaining the word combination results corresponding to the input string, the embodiment of the present invention sorts the word combination results according to the LSTM model and displays the sorted word combination results.

[0052] Since the LSTM model is a time recursive neural network model, it can obtain the dependency relationship between distant words. For example, for the input string "feijizhengzaihuaxing", "airplane" and "taxiing" have a stronger dependency relationship than "airplane" and "Huaxing". Therefore, according to the LSTM model, the above word combination results "the plane is Huaxing", "the plane is taxiing", and "the plane is Huaxing" are sorted, and the word combination result "the plane is taxiing" is ranked first. The input method program displays the word combination result according to the sorting result, and can display the word combination result "the plane is taxiing" to the user, so that the word combination result displayed to the user is more reasonable and more in line with the actual needs of the user.

[0053] Optionally, determining the first score corresponding to the word sequence according to the long short-term memory network model may specifically include: determining predicted words corresponding to the words in the word sequence and probability values ​​of the predicted words according to the long short-term memory network model; determining the first score corresponding to the word sequence according to the words in the word sequence, the predicted words corresponding to the words, and the probability values ​​of the predicted words; and sorting the word grouping results corresponding to the word sequence according to the first score.

[0054] The LSTM model can predict the probability value of the subsequent predicted word according to the previous word, and calculate the first score of the entire word sequence according to the probability value. The probability value of the predicted word can be obtained by the LSTM model, especially, it can be obtained by the output layer of the LSTM model. For example, for the word sequence "airplane|is|taxiing", "airplane", "is", and "taxiing" can be input into the LSTM model in sequence, and the LSTM model can determine the predicted word corresponding to each word, and the probability value of the predicted word, wherein the predicted word is the next word that may appear after a certain word, such as the predicted word corresponding to "airplane" can include "is", "takeoff", "design", etc., and the probability of each predicted word appearing is different. The LSTM model first calculates the probability value of the predicted word corresponding to "airplane" being "is", that is, the probability value of "is" appearing after "airplane" is calculated, and the logarithm of the probability value can be obtained to obtain the score corresponding to the predicted word "is". Then, the probability value of the predicted word corresponding to "is" is "taxiing", that is, the probability value of "taxiing" appearing after "is" is calculated, and the logarithm of the probability value can be obtained to obtain the score corresponding to the predicted word "taxiing". Finally, by summing up the scores of all predicted words, we can get the first score of the entire word sequence. For example, by summing up the scores corresponding to "being" and "taxiing", we can get the first score of the entire word sequence "airplane|being|taxiing".

[0055] Because the LSTM model takes into account the dependency between distant word segmentations when determining the first score of a word sequence, for example, in the above example, when determining the first score of the word sequence "plane|being|Huaxing", the predicted word corresponding to each word and the probability value of the predicted word are determined. Therefore, when scoring the word "Huaxing", the probability value of the predicted word corresponding to the previous word "plane" is combined. That is, the LSTM model can reflect the dependency between distant words, making the sorting result more accurate.

[0056] For example, the LSTM model calculates that the first scores of the word sequences "plane|is|Huaxing", "plane|is|taxiing", "plane|is|pattern", and "plane|is|Huaxing" are 980, 560, 1300, and 1200 respectively. The smaller the first score, the better the corresponding word combination result.

[0057] Specifically, the above word sequence is input into the LSTM model in sequence, and the LSTM model determines whether the input word sequence conforms to the grammatical rules and whether it is fluent, and then scores the word sequence to obtain the first score corresponding to the word sequence, and the smaller the first score, the better the word grouping effect. Among them, the first score is obtained according to the score of the predicted word corresponding to each word in the word sequence, and the score of the predicted word can be obtained by taking the logarithm of the probability value of the predicted word, and the probability value is usually between 0 and 1. The larger the probability value, the smaller the corresponding logarithm value, so the first score corresponding to the word sequence is smaller.

[0058] Finally, the above word combination results are sorted according to the first score, and the following sorting results can be obtained: "The plane is taxiing", "The plane is Huaxing", "The plane is Huaxing", "The plane is Huaxing". Therefore, the input method program can display the first word combination result "The plane is taxiing" to the user, making the word combination results displayed to the user more reasonable and more in line with the actual needs of the user.

[0059] The association process of the input method can be used to provide association candidates to the user according to the input environment and / or context when the user has not typed in the input string. For example, in an instant messaging environment and a morning environment, if the user is accustomed to inputting "good morning", "good morning" can be used as an association candidate. In this case, the preset conditions may include: input environment and / or context.

[0060] The candidate item frequency adjustment process of the input method can be used to adjust the display position of the candidate items corresponding to the input string. In this case, the preset conditions may include: input environment, and / or, context, and / or, the frequency of use of the candidate items, etc.

[0061] Method Embodiment

[0062] Reference Figure 3 , shows a flow chart of steps of an embodiment of a data processing method of the present invention, the method is applied to a neural network, the neural network may specifically include: a hidden layer and an output layer, the method may specifically include the following steps:

[0063] The output layer of the neural network performs:

[0064] Step 301, receiving an input vector;

[0065] The input vector may be provided by the hidden layer;

[0066] Step 302: providing a clustering vector;

[0067] The original matrix may be provided by the hidden layer or the word embedding layer; the clustering vector may be obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix may be equal to the dimension of the input vector;

[0068] Step 303: Determine the probability corresponding to the input vector according to the clustering vector and the input vector.

[0069] Figure 3 The method embodiment shown can be applied to the training phase of the neural network or the use phase after training. It can be understood that the embodiment of the present invention does not limit the specific use phase corresponding to the above method. In the training phase of the neural network, the neural network can be trained based on the training data to obtain the parameters of the neural network. In the use phase after the training of the neural network, the parameters of the neural network and the input data can be used to determine the output data corresponding to the input data. In any use phase of the neural network, Figure 3 The method embodiment shown is applied to the output layer of a neural network to solve the technical problem of a large amount of computation in the output layer.

[0070] Word embedding may refer to a method of mapping words to real vectors. Word embedding methods may include but are not limited to: neural networks, word co-occurrence matrices, random models, or explicit expressions based on the context of words.

[0071] The word embedding layer can be used to provide an embedded representation of a word. The word and its corresponding embedded representation can be obtained by searching a vocabulary table, and the vocabulary table can be used to store the word and its corresponding embedded representation. The word embedding layer can be used as a part of the neural network. Alternatively, the word embedding layer can be independent of the neural network, and the word embedding layer and the neural network can share a vocabulary table. The embodiment of the present invention does not limit the specific setting method of the word embedding layer.

[0072] In step 301, an input vector may be received from a hidden layer.

[0073] The input vector may be the output of the hidden layer. The hidden layer may perform a forward calculation process based on the output of the input layer and the state of the hidden layer to obtain the input vector.

[0074] In an optional embodiment of the present application, the output of the input layer may include: an embedded representation of the input vocabulary, and the hidden layer determines the input vector according to the embedded representation of the input vocabulary and the hidden layer state.

[0075] Optionally, the embedding representation of the input vocabulary can be obtained by querying the vocabulary table. For example, the size of the embedding representation of an input vocabulary can be 1*128, and the size of the output h of the hidden layer can be 128*1, that is, the input vector can be a 128-dimensional vector.

[0076] In an optional embodiment of the present invention, the original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer. Assuming that the original matrix corresponding to the vocabulary is W[T×N], T can represent the number of words in the vocabulary, and N can represent the dimension of the embedding representation corresponding to the word.

[0077] In another optional embodiment of the present invention, the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer. Assuming that the weight matrix from the hidden layer to the output layer is W[T×N], T and N represent the number of output layer nodes and the number of hidden layer nodes respectively.

[0078] In step 302, the output layer may provide a clustering vector, which may be a matrix obtained by clustering the first dimension of the original matrix. The clustering compresses the first dimension of the original matrix, thereby reducing the dimension of the original matrix.

[0079] A single clustering vector can represent a category, and the number of single clustering vectors can represent the number of categories. The elements included in a single clustering vector can correspond to the first dimension of the original matrix. Taking the first dimension as an example, an element included in a single clustering vector can correspond to a row of the original matrix. Usually, a single clustering vector includes multiple elements. Through clustering, similar first dimensions can be clustered into the same clustering vector.

[0080] Since the number of the second dimension of the original matrix can be equal to the dimension of the input vector, the dimension of a single clustering vector can be equal to the dimension of the input vector. For example, if the input vector is X[N×1], the clustering vector can be labeli[N×1], where i can represent the number of the clustering vector, and i can be an integer. For example, if the number of clustering vectors is 4096, the clustering vectors can be numbered from 0 to 4095.

[0081] The first dimension may be a dimension of the original matrix. For example, the first dimension is a row, or the first dimension is a column, etc. Optionally, the first dimension may be a larger dimension of the matrix. If the number of rows is greater than the number of columns, the first dimension is a row; or, if the number of rows is less than the number of columns, the first dimension is a column. For example, if the original matrix is ​​33276*128 and the number of rows is greater than the number of columns, the first dimension is a row, that is, the rows of the original matrix are clustered.

[0082] The embodiment of the present invention may use a clustering method to cluster the rows of the original matrix. The clustering method may include K-means clustering, mean shift clustering method, density-based clustering method, agglomerative hierarchical clustering method, etc. It can be understood that the embodiment of the present invention does not limit the specific clustering method.

[0083] In an embodiment of the present invention, clustering of the original matrix may be performed by the output layer or the word embedding layer, and the corresponding clustering process may include: clustering the first dimension of the original matrix to obtain a clustering vector.

[0084] In the embodiment of the present invention, the number C of elements included in a single clustering vector can be used to characterize the number of categories obtained by clustering, and the number C of elements included in a single clustering vector can be determined by those skilled in the art according to actual application requirements. Generally, the smaller the number C of elements included in a single clustering vector, the more obvious the effect of the amount of calculation.

[0085] Optionally, the ratio of the number C of elements included in a single clustering vector to the number of the first dimension may be within a preset range. For example, the preset range may be between 0 and 1 / 8. Of course, the embodiment of the present invention does not limit the specific preset range.

[0086] In step 303, the clustering vector can be obtained by clustering the first dimension of the original matrix. The above clustering can compress the order of magnitude of the first dimension of the original matrix, thereby reducing the order of magnitude of the original matrix; on this basis, the clustering vector with a lower order of magnitude is applied to the process of determining the probability corresponding to the input vector, which can reduce the amount of calculation of the output layer, thereby improving the computing performance of the neural network.

[0087] The embodiment of the present invention can convert the first operation corresponding to the input matrix and the input vector into the second operation corresponding to the clustering vector and the input vector, so as to improve the closeness between the second operation result and the first operation result. The first operation can be Figure 2 The multiplication operation shown in FIG. 1 , the related technology can accumulate the T floating-point numbers in logits[T×1] to obtain the probability parameters involved in the Softmax operation, such as the denominator.

[0088] In the embodiment of the present invention, the first operation result may be a probability parameter, and the probability parameter may be a parameter in the process of determining the probability corresponding to the input vector. For example, the probability parameter may be a denominator or a part of the denominator.

[0089] In an optional embodiment of the present invention, step 303 determines the probability corresponding to the input vector, which may specifically include: determining a sub-probability parameter corresponding to a single clustering vector and the input vector; determining a total probability parameter corresponding to all clustering vectors and the input vector based on the number of elements included in the single clustering vector and the sub-probability parameter; and determining the probability corresponding to the input vector based on the total probability parameter.

[0090] The process of determining the probability parameters corresponding to the single clustering vector and the input vector may include: determining the dot product of the single clustering vector and the input vector respectively, which can be expressed as: multiply(labeli,h), and obtaining the dot product result. The dot product of vectors, also called the inner product or scalar product of vectors, performs a dot product operation on two vectors, that is, multiplying the corresponding bits of the two vectors one by one and then summing them. The result of the dot product is a scalar.

[0091] The process of determining the total probability parameter corresponding to all clustering vectors and the input vector may include: fusing the sub-probability parameters corresponding to the single clustering vectors according to the number of elements included in the single clustering vectors to obtain the total probability parameter sum. Optionally, the number of elements included in the single clustering vector may be regarded as the weight of the corresponding sub-probability parameter, and the above fusion may include: weighting the sub-probability parameters corresponding to the single clustering vectors. It can be understood that the embodiment of the present invention does not limit the specific fusion process.

[0092] In an application example of the present invention, the embedded representation (embed_id) corresponding to the id (identification) of the input data can be obtained, and the embed_id of the id and the input vector h are multiplied to obtain another probability parameter num (such as a numerator), and finally the probability corresponding to the id is determined, and the probability can be the ratio of num to sum.

[0093] It can be understood that the above-mentioned method of using the total probability parameter as the denominator is only an optional embodiment. In fact, those skilled in the art can apply the clustering vector to other probability determination processes according to actual application requirements. The embodiment of the present invention does not limit the specific application method of the clustering vector in the probability determination process.

[0094] The probability in step 303 can be applied to corresponding application scenarios, such as image classification, natural language processing, and other application scenarios.

[0095] In the application scenario of natural language processing, the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector may specifically include:

[0096] The probability of words under preconditions.

[0097] The preset conditions may be determined by specific application scenarios.

[0098] Taking the word formation process of the input method as an example, the above preset conditions may include: input environment, and / or context, and / or frequency of use of candidate items, and / or score of the language model.

[0099] Taking the associative process of the input method as an example, the above-mentioned preset conditions may include: input environment and / or context.

[0100] Taking the candidate item tuning process of the input method as an example, the above-mentioned preset conditions may include: input environment, and / or, context, and / or, the frequency of use of the candidate items, etc.

[0101] In summary, in the data processing method of the embodiment of the present invention, the output layer determines the probability corresponding to the input vector based on the clustering vector and the input vector. Since the clustering vector can be obtained by clustering the first dimension of the original matrix, the above clustering can compress the order of magnitude of the first dimension of the original matrix, thereby reducing the order of magnitude of the original matrix; on this basis, applying the clustering vector with a lower order of magnitude to the process of determining the probability corresponding to the input vector can reduce the amount of calculation of the output layer, thereby improving the calculation performance of the neural network.

[0102] In order to enable those skilled in the art to better understand the embodiments of the present invention, the data processing method of the embodiments of the present invention is described by using specific examples. Figure 4 , shows a data flow chart of a data processing method according to an embodiment of the present invention.

[0103] In this example, the neural network may include: an input layer, a hidden layer, and an output layer.

[0104] The word embedding layer can be a part of the neural network, or the word embedding layer can be independent of the neural network.

[0105] The word embedding layer can be used to provide an embedding representation of a word. The word and its corresponding embedding representation can be obtained by looking up a vocabulary table, which can be used to store the word and its corresponding embedding representation.

[0106] The word embedding layer can provide an original matrix. The original matrix corresponds to the vocabulary of the word embedding layer. Assuming that the original matrix corresponding to the vocabulary is W[T×N], then T can represent the number of words in the vocabulary, and N can represent the dimension of the embedding representation corresponding to the vocabulary. T can be 33276, and N can be 128.

[0107] The word embedding layer can cluster the rows of the original matrix to obtain cluster vectors. The dimension of the cluster vector can be 128, the number of cluster vectors can be 4096, etc., and a cluster vector can include multiple elements.

[0108] The output of the input layer may include: an embedded representation of the input vocabulary, and the hidden layer determines the input vector according to the embedded representation of the input vocabulary and the hidden layer state.

[0109] Optionally, the embedding representation of the input vocabulary can be obtained by querying the vocabulary table. For example, the size of the embedding representation of an input vocabulary can be 1×128, and the size of the output h of the hidden layer can be 128×1, that is, the input vector can be a 128-dimensional vector.

[0110] The output layer can obtain 4096 cluster vectors from the word embedding layer, and the hidden layer can obtain the input vector h, and use Figure 3 The method shown determines the probability corresponding to the input vector h.

[0111] In the related art, the amount of computation of the output layer is 33276*128*1=4259328 multiplication operations. In the embodiment of the present invention, the amount of computation of the output layer can be: 4096*128*1=524288 multiplication operations, and the computing performance is improved by 4259328 / 524288=8.12 times. Of course, 4096 is just an example, and the embodiment of the present invention does not limit the specific number of clustering vectors.

[0112] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0113] Device Embodiment

[0114] Reference Figure 5 , shows a structural block diagram of an embodiment of a data processing device of the present invention, the above device is applied to a neural network, the neural network may include: a hidden layer and an output layer, the device may specifically include the following modules located in the output layer:

[0115] A receiving module 501 is used to receive an input vector; the input vector is provided by the hidden layer;

[0116] A providing module 502 is used to provide a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; and

[0117] The probability determination module 503 is used to determine the probability corresponding to the input vector according to the clustering vector and the input vector.

[0118] Optionally, the probability determination module 503 may specifically include:

[0119] A probability determination module, used to determine probability parameters corresponding to a single clustering vector and the input vector;

[0120] A total probability determination module, used to determine the total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter;

[0121] The probability determination module based on the total probability is used to determine the probability corresponding to the input vector according to the total probability parameter.

[0122] Optionally, the device may further include the following module located at the output layer or the word embedding layer:

[0123] The clustering module is used to cluster the first dimension of the original matrix to obtain a clustering vector.

[0124] Optionally, the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to a weight matrix from the hidden layer to the output layer; or

[0125] The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer.

[0126] Optionally, the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector may specifically include:

[0127] The probability of words under preconditions.

[0128] Optionally, the hidden layer determines the input vector based on an embedded representation of the input vocabulary and a hidden layer state.

[0129] Optionally, the device is applied to a word formation process of an input method, an association process of an input method, or a candidate item frequency modulation process of an input method.

[0130] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0131] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0132] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0133] An embodiment of the present invention provides a device for data processing, including a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations:.

[0134] Figure 6 8 is a block diagram of a data processing apparatus 800 according to an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0135] Reference Figure 6 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0136] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0137] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0138] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0139] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0140] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice data processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0141] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0142] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0143] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency data processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0144] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0145] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0146] Figure 7 1 is a schematic diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.

[0147] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0148] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform Figure 2 or Figure 3 or Figure 4 The data processing method shown.

[0149] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by the processor of a device (server or terminal), the device is able to execute a data processing method, the method comprising: executing through the output layer of the neural network: receiving an input vector; the input vector is provided by the hidden layer; providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; based on the clustering vector and the input vector, determining the probability corresponding to the input vector.

[0150] The embodiment of the present invention discloses A1, a data processing method, applied to a neural network, the neural network comprising: a hidden layer and an output layer; the method comprises:

[0151] The output layer of the neural network performs:

[0152] Receiving an input vector; the input vector is provided by the hidden layer;

[0153] Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector;

[0154] A probability corresponding to the input vector is determined according to the clustering vector and the input vector.

[0155] A2. The method according to A1, wherein determining the probability corresponding to the input vector comprises:

[0156] Determine a probability parameter corresponding to a single clustering vector and the input vector;

[0157] Determine a total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter;

[0158] The probability corresponding to the input vector is determined according to the total probability parameter.

[0159] A3. The method according to A1 or A2, further comprising:

[0160] Performed by the output layer or the word embedding layer:

[0161] Clustering is performed on the first dimension of the original matrix to obtain a clustering vector.

[0162] A4. According to the method described in A1 or A2, the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or

[0163] The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer.

[0164] A5. According to the method described in A1 or A2, the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes:

[0165] The probability of words under preconditions.

[0166] A6. According to the method described in A1 or A2, the hidden layer determines the input vector based on the embedded representation of the input vocabulary and the hidden layer state.

[0167] A7. The method according to A1 or A2 is applied to a word formation process of an input method, an association process of an input method, or a candidate item frequency modulation process of an input method.

[0168] The embodiment of the present invention discloses B8, a data processing device, applied to a neural network, the neural network comprising: a hidden layer and an output layer; the device comprises:

[0169] A receiving module, used for receiving an input vector; the input vector is provided by the hidden layer;

[0170] A module is provided for providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; and

[0171] The probability determination module is used to determine the probability corresponding to the input vector based on the clustering vector and the input vector.

[0172] B9. The apparatus according to B8, wherein the probability determination module comprises:

[0173] A probability determination module, used to determine probability parameters corresponding to a single clustering vector and the input vector;

[0174] A total probability determination module, used to determine the total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter;

[0175] The probability determination module based on the total probability is used to determine the probability corresponding to the input vector according to the total probability parameter.

[0176] B10. The device according to B8 or B9, further comprising:

[0177] The clustering module is used to cluster the first dimension of the original matrix to obtain a clustering vector.

[0178] B11. According to the device described in B8 or B9, the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or

[0179] The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer.

[0180] B12. According to the apparatus described in B8 or B9, the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes:

[0181] The probability of words under preconditions.

[0182] B13. According to the device described in B8 or B9, the hidden layer determines the input vector based on the embedded representation of the input vocabulary and the hidden layer state.

[0183] B14. The device according to B8 or B9 is applied to a word formation process of an input method, an association process of an input method, or a candidate item frequency modulation process of an input method.

[0184] The embodiment of the present invention discloses C15, a device for data processing, the device is applied to a neural network, the neural network comprises: a hidden layer and an output layer; the device comprises a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations:

[0185] Receiving an input vector; the input vector is provided by the hidden layer;

[0186] Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector;

[0187] A probability corresponding to the input vector is determined according to the clustering vector and the input vector.

[0188] C16. According to the apparatus of C15, the determining the probability corresponding to the input vector comprises:

[0189] Determine a probability parameter corresponding to a single clustering vector and the input vector;

[0190] Determine a total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter;

[0191] The probability corresponding to the input vector is determined according to the total probability parameter.

[0192] C17. The device according to C15 or C16, wherein the device is further configured to execute, by one or more processors, the one or more programs including instructions for performing the following operations:

[0193] Clustering is performed on the first dimension of the original matrix to obtain a clustering vector.

[0194] C18. According to the apparatus described in C15 or C16, the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or

[0195] The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer.

[0196] C19. According to the apparatus described in C15 or C16, the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes:

[0197] The probability of words under preconditions.

[0198] C20. According to the device described in C15 or C16, the hidden layer determines the input vector based on the embedded representation of the input vocabulary and the hidden layer state.

[0199] C21. The device according to C15 or C16 is applied to a word formation process of an input method, an association process of an input method, or a candidate item frequency modulation process of an input method.

[0200] An embodiment of the present invention discloses D22, a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to execute the data processing method as described in one or more of A1 to A7.

[0201] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0202] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

[0203] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

[0204] The data processing method, the data processing device and the device for data processing provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained by using specific examples in this article. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A data processing method, characterized in that: Applied to a neural network, the neural network includes: a hidden layer and an output layer; the method is applied to the word formation process of the input method, the association process of the input method, or the frequency modulation process of the candidate items of the input method; the method includes: The output layer of the neural network performs: Receiving an input vector; the input vector is provided by the hidden layer; Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; wherein the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer; Determine the probability corresponding to the input vector according to the clustering vector and the input vector; wherein the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes: the probability of the vocabulary under preset conditions; Wherein, when the method is applied to the word formation process of the input method, the probability of the vocabulary under the preset conditions is used to: receive the user's input string, and query whether there is a word entry corresponding to the input string in the word library, if there is no word entry corresponding to the input string, then intelligently form words for the input string according to the n-gram model to obtain multiple word formation results, and sort the word formation paths corresponding to the multiple word formation results, thereby determining the word formation result with the optimal word formation path and displaying the word formation result with the optimal word formation path to the user; When the method is applied to the association process of the input method, the probability of the vocabulary under the preset conditions is used to provide association candidates to the user according to the input environment and / or context when the user has not typed the input string; When the method is applied to the candidate item frequency adjustment process of the input method, the probability of the vocabulary under the preset conditions is used to adjust the display position of the candidate item corresponding to the input string, and the preset conditions include: input environment, and / or context, and / or the frequency of use of the candidate item; Wherein, determining the probability corresponding to the input vector includes: Determine a probability parameter corresponding to a single clustering vector and the input vector; Determine a total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter; The probability corresponding to the input vector is determined according to the total probability parameter.

2. The method according to claim 1, characterized in that The method further comprises: Performed by the output layer or the word embedding layer: Clustering is performed on the first dimension of the original matrix to obtain a clustering vector.

3. The method according to claim 1, characterized in that The hidden layer determines the input vector according to the embedded representation of the input vocabulary and the hidden layer state.

4. A data processing device, characterized in that: Applied to a neural network, the neural network includes: a hidden layer and an output layer; the device is applied to the word formation process of the input method, the association process of the input method, or the frequency modulation process of the candidate items of the input method; the device includes: A receiving module, used for receiving an input vector; the input vector is provided by the hidden layer; A providing module, configured to provide a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; wherein the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer; A probability determination module, configured to determine the probability corresponding to the input vector based on the clustering vector and the input vector; wherein the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes: the probability of the vocabulary under preset conditions; Wherein, when the device is applied to the word formation process of the input method, the probability of the vocabulary under the preset conditions is used to: receive the user's input string, and query whether there is a word entry corresponding to the input string in the word library, if there is no word entry corresponding to the input string, then intelligently form words for the input string according to the n-gram model to obtain multiple word formation results, and sort the word formation paths corresponding to the multiple word formation results, thereby determining the word formation result with the optimal word formation path and displaying the word formation result with the optimal word formation path to the user; When the device is applied to the association process of the input method, the probability of the vocabulary under the preset conditions is used to provide association candidates to the user according to the input environment and / or context when the user has not typed the input string; When the device is applied to the candidate item frequency adjustment process of the input method, the probability of the vocabulary under the preset conditions is used to adjust the display position of the candidate item corresponding to the input string, and the preset conditions include: input environment, and / or context, and / or the frequency of use of the candidate item; The probability determination module comprises: A probability determination module, used to determine probability parameters corresponding to a single clustering vector and the input vector; A total probability determination module, used to determine the total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter; The probability determination module based on the total probability is used to determine the probability corresponding to the input vector according to the total probability parameter.

5. A device for data processing, characterized in that: The device is applied to a neural network, and the neural network includes: a hidden layer and an output layer; the device is applied to a word formation process of an input method, an association process of an input method, or a frequency modulation process of candidate items of an input method; the device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations: Receiving an input vector; the input vector is provided by the hidden layer; Providing a clustering vector; the original matrix is ​​provided by the hidden layer or the word embedding layer; the clustering vector is obtained by clustering the first dimension of the original matrix, and the number of the second dimension of the original matrix is ​​equal to the dimension of the input vector; wherein the original matrix is ​​provided by the hidden layer, and the original matrix corresponds to the weight matrix from the hidden layer to the output layer; or The original matrix is ​​provided by the word embedding layer, and the original matrix corresponds to the vocabulary of the word embedding layer; Determine the probability corresponding to the input vector according to the clustering vector and the input vector; wherein the original matrix corresponds to the vocabulary of the word embedding layer, and the probability corresponding to the input vector includes: the probability of the vocabulary under preset conditions; Wherein, when the device is applied to the word formation process of the input method, the probability of the vocabulary under the preset conditions is used to: receive the user's input string, and query whether there is a word entry corresponding to the input string in the word library, if there is no word entry corresponding to the input string, then intelligently form words for the input string according to the n-gram model to obtain multiple word formation results, and sort the word formation paths corresponding to the multiple word formation results, thereby determining the word formation result with the optimal word formation path and displaying the word formation result with the optimal word formation path to the user; When the device is applied to the association process of the input method, the probability of the vocabulary under the preset conditions is used to provide association candidates to the user according to the input environment and / or context when the user has not typed the input string; When the device is applied to the candidate item frequency adjustment process of the input method, the probability of the vocabulary under the preset conditions is used to adjust the display position of the candidate item corresponding to the input string, and the preset conditions include: input environment, and / or context, and / or the frequency of use of the candidate item; The probability determination module comprises: A probability determination module, used to determine probability parameters corresponding to a single clustering vector and the input vector; A total probability determination module, used to determine the total probability parameter corresponding to all clustering vectors and the input vector according to the number of elements included in the single clustering vector and the probability parameter; The probability determination module based on the total probability is used to determine the probability corresponding to the input vector according to the total probability parameter.

6. A machine-readable medium having instructions stored thereon, which, when executed by one or more processors, cause an apparatus to perform a data processing method as claimed in one or more of claims 1 to 3.