CN114168862B - Collaborative filtering-based product recommendation method, device, equipment and storage medium - Google Patents
Collaborative filtering-based product recommendation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN114168862B CN114168862B CN202111524011.6A CN202111524011A CN114168862B CN 114168862 B CN114168862 B CN 114168862B CN 202111524011 A CN202111524011 A CN 202111524011A CN 114168862 B CN114168862 B CN 114168862B
- Authority
- CN
- China
- Prior art keywords
- product
- user
- matrix
- similarity
- numbers
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9536—Search customisation based on social or collaborative filtering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0241—Advertisements
- G06Q30/0251—Targeted advertisements
- G06Q30/0255—Targeted advertisements based on user history
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0631—Recommending goods or services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/06—Asset management; Financial planning or analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Finance (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Strategic Management (AREA)
- General Engineering & Computer Science (AREA)
- General Business, Economics & Management (AREA)
- Economics (AREA)
- Marketing (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Game Theory and Decision Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Entrepreneurship & Innovation (AREA)
- Probability & Statistics with Applications (AREA)
- Human Resources & Organizations (AREA)
- Operations Research (AREA)
- Technology Law (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the field of big data and discloses a product recommendation method, device, equipment and storage medium based on collaborative filtering. The method comprises the following steps: receiving a recommendation request, and acquiring original data and a plurality of pieces of portrait data; constructing a user product scoring matrix based on the original data, and calculating a user similarity matrix and a product similarity matrix; calculating an image similarity matrix based on the image data; respectively calculating two collaborative filtering matrixes based on a user and a product according to the user similarity matrix, the product similarity matrix and the portrait similarity matrix, multiplying the user product scoring matrixes with the two collaborative filtering matrixes respectively, and carrying out weighted summation on multiplication results based on preset weights to obtain a user product scoring matrix; and recommending the product to the user according to the scoring matrix. The invention integrates the portrait information of the user on the basis of collaborative filtering based on the basic information of the user and the basic information of the product, so as to improve the accuracy of product recommendation.
Description
Technical Field
The invention relates to the field of big data, in particular to a collaborative filtering-based product recommendation method, a collaborative filtering-based product recommendation device, a collaborative filtering-based product recommendation equipment and a storage medium.
Background
Collaborative filtering recommendation (Collaborative Filtering recommendation) is a technique that is rapidly becoming a popular technique in information filtering and information systems, and is widely used in recommendation systems for products. Different from the traditional method for directly analyzing content based on content filtering to recommend, collaborative filtering is used for analyzing user interests, similar (interest) users of a specified user are found in a user group, evaluation of the similar users on certain information is integrated, and preference degree prediction of the specified user on the information is formed by the system, so that products of interest of the user are predicted.
The existing collaborative filtering-based product recommendation method only calculates the product similarity or the user similarity from the basic information of the user or the product to perform collaborative filtering, and the accuracy is low.
Disclosure of Invention
The invention mainly aims to solve the problem of low accuracy of the existing collaborative filtering-based product recommendation method.
The first aspect of the invention provides a collaborative filtering-based product recommendation method, which comprises the following steps:
Receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
Constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
Calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product;
calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
Calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
And calculating a user product scoring matrix based on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix, and recommending products to each user according to the user product scoring matrix.
Optionally, in a first implementation manner of the first aspect of the present invention, the constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference value of each of the users for each of the products includes:
based on the number N of the user numbers and the number M of the product numbers, constructing a blank matrix with the size of N rows by M columns;
Sorting the user numbers and the product numbers according to the numerical values of the numbers, and generating a user number sequence and a product number sequence respectively;
Establishing a row mapping relation between the user number sequence and the blank matrix, and establishing a column mapping relation between the product number sequence and the blank matrix;
And filling the preference value of each user for each product to the corresponding position in the blank matrix according to the row mapping relation and the column mapping relation to obtain a user product scoring matrix.
Optionally, in a second implementation manner of the first aspect of the present invention, after the constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference values of each of the users for each of the products, calculating a user product scoring matrix based on the user product scoring matrix, the collaborative filtering matrix based on the users, and the collaborative filtering matrix based on the products, and before recommending the products to each of the users according to the user product scoring matrix, further includes:
decomposing the scoring matrix of the user product based on an optimized singular value decomposition algorithm to obtain a first hidden factor matrix related to the user and a second hidden factor matrix related to the product;
according to a random gradient descent algorithm and a preset optimal target parameter, iteratively updating the first hidden factor matrix and the second hidden factor matrix to obtain a target first hidden factor matrix and a target second hidden factor matrix;
multiplying the target first hidden factor matrix with the target second hidden factor matrix to obtain a full-rank user product scoring matrix.
Optionally, in a third implementation manner of the first aspect of the present invention, calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each of the users for each of the products, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each of the users for each of the products, includes:
Calculating an average preference value of the users according to the number of the user numbers and the preference value of each user for each product, and calculating an average preference value of the products according to the number of the product numbers and the preference value of each user for each product;
Calculating the average preference value of the users and the preference value of each user for each product based on a Person correlation coefficient algorithm to obtain the similarity of the users between each user, and calculating the average preference value of the products and the preference value of each user for each product to obtain the similarity of the products between each product;
Generating a user similarity matrix based on the user numbers of the plurality of users and the user similarity between each of the users, and generating a product similarity matrix based on the product numbers of the plurality of products and the product similarity between each of the financial products.
Optionally, in a fourth implementation manner of the first aspect of the present invention, after calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product, after calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule, to obtain a collaborative filtering matrix based on the user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule, before obtaining a collaborative filtering matrix based on the product, the method further includes:
Clustering the users and the products respectively, and calculating a first time attenuation coefficient of the user on the product clustering and a second time attenuation coefficient of the learning user clustering on the product;
Sequentially calculating a first time attenuation variable corresponding to the first time attenuation coefficient and a second time attenuation variable corresponding to the second time attenuation coefficient based on a preset time attenuation function;
Performing product operation on the first time attenuation variable and the user similarity matrix to obtain a user similarity matrix which changes along with time attenuation;
And carrying out product operation on the second time attenuation variable and the product similarity matrix to obtain a product similarity matrix which changes along with time attenuation.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the calculating an image similarity matrix based on the plurality of pieces of image data includes:
extracting the characteristics of the plurality of pieces of image data to obtain a plurality of image characteristic vectors;
and calculating the image similarity between each image data based on the plurality of image feature vectors and a preset similarity calculation function, and generating an image similarity matrix according to the image similarity between each image data.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the calculating a user product score matrix based on the user product score matrix, the user based collaborative filtering matrix, and a product based collaborative filtering matrix, and recommending products to each user according to the user product score matrix includes:
performing product operation on the user product scoring matrix and the user-based collaborative filtering matrix and the product-based collaborative filtering matrix respectively to obtain a first user product scoring matrix and a second user product scoring matrix;
And carrying out weighted summation on the first user product scoring matrix and the second user product scoring matrix based on the preset weight of the first user product scoring matrix and the preset weight of the second user product scoring matrix to obtain a user product scoring matrix, and recommending products to each user according to the user product scoring matrix.
The second aspect of the present invention provides a product recommendation device based on collaborative filtering, comprising:
The data acquisition module is used for receiving a product recommendation request sent by a terminal and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
The scoring matrix construction module is used for constructing a scoring matrix of user products based on the user numbers of the users, the product numbers of the products and the preference value of each user for each product;
A first matrix calculation module, configured to calculate a user similarity matrix based on user numbers of the plurality of users and preference values of each user for each product, and calculate a product similarity matrix based on product numbers of the plurality of products and preference values of each user for each product;
A second matrix calculation module, configured to calculate an image similarity matrix based on the plurality of pieces of image data, where the image similarity matrix is used to represent a similarity between each piece of image data;
The filtering matrix calculation module is used for calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
And the product recommendation module is used for calculating a user product scoring matrix based on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix and recommending products to each user according to the user product scoring matrix.
Optionally, in a first implementation manner of the second aspect of the present invention, the scoring matrix construction module specifically includes:
An initializing unit, configured to construct a blank matrix with a size of N rows by M columns based on the number N of the user numbers and the number M of the product numbers;
The ordering unit is used for ordering the user numbers and the product numbers according to the numerical values of the numbers, and generating a user number sequence and a product number sequence respectively;
The association unit is used for establishing a row mapping relation between the user number sequence and the blank matrix and a column mapping relation between the product number sequence and the blank matrix;
And the filling unit is used for filling the preference value of each user for each product to the corresponding position in the blank matrix according to the row mapping relation and the column mapping relation to obtain a user product scoring matrix.
Optionally, in a second implementation manner of the second aspect of the present invention, the scoring matrix construction module specifically includes:
An initializing unit, configured to construct a blank matrix with a size of N rows by M columns based on the number N of the user numbers and the number M of the product numbers;
The ordering unit is used for respectively ordering the user numbers and the product numbers according to the numerical values of the numbers to generate a user number sequence and a product number sequence;
The association unit is used for establishing a row mapping relation between the user number sequence and the blank matrix and a column mapping relation between the product number sequence and the blank matrix;
the filling unit is used for filling the preference value of each user for each product to the corresponding position in the blank matrix according to the row mapping relation and the column mapping relation to obtain a user product scoring matrix;
The decomposition unit is used for decomposing the scoring matrix of the user product based on an optimized singular value decomposition algorithm to obtain a first hidden factor matrix related to the user and a second hidden factor matrix related to the product;
the updating unit is used for carrying out iterative updating on the first hidden factor matrix and the second hidden factor matrix according to a random gradient descent algorithm and a preset optimal target parameter to obtain a target first hidden factor matrix and a target second hidden factor matrix;
And the product unit is used for multiplying the target first implicit factor matrix with the target second implicit factor matrix to obtain a full-rank user product scoring matrix.
Optionally, in a third implementation manner of the second aspect of the present invention, the first matrix calculation module specifically includes:
an average value calculating unit, configured to calculate an average preference value of a user according to the number of the user numbers and a preference value of each user for each product, and calculate an average preference value of a product according to the number of the product numbers and a preference value of each user for each product;
the similarity calculation unit is used for calculating the average preference value of the users and the preference value of each user for each product based on a Person correlation coefficient algorithm to obtain the similarity of the users among the users, and calculating the average preference value of each product and the preference value of each user for each product to obtain the similarity of the products among the products;
A matrix generation unit configured to generate a user similarity matrix based on user numbers of the plurality of users and user similarity between each of the users, and generate a product similarity matrix based on product numbers of the plurality of products and product similarity between each of the financial products.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the first matrix calculation module specifically includes:
an average value calculating unit, configured to calculate an average preference value of a user according to the number of the user numbers and a preference value of each user for each product, and calculate an average preference value of a product according to the number of the product numbers and a preference value of each user for each product;
the similarity calculation unit is used for calculating the average preference value of the users and the preference value of each user for each product based on a Person correlation coefficient algorithm to obtain the similarity of the users among the users, and calculating the average preference value of each product and the preference value of each user for each product to obtain the similarity of the products among the products;
A matrix generation unit configured to generate a user similarity matrix based on user numbers of the plurality of users and user similarity between each of the users, and generate a product similarity matrix based on product numbers of the plurality of products and product similarity between each of the financial products;
The attenuation coefficient calculation unit is used for respectively clustering the user and the product, and calculating a first time attenuation coefficient of the user for clustering the product and a second time attenuation coefficient of the learning user for clustering the product;
The attenuation variable calculation unit is used for sequentially calculating a first time attenuation variable corresponding to the first time attenuation coefficient and a second time attenuation variable corresponding to the second time attenuation coefficient based on a preset time attenuation function;
the first matrix updating unit is used for carrying out product operation on the first time attenuation variable and the user similarity matrix to obtain a user similarity matrix which changes along with time attenuation;
and the second matrix updating unit is used for carrying out product operation on the second time attenuation variable and the product similarity matrix to obtain the product similarity matrix which changes along with time attenuation.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the second matrix calculation module specifically includes:
The feature extraction unit is used for extracting features of the plurality of pieces of image data to obtain a plurality of image feature vectors;
And the similarity calculation unit is used for calculating the image similarity between each image data based on the plurality of image feature vectors and a preset similarity calculation function and generating an image similarity matrix according to the image similarity between each image data.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the product recommendation module specifically includes:
The scoring matrix calculation unit is used for carrying out product operation on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix respectively to obtain a first user product scoring matrix and a second user product scoring matrix;
and the product recommending unit is used for carrying out weighted summation on the first user product scoring matrix and the second user product scoring matrix based on the preset weight of the first user product scoring matrix and the preset weight of the second user product scoring matrix to obtain a user product scoring matrix, and recommending products to each user according to the user product scoring matrix.
A third aspect of the present invention provides a collaborative filtering-based product recommendation apparatus, comprising: a memory and at least one processor, the memory having instructions stored therein; the at least one processor invokes the instructions in the memory to cause the collaborative filtering-based product recommendation device to perform the collaborative filtering-based product recommendation method described above.
A fourth aspect of the present invention provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the collaborative filtering-based product recommendation method described above.
According to the technical scheme provided by the invention, firstly, the original data and the portrait data are acquired, a user product scoring matrix is constructed based on the original data, then the user similarity matrix and the product similarity matrix are calculated based on the original data, the portrait similarity matrix is calculated based on the portrait data, then the collaborative filtering matrix based on the user and the collaborative filtering matrix based on the portrait similarity matrix are calculated based on the user, the product operation is further carried out on the two collaborative filtering matrices as a basic matrix, two user product scoring matrices evaluated from the user dimension and the product dimension are obtained, finally, different weight coefficients are set for the two user product scoring matrices, and then the weighted summation is carried out, so that the user product scoring matrix is obtained to recommend products with higher scores to corresponding users. The invention integrates the portrait information of the user on the basis of collaborative filtering based on the basic information of the user and the basic information of the product, so as to improve the accuracy of product recommendation.
Drawings
FIG. 1 is a schematic diagram of a first embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a second embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a third embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention;
FIG. 4 is a diagram of a fourth embodiment of a collaborative filtering-based product recommendation method in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of an embodiment of a collaborative filtering-based product recommendation device according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another embodiment of a collaborative filtering-based product recommendation device according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an embodiment of a collaborative filtering-based product recommendation device according to an embodiment of the present invention.
Fig. 8 is a schematic diagram of a structure of a user similarity matrix according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a collaborative filtering-based product recommendation method, a collaborative filtering-based product recommendation device and a storage medium, and the accuracy is higher.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For ease of understanding, a specific flow of an embodiment of the present invention is described below, referring to fig. 1, and an embodiment of a collaborative filtering-based product recommendation method in an embodiment of the present invention includes:
101. Receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
it should be understood that the product type of the product recommendation request is not limited in this embodiment, and the product recommendation method is described in detail in this embodiment and the following embodiments by taking a financial product as an example.
It can be understood that the raw data includes user identification information (i.e. user id) stored in the system database, identification information (i.e. product id) of the financial product, and preference value information of the user for the financial product, where the preference value is positively correlated with user feedback information such as historical purchase times, collection amount, and scores of the user for the financial product, and in this embodiment, the calculation mode of the preference value is not limited, for example, the preference value weight of the historical purchase times is 10, the preference value weight of the collection is 100, the preference value weight of the scores is 1, and if the historical purchase times of the user a for the financial product B is 2, the product score is 30, and the user a collects the financial product B, the preference value of the user a for the financial product B is 150.
The portrait data includes user portrait information of the user including age, income, sex, etc. of the user and product portrait information of the financial product historically purchased by the user including age, price, rate of return, etc. of the product. Different portrait data distinguish user portraits corresponding to different users and product portraits of historical purchase products.
102. Constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
It can be understood that the server first constructs a blank matrix, where the size of the matrix depends on the number of users and the number of financial products in the original data, for example, the number of users corresponding to the number of users is N, and the number of financial products corresponding to the number of products is M, and constructs a blank matrix with a size of N rows by M columns; secondly, sorting the user numbers and the product numbers according to the numerical values of the numbers to generate a user number sequence and a product number sequence; then establishing a row mapping relation between the user number sequence and the blank matrix and a column mapping relation between the product number sequence and the blank matrix; according to the row mapping relation and the column mapping relation, the preference value of each user for each financial product is used as a score, and the score is filled into the corresponding position in the blank matrix to obtain a user product scoring matrix, for example, the user numbering sequence is A= [ A1, A2], the product numbering sequence is B= [ B1, B2, B3], the constructed blank matrix T is a matrix with 2 rows and 3 columns, namely, the matrix T comprises 6 cells, and the row mapping relation between the sequence A and the matrix T is specifically as follows: the user number A1 corresponds to a first row in the matrix T and the user number A2 corresponds to a second row in the matrix T. The column mapping relation between the sequence B and the matrix T is specifically as follows: the product number A1 corresponds to a first column in the matrix T, the product number A2 corresponds to a second column in the matrix T, and the product number A3 corresponds to a third column in the matrix T; further, the server fills the preference value of the user A1 to the financial product B1 into the cells of the first row and the first column in the matrix T according to the row mapping relation and the column mapping relation, fills the preference value of the user A1 to the financial product B2 into the cells of the first row and the second column in the matrix T, and fills the preference value of the user A1 to the financial product B3 into the cells of the third row in the matrix T; similarly, the server fills the preference value of the user A2 for the financial product B1 into the cells of the first row and the first column in the matrix T, fills the preference value of the user A2 for the financial product B2 into the cells of the second row and the second column in the matrix T, and fills the preference value of the user A2 for the financial product B3 into the cells of the second row and the third column in the matrix T.
103. Calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product;
It may be understood that the elements in the user similarity matrix are composed of similarities between users, and similarly, the elements in the product similarity matrix are composed of similarities between financial products, so that the server first calculates the similarities between users and between financial products according to the original data, and the similarity can be calculated in various manners, such as pearson correlation coefficient algorithm, euclidean distance algorithm, etc., which is not limited in this embodiment. It should be noted that, the row-column lengths of the user similarity matrix and the product similarity matrix are equal, in the user similarity matrix, if the number of users is M, the user similarity matrix is a matrix of M rows by M columns; in the product similarity matrix, if the number of the financial products is N, the product similarity matrix is a matrix of N rows by N columns. Further, the server respectively constructs two blank matrices according to the number of users and the number of financial products, then fills each calculated user similarity to a corresponding position in the corresponding matrix, and fills each calculated product similarity to a corresponding position in the corresponding matrix, for example, please refer to fig. 8, wherein A1-A4 are user numbers, sim (A1, A2), sim (A1, A3), and the like are used for representing the user similarity between the corresponding users of the two user numbers. Similarly, the method for generating the product similarity matrix refers to the user similarity matrix. .
104. Calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
it will be appreciated that the elements in the representation similarity matrix consist of the similarity between the representation data, which consists of the representations of the user and their corresponding historic purchased financial product representations, so that the size of the representation similarity matrix depends on the number of users. Specifically, the server first converts the portrait data (i.e., text data) into a vector representation to further perform quantization calculation on the portrait data, so as to calculate the similarity between the portrait data, and the calculation mode of the similarity is not limited in this embodiment. Further, the server constructs a blank matrix with equal row-column length according to the number of users, sorts the image data, corresponds to the rows and columns in the matrix, and finally fills the calculated image similarity to the corresponding position in the blank matrix.
Specifically, the server performs feature extraction on the image data, in this embodiment, the feature extraction manner is not limited, for example, the image data is directly processed through CountVectorizer functions in a Spark computing engine, so that the image data is converted into a word frequency matrix, an iteratable object in the text is further converted into a two-dimensional array through a transformation function, the two-dimensional array obtained through processing is then converted into a previous data format, and finally, feature vectors corresponding to words are returned. Further, the server calculates the similarity between feature vectors corresponding to the portrait data based on a similarity algorithm, and the similarity calculation function may be a euclidean distance algorithm, or may be another similarity calculation function for calculating the similarity, which is not limited in this embodiment. For example, the portrait data L1 includes user portrait data a1 of a user a and product portrait data b1 of a user a historical purchase product, the portrait data L2 includes user portrait data a2 of a user b and product portrait data b2 of a user b historical purchase product, the server firstly performs feature extraction on L1 and L2 to obtain feature vectors α and β corresponding to L1, and secondly calculates similarity between the feature vectors α and β to obtain similarity between the portrait data L1 and the portrait data L2. Finally, according to the similarity between each image data, an image similarity matrix is generated, and the generation method of the image similarity matrix is similar to the generation method of the user similarity matrix, and refer to fig. 8 specifically.
105. According to a preset first calculation rule, calculating a user similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a user, and according to a preset second calculation rule, calculating a product similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a product;
It can be understood that the server correlates the user similarity matrix with the portrait similarity matrix to obtain a collaborative filtering matrix based on the user, and correlates the product similarity matrix with the portrait similarity matrix to obtain a collaborative filtering matrix based on the product, and the calculation rule refers to formula one:
Aenhcor=α*Aratcor+β*Ademcor+γ*(Aratcor*Ademcor)
Equation one
Wherein a ratcor is a user similarity matrix or a product similarity matrix, a demcor is an image similarity matrix, and α, β, γ are balance coefficients, preferably, in this embodiment, all three are 1. It will be appreciated that when a ratcor is the user similarity matrix, then a enhcor is the user-based collaborative filtering matrix; when a ratcor is a product similarity matrix, a enhcor is a product-based collaborative filtering matrix.
106. Based on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix, a user product scoring matrix is calculated, and products are recommended to each user according to the user product scoring matrix.
It can be understood that, based on the collaborative filtering matrix of the user, the original score of the user on the financial product is estimated from the user level, while based on the collaborative filtering matrix of the product, the original score of the user on the financial product is estimated from the product level, and the server performs product operation on the scoring matrix of the user product and the scoring matrix of the user product respectively, so as to obtain corresponding prediction scoring matrices, namely a first scoring matrix of the user product and a second scoring matrix of the user product.
Further, in order to improve the accuracy of prediction as much as possible, the server further combines the first user product score matrix and the second user product score matrix, and introduces coefficient variables into the first user product score matrix and the second user product score matrix, so as to flexibly adjust the dependence degree of the system on the first user product score matrix and the second user product score matrix, and obtain a user product score matrix for product recommendation finally, so as to evaluate the original scores of the users on the financial products from the user layer and the product layer simultaneously, please refer to formula two:
Awhole=λAmark1+(1-λ)Amark2
Formula II
Wherein, A whole is the integral user product scoring matrix, A mark1 is the first user product scoring matrix, A mark2 is the second user product scoring matrix, lambda is the balance coefficient, and the adjustment can be flexibly performed according to the actual scene requirement.
Optionally, after the server calculates the user product score matrix for product recommendation, the server may normalize the user product score matrix based on a normalization function. It will be appreciated that some users may prefer only a portion of the financial product, so that a very high or very low preference value is given to the financial product, and in order to increase the consistent comparability of the user's scores to the financial product, the server normalizes the predicted scores of each user to the financial product to reduce the degree of data dispersion between the score results, and the normalization function is not limited in this embodiment.
Finally, the server acquires the scoring condition of the same user on different products in the scoring matrix of the user products, and recommends the corresponding products to the user according to a preset recommendation strategy aiming at the scoring condition, for example, recommends all financial products with scores greater than a preset threshold value to the user, or recommends one financial product with the highest score to the user.
In the embodiment, the portrait information of the user is integrated on the basis of collaborative filtering based on the basic information of the user and the basic information of the product, so that the accuracy of product recommendation is improved.
Referring to fig. 2, a second embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention includes:
201. Receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
202. Constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
Steps 201 to 202 are similar to the steps 101 to 102, and are not repeated here.
203. Decomposing the scoring matrix of the user product based on an optimized singular value decomposition algorithm to obtain a first hidden factor matrix related to the user and a second hidden factor matrix related to the product;
It can be understood that the scoring matrix of the user product includes M users and N financial products, and the server performs singular value decomposition on the scoring matrix of the user product to obtain a hidden factor matrix U related to the user and a hidden factor matrix M related to the financial product, where U is an f×m order matrix, and M is an f×n order matrix, and F is the number of singular values, that is, the number of hidden factors.
204. According to a random gradient descent algorithm and a preset optimal target parameter, iteratively updating the first hidden factor matrix and the second hidden factor matrix to obtain a target first hidden factor matrix and a target second hidden factor matrix;
It can be appreciated that the server iteratively updates the first hidden factor and the second hidden factor based on a random gradient descent algorithm, thereby allowing the target parameter to reach an optimal value. Specifically, the server firstly determines a factor number F, a penalty parameter lambda and a learning rate alpha, and initializes a first hidden factor and a second hidden factor; and calculating a scoring error beta for each scoring pair (such as the user A-financial product b), updating vector representations of the first hidden factor and the second hidden factor according to the error beta, the punishment parameter lambda and the learning rate alpha, calculating a target parameter E corresponding to the updated first hidden factor and second hidden factor, updating the learning rate alpha if the target parameter E is smaller than a value before updating, and continuously calculating the error and updating the hidden factor until the target parameter E oscillates in a small amplitude range or reaches preset iterative updating times.
205. Multiplying the target first implicit factor matrix by the target second implicit factor matrix to obtain a full-rank user product scoring matrix;
it should be understood that, the matrix with full rank includes a matrix with full rank of rows, a matrix with full rank of columns and a square matrix (i.e. the rows and columns are all full rank), which is not limited by the implementation, and by constructing the scoring matrix of the user product with full rank, the sparsity of the elements in the matrix can be reduced to a certain extent, so that the waste of the data storage space is reduced.
206. Calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product;
207. Calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
208. according to a preset first calculation rule, calculating a user similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a user, and according to a preset second calculation rule, calculating a product similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a product;
209. and calculating a user product scoring matrix according to the user product scoring matrix, the collaborative filtering matrix based on the user and the collaborative filtering matrix based on the product, and recommending the product to each user according to the user product scoring matrix.
Steps 206 to 209 are similar to the steps 103 to 106, and are not repeated here.
In this embodiment, a process of processing the user product scoring matrix to convert it into a full rank matrix is described in detail, and sparsity of elements in the matrix is reduced by constructing the full rank user product scoring matrix, so as to save data storage space resources.
Referring to fig. 3, a third embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention includes:
301. receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
302. Constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
Steps 301 to 302 are similar to the steps 101 to 102, and are not repeated here.
303. Calculating an average preference value of the users according to the number of the user numbers and the preference value of each user for each product, and calculating an average preference value of the products according to the number of the product numbers and the preference value of each user for each product;
It can be understood that the server sums the preference values of each financial product by a certain user, divides the sum by the total number of financial products to obtain the average preference value of the user, sums the different preference values of a certain financial product by different users, and divides the sum by the total number of users to obtain the average preference value of the financial product.
304. Calculating the average preference value of the users and the preference value of each user for each product based on the Person correlation coefficient algorithm to obtain the similarity of the users between each user, and calculating the average preference value of the products and the preference value of each user for each product to obtain the similarity of the products between each product;
The Pearson correlation coefficient function (Pearson Correlation Coefficient) is used to calculate the linear correlation between two variables, and can be used to calculate the similarity between two variables, and the Pearson formula for calculating the similarity between user u and user v refers to formula three:
wherein I is a set of financial products commonly preferred by user u and user v, For the average preference value of user u,Is the average preference value for user v.
Similarly, the similarity Pearson formula between financial product i and financial product j please refer to formula four:
where U is the set of users who produce preference values for both financial product i and financial product j, For the average preferred value of the financial product i,Is the average preferred value for financial product j.
305. Generating a user similarity matrix based on the user numbers of the plurality of users and the user similarity between each user, and generating a product similarity matrix based on the product numbers of the plurality of products and the product similarity between each product;
Further, the server constructs a matrix with an element of empty according to the user numbers of the multiple users in the original data, for example, the user number of the user 1 is A1, the user number of the user 2 is A2, the user number of the user 3 is A3, the user number of the user 4 is A4, then the server constructs a empty matrix with a size of 4 rows by 4 columns, the identification information of the users is arranged and then corresponds to the rows and columns of the empty matrix respectively, and finally, the corresponding user similarity is filled in the corresponding position in the matrix to obtain the user similarity matrix, for example, please refer to fig. 8. Similarly, the method for generating the product similarity matrix refers to the user similarity matrix.
306. Calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
307. According to a preset first calculation rule, calculating a user similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a user, and according to a preset second calculation rule, calculating a product similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a product;
308. And calculating a user product scoring matrix according to the user product scoring matrix, the collaborative filtering matrix based on the user and the collaborative filtering matrix based on the product, and recommending the product to each user according to the user product scoring matrix.
Steps 306-308 are similar to the steps 104-106, and detailed descriptions thereof are omitted herein.
In this embodiment, a calculation process of a user similarity matrix and a product similarity matrix is described in detail, similarity is calculated through deviation of a mean value and an actual value, and a distribution matrix of the similarity is constructed according to each similarity, so that products are scored from a user angle and from a product angle.
Referring to fig. 4, a fourth embodiment of a collaborative filtering-based product recommendation method according to an embodiment of the present invention includes:
401. Receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
402. constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
403. calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product;
steps 401 to 403 are similar to the steps 101 to 103, and are not repeated here.
404. Clustering the users and the products respectively, and calculating a first time attenuation coefficient of the user on the product clustering and a second time attenuation coefficient of the learning user clustering on the product;
It can be understood that the server performs clustering through a preset data set, where the data set includes financial product data and user data, that is, the financial product data is clustered and the user data is clustered respectively, and a clustering algorithm, such as a k-means clustering algorithm, is not limited in this embodiment. Further, the server trains to obtain the interest change speed of the user on the financial product cluster, namely the time attenuation coefficient according to the grading condition of the user on all financial products in the cluster.
Specifically, the server measures whether the prediction function reflects the scoring behavior of the user on the financial product by ignoring the score of a certain user on a certain product at a time and then calculating an average absolute error (MAE) according to the ignored score, wherein the MAE is a function taking a time attenuation coefficient as a parameter, when the MAE is smaller, the accuracy of the prediction function is higher, and the optimization of the MAE is more difficult in view of the fact that the MAE is a non-convex function, so that the server calculates the MAE by calculating an approximate minimum value of the MAE, specifically, the server calculates the MAE by selecting a plurality of discrete ignored scores according to a preset scoring range and selecting the minimum value as an optimal value, thereby approximately calculating the personalized time attenuation coefficient for each user cluster and each financial product cluster.
405. Sequentially calculating a first time attenuation variable corresponding to the first time attenuation coefficient and a second time attenuation variable corresponding to the second time attenuation coefficient based on a preset time attenuation function;
It should be appreciated that the time decay function is used to represent the change of the interest of the user in the financial product with time, please refer to the formula five:
Where α is a time attenuation coefficient, representing a speed of change of the similarity with time, and Δt is a change time. Substituting the calculated first time attenuation coefficient and second time attenuation coefficient into a formula five to obtain a first time attenuation variable and a second time attenuation variable.
406. Performing product operation on the first time attenuation variable and the user similarity matrix to obtain a user similarity matrix which changes along with time attenuation, and performing product operation on the second time attenuation variable and the product similarity matrix to obtain a product similarity matrix which changes along with time attenuation;
It will be appreciated that the server obtains a time-varying similarity matrix of matrix elements (i.e. similarities) by multiplying a time-decay variable by each element in the similarity matrix by introducing a time-decay variable to each similarity in the matrix.
407. Calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
408. according to a preset first calculation rule, calculating a user similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a user, and according to a preset second calculation rule, calculating a product similarity matrix and an image similarity matrix to obtain a collaborative filtering matrix based on a product;
409. and calculating a user product scoring matrix according to the user product scoring matrix, the collaborative filtering matrix based on the user and the collaborative filtering matrix based on the product, and recommending the product to each user according to the user product scoring matrix.
Steps 407 to 409 are similar to the steps 104 to 106, and are not repeated here.
In this embodiment, how to generate the user similarity matrix and the product similarity matrix which change with time attenuation is described in detail, so that the change situation of the interest of the user in the product with time is introduced.
The product recommendation method based on collaborative filtering in the embodiment of the present invention is described above, and the product recommendation device based on collaborative filtering in the embodiment of the present invention is described below, referring to fig. 5, an embodiment of the product recommendation device based on collaborative filtering in the embodiment of the present invention includes:
A data obtaining module 501, configured to receive a product recommendation request sent by a terminal, and obtain raw data and a plurality of pieces of portrait data according to the product recommendation request, where the raw data includes a user number of a plurality of users, a product number of a plurality of products, and a preference value of each user for each product, and each piece of portrait data is used to represent user portrait information of each user and product portrait information corresponding to a historical purchase product of each user;
a scoring matrix construction module 502, configured to construct a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference value of each user for each product;
A first matrix calculating module 503, configured to calculate a user similarity matrix based on the user numbers of the plurality of users and the preference value of each of the users for each of the products, and calculate a product similarity matrix based on the product numbers of the plurality of products and the preference value of each of the users for each of the products;
A second matrix calculation module 504, configured to calculate an image similarity matrix based on the plurality of pieces of image data, where the image similarity matrix is used to represent a similarity between each piece of image data;
The filtering matrix calculating module 505 is configured to calculate the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculate the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
the product recommendation module 506 is configured to calculate a user product score matrix based on the user product score matrix, the user-based collaborative filtering matrix, and a product-based collaborative filtering matrix, and recommend a product to each user according to the user product score matrix.
In the embodiment, the portrait information of the user is integrated on the basis of collaborative filtering based on the basic information of the user and the basic information of the product, so that the accuracy of product recommendation is improved.
Referring to fig. 6, another embodiment of a collaborative filtering-based product recommendation apparatus according to an embodiment of the present invention includes:
A data obtaining module 501, configured to receive a product recommendation request sent by a terminal, and obtain raw data and a plurality of pieces of portrait data according to the product recommendation request, where the raw data includes a user number of a plurality of users, a product number of a plurality of products, and a preference value of each user for each product, and each piece of portrait data is used to represent user portrait information of each user and product portrait information corresponding to a historical purchase product of each user;
a scoring matrix construction module 502, configured to construct a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference value of each user for each product;
A first matrix calculating module 503, configured to calculate a user similarity matrix based on the user numbers of the plurality of users and the preference value of each of the users for each of the products, and calculate a product similarity matrix based on the product numbers of the plurality of products and the preference value of each of the users for each of the products;
A second matrix calculation module 504, configured to calculate an image similarity matrix based on the plurality of pieces of image data, where the image similarity matrix is used to represent a similarity between each piece of image data;
The filtering matrix calculating module 505 is configured to calculate the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculate the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
the product recommendation module 506 is configured to calculate a user product score matrix based on the user product score matrix, the user-based collaborative filtering matrix, and a product-based collaborative filtering matrix, and recommend a product to each user according to the user product score matrix.
The scoring matrix construction module 502 specifically includes:
an initialization unit 5021, configured to construct a blank matrix with a size of N rows by M columns based on the number N of the user numbers and the number M of the product numbers;
The ordering unit 5022 is configured to order the user number and the product number according to the numerical values of the numbers, and generate a user number sequence and a product number sequence respectively;
An association unit 5023, configured to establish a row mapping relationship between the user number sequence and the blank matrix, and establish a column mapping relationship between the product number sequence and the blank matrix;
And a filling unit 5024, configured to fill the preference value of each user for each product to a corresponding position in the blank matrix according to the row mapping relationship and the column mapping relationship, so as to obtain a user product scoring matrix.
The first matrix calculation module 503 specifically includes:
an average value calculating unit 5031 for calculating an average preference value of the users according to the number of the user numbers and the preference value of each user for each product, and calculating an average preference value of the products according to the number of the product numbers and the preference value of each user for each product;
a similarity calculating unit 5032, configured to calculate, based on a pearson correlation coefficient algorithm, an average preference value of the users and a preference value of each user for each product, to obtain a user similarity between each user, and calculate, based on an average preference value of each product and a preference value of each user for each product, to obtain a product similarity between each product;
A matrix generation unit 5033 configured to generate a user similarity matrix based on the user numbers of the plurality of users and the user similarity between each of the users, and generate a product similarity matrix based on the product numbers of the plurality of products and the product similarity between each of the financial products.
The second matrix calculation module 504 specifically includes:
a feature extraction unit 5041, configured to perform feature extraction on the plurality of pieces of image data to obtain a plurality of image feature vectors;
a similarity calculation unit 5042 for calculating the image similarity between each image data based on the plurality of image feature vectors and a predetermined similarity calculation function, and generating an image similarity matrix based on the image similarity between each image data.
The product recommendation module 506 specifically includes:
the scoring matrix calculating unit 5061 is configured to perform product operation on the user product scoring matrix and the user-based collaborative filtering matrix and the product-based collaborative filtering matrix respectively to obtain a first user product scoring matrix and a second user product scoring matrix;
The product recommending unit 5062 is configured to weight and sum the first user product score matrix and the second user product score matrix based on the preset weight of the first user product score matrix and the preset weight of the second user product score matrix, obtain a user product score matrix, and recommend products to each user according to the user product score matrix.
In the embodiment of the invention, the modularized design enables the hardware of each part of the collaborative filtering-based product recommendation device to concentrate on the realization of a certain function, the performance of the hardware is maximally realized, and meanwhile, the modularized design also reduces the coupling between the modules of the device, so that the device is more convenient to maintain.
The collaborative filtering-based product recommendation device in the embodiment of the present invention is described in detail above in terms of modularized functional entities in fig. 5 and 6, and the collaborative filtering-based product recommendation device in the embodiment of the present invention is described in detail below in terms of hardware processing.
Fig. 7 is a schematic structural diagram of a collaborative filtering-based product recommendation device according to an embodiment of the present invention, where the collaborative filtering-based product recommendation device 700 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 710 (e.g., one or more processors) and a memory 720, and one or more storage mediums 730 (e.g., one or more mass storage devices) storing application programs 733 or data 732. Wherein memory 720 and storage medium 730 may be transitory or persistent. The program stored on the storage medium 730 may include one or more modules (not shown), each of which may include a series of instruction operations on the collaborative filtering-based product recommendation device 700. Still further, the processor 710 may be configured to communicate with the storage medium 730 to execute a series of instruction operations in the storage medium 730 on the collaborative filtering-based product recommendation device 700.
The collaborative filtering-based product recommendation device 700 may also include one or more power supplies 740, one or more wired or wireless network interfaces 750, one or more input/output interfaces 760, and/or one or more operating systems 731, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the collaborative filtering-based product recommendation device structure illustrated in FIG. 7 is not limiting of the collaborative filtering-based product recommendation device and may include more or fewer components than illustrated, or may combine certain components, or a different arrangement of components.
The invention also provides a collaborative filtering-based product recommendation device, which comprises a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the collaborative filtering-based product recommendation method in the above embodiments.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, and may also be a volatile computer readable storage medium, in which instructions are stored which, when executed on a computer, cause the computer to perform the steps of the collaborative filtering-based product recommendation method.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. The collaborative filtering-based product recommendation method is characterized by comprising the following steps of:
Receiving a product recommendation request sent by a terminal, and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each piece of portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
Constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products and the preference value of each user for each product;
Calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product;
calculating an image similarity matrix based on the plurality of pieces of image data, wherein the image similarity matrix is used for representing the similarity between each piece of image data;
Calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
calculating a user product scoring matrix based on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix, and recommending products to each user according to the user product scoring matrix;
the constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference value of each user for each product comprises:
based on the number N of the user numbers and the number M of the product numbers, constructing a blank matrix with the size of N rows by M columns;
Sorting the user numbers and the product numbers according to the numerical values of the numbers, and generating a user number sequence and a product number sequence respectively;
Establishing a row mapping relation between the user number sequence and the blank matrix, and establishing a column mapping relation between the product number sequence and the blank matrix;
filling preference values of each user for each product to corresponding positions in the blank matrix according to the row mapping relation and the column mapping relation to obtain a user product scoring matrix;
The calculating a user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating a product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product, comprising:
Calculating an average preference value of the users according to the number of the user numbers and the preference value of each user for each product, and calculating an average preference value of the products according to the number of the product numbers and the preference value of each user for each product;
Calculating the average preference value of the users and the preference value of each user for each product based on a Person correlation coefficient algorithm to obtain the similarity of the users between any two users, and calculating the average preference value of the products and the preference value of each user for each product to obtain the similarity of the products between any two products;
Generating a user similarity matrix based on the user numbers of the plurality of users and the user similarity between any two users, and generating a product similarity matrix based on the product numbers of the plurality of products and the product similarity between any two products;
After calculating the user similarity matrix based on the user numbers of the plurality of users and the preference value of each user for each product, and calculating the product similarity matrix based on the product numbers of the plurality of products and the preference value of each user for each product, after calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule, obtaining a collaborative filtering matrix based on the user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule, before obtaining a collaborative filtering matrix based on the product, further comprising:
Clustering the users and the products respectively, and calculating a first time attenuation coefficient of the user on the product clustering and a second time attenuation coefficient of the learning user clustering on the product;
Sequentially calculating a first time attenuation variable corresponding to the first time attenuation coefficient and a second time attenuation variable corresponding to the second time attenuation coefficient based on a preset time attenuation function;
Performing product operation on the first time attenuation variable and the user similarity matrix to obtain a user similarity matrix which changes along with time attenuation;
And carrying out product operation on the second time attenuation variable and the product similarity matrix to obtain a product similarity matrix which changes along with time attenuation.
2. The collaborative filtering-based product recommendation method according to claim 1, wherein after constructing a user product scoring matrix based on the user numbers of the plurality of users, the product numbers of the plurality of products, and the preference values of each of the users for each of the products, calculating a user product scoring matrix based on the user product scoring matrix, the user-based collaborative filtering matrix, and a product-based collaborative filtering matrix, and recommending products to each of the users according to the user product scoring matrix, further comprising:
decomposing the scoring matrix of the user product based on an optimized singular value decomposition algorithm to obtain a first hidden factor matrix related to the user and a second hidden factor matrix related to the product;
according to a random gradient descent algorithm and a preset optimal target parameter, iteratively updating the first hidden factor matrix and the second hidden factor matrix to obtain a target first hidden factor matrix and a target second hidden factor matrix;
multiplying the target first hidden factor matrix with the target second hidden factor matrix to obtain a full-rank user product scoring matrix.
3. The collaborative filtering-based product recommendation method of claim 1, wherein the computing an image similarity matrix based on the plurality of pieces of image data comprises:
extracting the characteristics of the plurality of pieces of image data to obtain a plurality of image characteristic vectors;
and calculating the image similarity between each image data based on the plurality of image feature vectors and a preset similarity calculation function, and generating an image similarity matrix according to the image similarity between each image data.
4. A collaborative filtering-based product recommendation method according to any one of claims 1-3, wherein said computing a user product scoring matrix based on said user product scoring matrix, said user-based collaborative filtering matrix, and a product-based collaborative filtering matrix, and recommending products to each of said users based on said user product scoring matrix comprises:
performing product operation on the user product scoring matrix and the user-based collaborative filtering matrix and the product-based collaborative filtering matrix respectively to obtain a first user product scoring matrix and a second user product scoring matrix;
And carrying out weighted summation on the first user product scoring matrix and the second user product scoring matrix based on the preset weight of the first user product scoring matrix and the preset weight of the second user product scoring matrix to obtain a user product scoring matrix, and recommending products to each user according to the user product scoring matrix.
5. A collaborative filtering-based product recommendation device, comprising:
The data acquisition module is used for receiving a product recommendation request sent by a terminal and acquiring original data and a plurality of pieces of portrait data according to the product recommendation request, wherein the original data comprises user numbers of a plurality of users, product numbers of a plurality of products and preference values of each user for each product, and each portrait data is used for representing user portrait information of each user and product portrait information corresponding to historical purchase products of each user;
The scoring matrix construction module is used for constructing a scoring matrix of user products based on the user numbers of the users, the product numbers of the products and the preference value of each user for each product;
A first matrix calculation module, configured to calculate a user similarity matrix based on user numbers of the plurality of users and preference values of each user for each product, and calculate a product similarity matrix based on product numbers of the plurality of products and preference values of each user for each product;
A second matrix calculation module, configured to calculate an image similarity matrix based on the plurality of pieces of image data, where the image similarity matrix is used to represent a similarity between each piece of image data;
The filtering matrix calculation module is used for calculating the user similarity matrix and the image similarity matrix according to a preset first calculation rule to obtain a collaborative filtering matrix based on a user, and calculating the product similarity matrix and the image similarity matrix according to a preset second calculation rule to obtain a collaborative filtering matrix based on a product;
the product recommendation module is used for calculating a user product scoring matrix based on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix and recommending products to each user according to the user product scoring matrix;
the scoring matrix construction module specifically comprises:
An initializing unit, configured to construct a blank matrix with a size of N rows by M columns based on the number N of the user numbers and the number M of the product numbers;
The ordering unit is used for respectively ordering the user numbers and the product numbers according to the numerical values of the numbers to generate a user number sequence and a product number sequence;
The association unit is used for establishing a row mapping relation between the user number sequence and the blank matrix and a column mapping relation between the product number sequence and the blank matrix;
the filling unit is used for filling the preference value of each user for each product to the corresponding position in the blank matrix according to the row mapping relation and the column mapping relation to obtain a user product scoring matrix;
The first matrix calculation module specifically includes:
an average value calculating unit, configured to calculate an average preference value of a user according to the number of the user numbers and a preference value of each user for each product, and calculate an average preference value of a product according to the number of the product numbers and a preference value of each user for each product;
The similarity calculation unit is used for calculating the average preference value of the users and the preference value of each user for each product based on a Person correlation coefficient algorithm to obtain the similarity of the users between any two users, and calculating the average preference value of the products and the preference value of each user for each product to obtain the similarity of the products between any two products;
A matrix generating unit, configured to generate a user similarity matrix based on the user numbers of the multiple users and the user similarity between any two users, and generate a product similarity matrix based on the product numbers of the multiple products and the product similarity between any two products;
The attenuation coefficient calculation unit is used for respectively clustering the user and the product, and calculating a first time attenuation coefficient of the user for clustering the product and a second time attenuation coefficient of the learning user for clustering the product;
The attenuation variable calculation unit is used for sequentially calculating a first time attenuation variable corresponding to the first time attenuation coefficient and a second time attenuation variable corresponding to the second time attenuation coefficient based on a preset time attenuation function;
the first matrix updating unit is used for carrying out product operation on the first time attenuation variable and the user similarity matrix to obtain a user similarity matrix which changes along with time attenuation;
and the second matrix updating unit is used for carrying out product operation on the second time attenuation variable and the product similarity matrix to obtain the product similarity matrix which changes along with time attenuation.
6. The collaborative filtering-based product recommendation apparatus of claim 5, wherein the scoring matrix construction module further comprises:
The decomposition unit is used for decomposing the scoring matrix of the user product based on an optimized singular value decomposition algorithm to obtain a first hidden factor matrix related to the user and a second hidden factor matrix related to the product;
the updating unit is used for carrying out iterative updating on the first hidden factor matrix and the second hidden factor matrix according to a random gradient descent algorithm and a preset optimal target parameter to obtain a target first hidden factor matrix and a target second hidden factor matrix;
And the product unit is used for multiplying the target first implicit factor matrix with the target second implicit factor matrix to obtain a full-rank user product scoring matrix.
7. The collaborative filtering-based product recommendation apparatus of claim 5, wherein the second matrix computing module specifically comprises:
The feature extraction unit is used for extracting features of the plurality of pieces of image data to obtain a plurality of image feature vectors;
And the similarity calculation unit is used for calculating the image similarity between each image data based on the plurality of image feature vectors and a preset similarity calculation function and generating an image similarity matrix according to the image similarity between each image data.
8. The collaborative filtering-based product recommendation device of any one of claims 5-7, wherein the product recommendation module specifically comprises:
The scoring matrix calculation unit is used for carrying out product operation on the user product scoring matrix, the user-based collaborative filtering matrix and the product-based collaborative filtering matrix respectively to obtain a first user product scoring matrix and a second user product scoring matrix;
and the product recommending unit is used for carrying out weighted summation on the first user product scoring matrix and the second user product scoring matrix based on the preset weight of the first user product scoring matrix and the preset weight of the second user product scoring matrix to obtain a user product scoring matrix, and recommending products to each user according to the user product scoring matrix.
9. A collaborative filtering-based product recommendation device, the collaborative filtering-based product recommendation device comprising: a memory and at least one processor, the memory having instructions stored therein;
The at least one processor invoking the instructions in the memory to cause the collaborative filtering-based product recommendation device to perform the collaborative filtering-based product recommendation method of any one of claims 1-4.
10. A computer readable storage medium having instructions stored thereon, which when executed by a processor, implement the collaborative filtering based product recommendation method of any one of claims 1-4.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111524011.6A CN114168862B (en) | 2021-12-14 | 2021-12-14 | Collaborative filtering-based product recommendation method, device, equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111524011.6A CN114168862B (en) | 2021-12-14 | 2021-12-14 | Collaborative filtering-based product recommendation method, device, equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114168862A CN114168862A (en) | 2022-03-11 |
| CN114168862B true CN114168862B (en) | 2024-07-19 |
Family
ID=80486188
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111524011.6A Active CN114168862B (en) | 2021-12-14 | 2021-12-14 | Collaborative filtering-based product recommendation method, device, equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114168862B (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115731000B (en) * | 2022-11-28 | 2025-08-26 | 中国建设银行股份有限公司 | Product recommendation method and device, electronic device, and storage medium |
| CN116402565B (en) * | 2023-02-01 | 2023-10-27 | 苏州极易科技股份有限公司 | Commodity recommendation method and system based on big data analysis |
| CN118657601A (en) * | 2024-05-24 | 2024-09-17 | 安徽省征信股份有限公司 | Financial service method of financial service code for realizing financial aggregation through multi-channel collaboration |
| CN119379391B (en) * | 2024-10-22 | 2025-04-08 | 广州盈风网络科技有限公司 | A sensor-based product recommendation method, system, device and medium |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103345698A (en) * | 2013-07-09 | 2013-10-09 | 焦点科技股份有限公司 | Personalized recommendation method based on cloud processing mode and applied in e-business environment |
| CN110427567A (en) * | 2019-07-24 | 2019-11-08 | 东北大学 | A kind of collaborative filtering recommending method based on user preference Similarity-Weighted |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105824912A (en) * | 2016-03-15 | 2016-08-03 | 平安科技(深圳)有限公司 | Personalized recommending method and device based on user portrait |
| CN106228386B (en) * | 2016-07-12 | 2018-09-25 | 腾讯科技(深圳)有限公司 | A kind of information-pushing method and device |
-
2021
- 2021-12-14 CN CN202111524011.6A patent/CN114168862B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103345698A (en) * | 2013-07-09 | 2013-10-09 | 焦点科技股份有限公司 | Personalized recommendation method based on cloud processing mode and applied in e-business environment |
| CN110427567A (en) * | 2019-07-24 | 2019-11-08 | 东北大学 | A kind of collaborative filtering recommending method based on user preference Similarity-Weighted |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114168862A (en) | 2022-03-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN114168862B (en) | Collaborative filtering-based product recommendation method, device, equipment and storage medium | |
| Bergmann et al. | Iterative signature algorithm for the analysis of large-scale gene expression data | |
| US8131732B2 (en) | Recommender system with fast matrix factorization using infinite dimensions | |
| CN113822776B (en) | Course recommendation method, device, equipment and storage medium | |
| Banerjee et al. | Multi-way clustering on relation graphs | |
| CN109858518B (en) | Large data set clustering method based on MapReduce | |
| CN110598120A (en) | Behavior data based financing recommendation method, device and equipment | |
| CN116541607B (en) | Intelligent recommendation method based on commodity retrieval data analysis | |
| CN114175017B (en) | Model construction method, classification method, device, storage medium and electronic equipment | |
| CN110472659B (en) | Data processing method, device, computer readable storage medium and computer equipment | |
| CN111949789A (en) | Text classification method and text classification system | |
| KR20160066395A (en) | Method for analyzing data based on matrix factorization model and apparatus therefor | |
| CN111047406A (en) | Telecommunication package recommendation method, device, storage medium and equipment | |
| CN113869943A (en) | Article recommendation method, device, equipment and storage medium | |
| KR20190060600A (en) | Apparatus for supporting multi-dimensional data analysis through parallel processing and method for the same | |
| CN111737429A (en) | Training method, AI interview method and related equipment | |
| CN119295188A (en) | Member order processing method, device, equipment and storage medium | |
| CN115239429A (en) | Attribute information encoding method, device, equipment, medium and product | |
| Hidasi et al. | Enhancing matrix factorization through initialization for implicit feedback databases | |
| CN119004132A (en) | Object feature processing method and device, storage medium and electronic equipment | |
| CN117439901A (en) | Dynamic weighted directional network weight prediction method and device | |
| CN116935057A (en) | Target evaluation method, electronic device, and computer-readable storage medium | |
| CN111753992A (en) | Screening methods and screening systems | |
| CN116452282A (en) | Method and device for generating product marketing strategy and electronic equipment | |
| CN116738035A (en) | Recommendation rearrangement method based on window sliding |
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 |