Disclosure of Invention
To overcome the above-mentioned existing problems or to at least partially solve the above-mentioned problems, embodiments of the present invention provide a leisure agricultural tour recommendation method, system, electronic device, and storage medium.
According to a first aspect of the embodiments of the present invention, there is provided a travel recommendation method for leisure agriculture, including:
capturing relevant information of each sight spot from a tourism website, wherein the relevant information of the sight spots comprises comment information, rating information and sight spot text information of each user on the sight spots;
clustering the users according to the grading information of the users on the scenic spots to obtain user groups of various categories;
for the same user group, determining the scoring information of the user who does not score any scenic spot according to the known scoring information of the user in the user group on any scenic spot;
inputting the comment information, the score information and the text information of each sight spot of each user into a pre-trained deep cooperation neural network, and outputting a first rating of each sight spot;
and generating a first sight recommendation list according to the first rating of each sight.
On the basis of the technical scheme, the invention can be further improved.
Further, the clustering each user according to the rating information of each user for each sight spot to obtain the user group of each category includes:
analyzing the attention of each user to different scenic spots according to the grading information of each user to each scenic spot;
and clustering the users according to the attention of each user to different scenic spots.
Further, for the same user group, determining the scoring information of the users who do not score any scenic spot by the following method:
x=(x1+x2+....+xn)/n;
wherein n is the number of users giving scores to any scenic spot, x1,x2..xnAnd d, scoring each user for any attraction, wherein x is the score of the user who does not score any attraction.
Further, the deep cooperative neural network comprises a first neural network, a second neural network and a shared neural network, the first neural network and the second neural network are in parallel, and an output of the first neural network and an output of the second neural network are inputs of the shared neural network.
Further, the inputting the comment information, the score information and the text information of each sight spot of each user into the pre-trained deep cooperative neural network, and the outputting the first rating of each sight spot includes:
inputting comment information and scoring information of each user on each sight spot into the first neural network, and outputting user characteristics of each user;
inputting the scoring information and the sight spot text information of each sight spot of each user into the second neural network, and outputting the sight spot characteristics of each sight spot;
and inputting each user characteristic and each sight characteristic into the shared neural network, and outputting a first rating of each sight.
Further, the method also comprises the following steps:
acquiring a current position of a user and a weather condition of the current position of the user;
and adjusting the generated first scenic spot recommendation list according to the current position of the user and the weather condition to obtain an adjusted second scenic spot recommendation list.
Further, the adjusting the generated first sight spot recommendation list according to the current position of the user and the weather condition to obtain an adjusted second sight spot recommendation list includes:
according to the weather condition of the current position of the user, reducing or increasing a first preset value for the first rating of each scenic spot to obtain a second rating of each scenic spot;
according to the distance between the current position of the user and each sight spot in the first sight spot recommendation list, reducing or increasing a second preset value for the second rating of each sight spot to obtain a third rating of each sight spot;
and generating a second sight spot recommendation list according to the third rating of each sight spot.
According to a second aspect of the embodiments of the present invention, there is provided a travel recommendation system for leisure agriculture, including:
the system comprises a capturing module, a processing module and a display module, wherein the capturing module is used for capturing relevant information of each scenic spot from a tourism website, and the relevant information of the scenic spots comprises comment information, score information and scenic spot text information of each user on the scenic spot;
the clustering module is used for clustering the users according to the grading information of the users on the scenic spots to obtain user groups of various categories;
the determining module is used for determining the scoring information of the unscored users of any scenic spot according to the known scoring information of the users of any scenic spot in the user group for the same user group;
the output module is used for inputting the comment information, the score information and the text information of each scenic spot of each user into a pre-trained deep cooperative neural network and outputting a first rating of each scenic spot;
and the generating module is used for generating a first scenic spot recommendation list according to the first rating of each scenic spot.
According to a third aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor invokes the program instructions to perform the method for recommending a travel for a recreational agriculture provided in any one of the various possible implementations of the first aspect.
According to a fourth aspect of embodiments of the present invention, there is also provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method for recommending a leisure agricultural tour provided in any one of the various possible implementations of the first aspect.
The embodiment of the invention provides a leisure agriculture tourism recommendation method, a leisure agriculture tourism recommendation system, electronic equipment and a storage medium.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
In an embodiment of the present invention, a method for recommending leisure agriculture tourism is provided, and fig. 1 is a schematic overall flow chart of the method for recommending leisure agriculture tourism provided in the embodiment of the present invention, where the method includes:
capturing relevant information of each sight spot from a tourism website, wherein the relevant information of the sight spots comprises comment information, rating information and sight spot text information of each user on the sight spots;
clustering the users according to the grading information of the users on the scenic spots to obtain user groups of various categories;
for the same user group, determining the scoring information of the user who does not score any scenic spot according to the known scoring information of the user in the user group on any scenic spot;
inputting the comment information, the score information and the text information of each sight spot of each user into a pre-trained deep cooperation neural network, and outputting a first rating of each sight spot;
and generating a first sight recommendation list according to the first rating of each sight.
It can be appreciated that a crawler technology is utilized to crawl a plurality of travel website information, and leisure agricultural information published by agricultural rural areas is used as a supplement to establish an available leisure agricultural travel data set. In the embodiment of the invention, the related information of each sight spot captured from the tourism website comprises comment information, score information and sight spot text information of each user on the sight spot. Because not every user scores scenic spots, the captured data has sparsity, the users are clustered according to the interests of the users in all the scenic spots, and the scores of the user groups in the same category to all the scenic spots are roughly considered to be different. Therefore, after the users are clustered, for the same user group, the rating information of the users who have not rated any scenic spot is determined according to the known rating information of the users to any scenic spot in the user group, so that the rating information of each user to each scenic spot can be obtained. Finally, inputting the comment information, the score information and the text information of each sight spot of each user into a pre-trained deep cooperation neural network, and outputting a first rating of each sight spot; and generating a first sight recommendation list according to the first rating of each sight.
On the basis of the above embodiment, in the embodiment of the present invention, the clustering the users according to the rating information of each user for each scenic spot to obtain the user groups of each category includes:
analyzing the attention of each user to different scenic spots according to the grading information of each user to each scenic spot;
and clustering the users according to the attention of each user to different scenic spots.
It can be understood that when clustering is performed on users, the attention of each user to different scenic spots is analyzed according to the scoring information of each user to each scenic spot; and clustering the users according to the attention of each user to different scenic spots. For example, user A, user B, user C, and user D are all interested in sights 1, 2, 3, and 4, then user A, user B, user C, and user D may be grouped into one category. In the embodiment of the invention, a K-mean clustering algorithm is adopted to cluster each user.
On the basis of the above embodiment, in the embodiment of the present invention, for the same user group, the scoring information of the user who has not scored any scenic spot is determined in the following manner:
x=(x1+x2+....+xn)/n;
wherein n is the number of users giving scores to any scenic spot, x1,x2..xnAnd d, scoring each user for any attraction, wherein x is the score of the user who does not score any attraction.
It can be understood that, for the same user group, such as the user a, the user B, the user C, and the user D, for example, the user a, the user B, and the user C all give a score to a certain attraction, and the user D does not give a score to the attraction, the score of the user D to the attraction may be determined according to the scores of the user a, the user B, and the user C, for example, an average value of the scores of the user a, the user B, and the user C to the attraction is used as the score of the user D to the attraction. In the embodiment of the present invention, the score of each user for the scenic spots is set to 1, 2, 3, 4, and 5.
Referring to fig. 2, on the basis of the above embodiment, in the embodiment of the present invention, the deep cooperative neural network includes a first neural network, a second neural network, and a shared neural network, the first neural network and the second neural network are in parallel, and an output of the first neural network and an output of the second neural network are inputs of the shared neural network.
Referring to fig. 3, on the basis of the above embodiments, in the embodiment of the present invention, inputting the comment information, the score information, and the text information of each sight spot of each user into the depth cooperation neural network trained in advance, and outputting the first rating of each sight spot includes:
inputting comment information and scoring information of each user on each sight spot into the first neural network, and outputting user characteristics of each user;
inputting the scoring information and the sight spot text information of each sight spot of each user into the second neural network, and outputting the sight spot characteristics of each sight spot;
each user feature and each sight feature are input into a shared neural network, and a first rating of each sight is output.
It will be appreciated that embodiments of the present invention utilize a deep cooperative neural network to rank attractions accordingly, wherein the deep cooperative neural network comprises a first neural network (which may be referred to as a user network) and a second neural network (which may be referred to as a project network or an attraction network) in parallel and a shared neural network.
Specifically, a first neural network and a second neural network can be trained respectively by adopting a training sample set, then comment information and scoring information of each user on each scenic spot are input into the first neural network, and user characteristics of each user are output; and inputting the scoring information and the sight text information of each sight of each user into the second neural network, and outputting the sight characteristics of each sight. Finally, each user characteristic and each sight feature are input into the shared neural network, and a first rating of each sight is output.
In the embodiment of the invention, the comment information of each user for each sight spot is represented as word embedding, and the word vector matrix is created by using the word embedding. The user comment information and the scenery spot text information respectively represent word embedding matrixes, a first neural network and a second neural network which are trained in advance are input to capture semantic information in the comment text, and a user feature u and a scenery spot feature i are output respectively, but the user feature u and the scenery spot feature i can be in different feature spaces and have no comparability. In order to map them to the same feature space, a shared neural network is introduced on top of the first and second neural networks, combining the user network and the item network. And connecting u and i into a vector z (u, i). Modeling all nested variable interactions in z, applying a factorization machine algorithm (FM) as an estimator of the corresponding rank, generating a predicted rating for each sight, hereinafter referred to as the first rating.
On the basis of the above embodiments, the embodiments of the present invention further include:
acquiring a current position of a user and a weather condition of the current position of the user;
and adjusting the generated first scenic spot recommendation list according to the current position of the user and the weather condition to obtain an adjusted second scenic spot recommendation list.
Referring to fig. 4, on the basis of the foregoing embodiments, in the embodiments of the present invention, the adjusting the generated first sight spot recommendation list according to the current location of the user and the weather condition to obtain an adjusted second sight spot recommendation list includes:
according to the weather condition of the current position of the user, reducing or increasing a first preset value for the first rating of each scenic spot to obtain a second rating of each scenic spot;
according to the distance between the current position of the user and each sight spot in the first sight spot recommendation list, reducing or increasing a second preset value for the second rating of each sight spot to obtain a third rating of each sight spot;
and generating a second sight spot recommendation list according to the third rating of each sight spot.
It can be understood that, when recommending scenic spots for each user, the actual situation and weather situation of each user need to be considered, the HTML5 API is used to obtain the current user location, and the weather situation of the current user location is obtained by calling the weather API. Setting four grades of sunny, cloudy, rainy and snowy, and respectively carrying out +3, 0, -4 and-5 on the basis of the first grade of each scenic spot to form a second grade of each scenic spot. And by utilizing a Goodpastel API, setting the acquired current position of the user as a starting point, setting each sight spot in the previously generated first sight spot recommendation list as an end point, calculating the distance between the current position of the user and each sight spot, setting five levels of <30km, 30-60km, 60-90km, 90-120km and >120km, respectively forming a third rating of each sight spot on the basis of the second rating of each current sight spot, and sequentially sequencing all sight spots from high to low according to the third rating of each sight spot to generate a second sight spot recommendation list.
In another embodiment of the invention, a leisure agricultural tour recommendation system is provided for implementing the methods of the foregoing embodiments. Therefore, the descriptions and definitions in the embodiments of the leisure agriculture tour recommendation method can be used for understanding the execution modules in the embodiments of the present invention. Fig. 5 is a schematic diagram of the overall structure of the leisure agriculture tourism recommendation system provided by the embodiment of the present invention, and the system includes a grabbing module 51, a clustering module 52, a determining module 53, an output module 54, and a generating module 55.
The capturing module 51 is configured to capture relevant information of each scenic spot from a travel website, where the relevant information of the scenic spot includes comment information, score information, and scenic spot text information of each user about the scenic spot;
the clustering module 52 is configured to cluster the users according to the rating information of each user on each scenic spot, so as to obtain user groups of each category;
the determining module 53 is configured to determine, for the same user group, scoring information of a user who has not scored any attraction according to known scoring information of the user in the user group for any attraction;
the output module 54 is configured to input the comment information, the score information, and the text information of each sight spot of each user into a pre-trained deep cooperative neural network, and output a first rating of each sight spot;
and the generating module 55 is configured to generate a first sight spot recommendation list according to the first rating of each sight spot.
It can be understood that the leisure agricultural travel recommendation system provided by the embodiment of the present invention corresponds to the leisure travel recommendation methods provided by the embodiments, and the relevant technical features of the leisure agricultural travel recommendation system provided by the embodiment of the present invention can refer to the relevant technical features of the leisure travel recommendation methods provided by the embodiments, and are not described herein again.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: the system comprises a processor (processor)01, a communication Interface (Communications Interface)02, a memory (memory)03 and a communication bus 04, wherein the processor 01, the communication Interface 02 and the memory 03 complete mutual communication through the communication bus 04. Processor 01 may call logic instructions in memory 03 to perform the following method: capturing relevant information of each sight spot from a tourism website, wherein the relevant information of the sight spots comprises comment information, rating information and sight spot text information of each user on the sight spots; clustering the users according to the grading information of the users on the scenic spots to obtain user groups of various categories; for the same user group, determining the scoring information of the user who does not score any scenic spot according to the known scoring information of the user in the user group on any scenic spot; inputting the comment information, the score information and the text information of each sight spot of each user into a pre-trained deep cooperation neural network, and outputting a first rating of each sight spot; and generating a first sight recommendation list according to the first rating of each sight.
In addition, the logic instructions in the memory 03 can be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute 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 (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the methods provided by the above method embodiments, for example, including: capturing relevant information of each sight spot from a tourism website, wherein the relevant information of the sight spots comprises comment information, rating information and sight spot text information of each user on the sight spots; clustering the users according to the grading information of the users on the scenic spots to obtain user groups of various categories; for the same user group, determining the scoring information of the user who does not score any scenic spot according to the known scoring information of the user in the user group on any scenic spot; inputting the comment information, the score information and the text information of each sight spot of each user into a pre-trained deep cooperation neural network, and outputting a first rating of each sight spot; and generating a first sight recommendation list according to the first rating of each sight.
According to the leisure agriculture tourism recommendation method, the system, the electronic equipment and the storage medium, users are clustered through a clustering algorithm, the scores of the users who are not scored are determined according to the scores of the scored users, the problem of data sparsity is solved, a deep cooperative neural network model is used for predicting and rating each scenic spot, finally, the primarily determined rating of each scenic spot is adjusted by considering the distance between the current position of the user and each recommended scenic spot, a final recommendation list is determined by combining scene perception information, and the scenic spot personalized recommendation of different users is achieved.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.