# Research and Application of Film and Television Literature Recommendation Based on Secure Internet of Things and Machine Learning

Authors: Jieqiong Zhou; Zhenhua Wei; Bin Peng; Fangchun Chi
Journal: Mobile Information Systems
 (2021)

---

## Abstract

Film and television literature recommendation is an AI algorithm that recommends related content according to user preferences and records. The wide application in various APPs and websites provides users with great convenience. This article aims to study the Internet of Things and machine learning technology, combining deep learning, reinforcement learning, and recommendation algorithms, to achieve accurate recommendation of film and television literature. This paper proposes to use the ConvMF-KNN recommendation model to verify and analyze the four models of PMF, ConvM, ConvMF-word2vec, and ConvMF-KNN, respectively, on public datasets. Using the path information between vertices in bipartite graph and considering the degree of vertices, the similarity between items is calculated, and the neighbor item set of items is obtained. The experimental results show that the ConvMF-KNN model combined with the KNN idea effectively improves the recommendation accuracy. Compared with the accuracy of the PMF model on the MovieLens 100 k, MovieLens 1 M, and AIV datasets, the accuracy of the ConvMF model on the above three datasets is 5.26%, 6.31%, and 26.71%, respectively, an increase of 2.26%, 1.22%, and 7.96%. This model is of great significance.


---

## Body

## 1. Introduction

With the rapid growth of online film and television literature resources, how to quickly obtain effective information and the latest information from massive amounts of data and information, and how to improve the accuracy and quality of information retrieval to meet the needs of different users for information push, has become an urgent problem to be solved. The diversified information demand is the key to film and television literature recommendation. Generally, users can search for the information they need from massive network resources through information pulling and information pushing. Information pulling means that users actively search for the information resources they need on the Internet according to their own needs. A typical example is a search engine; information push refers to websites, software applications, and so on that push information resources needed by users according to user needs. China’s Internet of Things technology started at the same time as other countries in the world, and the Internet of Things industry has developed rapidly in a short time.With the continuous popularization of film and television software, the amount of information in film and television literature will maintain a rapid growth momentum for a period of time in the future, and the negative impact of information overload will also become more serious. Therefore, the research and application of film and television literature recommendation systems and recommendation algorithms based on the Internet of Things and machine learning have far-reaching significance in resource sharing and solving information overload.Compared with the research and application of film and television literature recommendation based on the Internet of Things (IoT) and machine learning, there are many researches on recommendation systems and recommendation algorithms in e-commerce. Therefore, Piao et al. proposed an entropy-based recommendation algorithm to solve the problem of starting the experiment. The results show that this algorithm has high accuracy and is suitable for use. However, the use of this method is more complicated, leading to errors in the results [1]. When implementing security in an IoT network, you will face some problems, such as heterogeneity within the system and the number of devices that need to be resolved. The classification algorithm includes neural network (NN) and support vector machine (SVM), which can be used to detect DoS attacks at the media access control layer. To this end, Canedo and Skjellum used machine learning in IoT gateways to help protect the system, and they studied the use of artificial neural networks (ANNs) in the gateways to detect anomalies in data sent from edge devices. This method can improve the security of the Internet of Things system [2].The innovation of this paper is as follows. (1) A collaborative filtering algorithm for eye-catching score prediction is proposed to solve the problem of system quality degradation caused by the increase in the number of users. (2) The ConvMF-KNN recommendation model is proposed to recommend film and television literature. Aiming at the influence of noise samples in support vector, this paper proposes a method to deal with noise by using vector criterion in each cluster.


## 2. Technology Related to Machine Learning and IoT Security

### 2.1. Machine Learning

The neural network and support vector machine training model is based on two variables: conflict rate and arrival rate [3, 4]. In the neural network, if the possibility of detecting a DoS attack is greater than the set threshold, it is considered that a DoS attack has occurred. The SVM classifies DoS attacks into two levels, low or high, and detects whether an attack has occurred in sequence from low to high [5]. As for the security issues of the Internet of Things, combined with machine learning, the security of the Internet of Things has been greatly improved, effectively reducing failures and preventing privacy leakage. Supervised learning is to infer a model with the ability to identify and judge the future from the labeled training data. Each sample contains an input object and an output object.


### 2.2. IoT Security

Internet of Things security technology includes several key technologies: network security; identity authorization; encryption; secure side channel attacks; security analysis and threat prediction; interface protection; delivery mechanism; and system development [6, 7]. The Internet of Things generally consists of three levels: perception layer, network layer, and application layer. As shown in the figure below, the sensing layer is located at the bottom layer, which contains various data collection terminals such as sensors, RFID readers, tags, and cameras [8]. The architecture of the Internet of Things is shown in Figure 1. In the movie recommendation algorithm, based on the collaborative filtering algorithm, this paper uses the idea of content filtering to filter out the movies that are different from users’ interests, so as to improve the collaborative filtering and improve the accuracy of movie recommendation.Figure 1
IoT architecture.After collecting various data, it is necessary to implement data classification through a classifier. Different classification algorithms have different accuracy, speed, robustness, etc. The characteristics of the classification algorithm determine the accuracy of the final recommendation. The following introduces three basic classification algorithms and comprehensively compares their performance.


#### 2.2.1. Decision Tree

Decision tree classification algorithm is based on instance samples to classify. It classifies unordered instance samples and infers from them the classification rules in the form of decision tree representation. Through a top-down recursive method, internal nodes (non-leaf nodes) compare attribute values one by one, complete the branch, and finally make a decision at the end of the decision tree (leaf node). The decision tree generation process is shown in Figure2.Figure 2
Schematic diagram of the decision tree generation process.


#### 2.2.2. Artificial Neural Network

Artificial neural network (ANN) can abstract, simplify, and simulate the structure and function of the human brain. Artificial neural networks can generally be divided into feedforward networks and feedback networks. In practical applications, the most widely used neural network is the feedforward network, and its network structure is shown in Figure3.Figure 3
Diagram of the decision tree network structure.Although such recommendations may arouse new interests of current users, it is obviously risky to put movies of movie types that users have never ordered in the top position. Therefore, what should be done is to retain but reduce their ranking in the recommendation list. Taking the three-layer BP neural network as an example, the number of neurons in each layer is indeterminate. Assuming that the number of neurons in the input layer, output layer, and hidden layer isn, m, and k respectively, we get(1)hihj=∑i=1nωihxij−bh,h=1,2,…,k,(2)hlhj=fhihjh=1,2,…,k,(3)yilj=∑h=1kωhlhlhj−bl,l=1,2,…,m,(4)yllj=fyiljl=1,2,…,m.By decentralizing and increasing transparency and credibility to protect users’ privacy and key information, it puts forward a new solution direction for solving the security of the Internet of Things. In the above formula,xij is the j-th input sample; in the hidden layer, hi is the input vector and hl is the output vector; in the output layer, yi is the input vector and yl is the output vector; and f∗ is the activation function. The learning and training is to make the error sum of squares reach the minimum, and the error function is(5)e=12∑l=1mdlj−yllj2.The formula for the global error is as follows:(6)E=12q∑l=1mdlj−yllj2.


#### 2.2.3. Support Vector Machine

Support vector machine (SVM) is the most commonly used classification algorithm in classification algorithms. It is developed based on the evolution of the optimal classification surface in the case of linear separability. The essence is to divide the points in the space into two categories.For the linearly separable case, it is necessary to find the classification hyperplaneH:(7)ωTx+b=0,yiωTx+b−1≥0.Then, theH hyperplane can separate the two types of sample points, and the distance formula from any point x to H is(8)d=ωTx+bω.


### 2.3. Recommendation Algorithm

The memory-based collaborative filtering algorithm has been proposed for a long time and has a long research history. The implementation steps of the algorithm are generally divided into two steps: the first step is to calculate the similarity between the target user and other users and the second step is to find the closest dataset of the target user according to the similarity and then use this dataset to predict the target user’s score for the scored item [9]. In addition, it can also calculate the similarity between the target item and other items [10]. The classification of recommended algorithms is shown in Figure 4.Figure 4
Recommended algorithm classification.Project-based collaborative filtering pays more attention to users’ existing hobbies. Generally, movies that are consistent with users’ historical preferences are recommended. The movie recommendation algorithm divides the process into three parts, namely, the feature extraction part, the Markov decision process modeling part, and the model training part. The detailed diagram of the movie recommendation algorithm is shown in Figure5.Figure 5
Schematic diagram of movie recommendation algorithm.The algorithm steps based on the memory algorithm are mainly divided into the following 3 steps.


#### 2.3.1. Building a User-Item Rating Matrix

Recommendation systems usually involve two user feedback mechanisms: one is that users rate items, and the system saves the rating information in a relational database. In thei × j matrix, there are m users and n items. The corresponding value in the matrix is the rating of user i on item j, and null means that there is no rating behavior. The other is to collect user behaviors, such as user likes and favorites. When constructing the user-item behavior matrix, this type of behavior is usually expressed in binary. In the i × j matrix, there are i users and j items, indicating whether user i has performed a certain behavior on item j; 0 indicates that the behavior has not occurred, and 1 indicates that the behavior has occurred.The matrix composed of ratings between users and items is shown in Table1, and the matrix composed of ratings between users and behaviors is shown in Table 2.Table 1
User-item rating matrix.
Item1Item2...ItemiUser1R11null...nullUser2nullR22...null...............UserjR11R11...RijTable 2
User-item behavior matrix.
Item1Item2...ItemiUser111...1User211...0...............Userj10...1


#### 2.3.2. Calculating the Similarity between Users and Items

It calculates similar items based on users’ interests and preferences. In a memory-based algorithm, it is necessary to calculate the similarity between users and items. Commonly used similarity calculation formulas include the Jaccard similarity coefficient [11], Pearson similarity [12], cosine similarity [13], and so on.Pearson Similarity. Euclidean distance is a commonly used method in mathematics to find the distance between two points. It can find the absolute distance between two vectors, and it is also a method of calculating similarity. The Euclidean distance is very commonly used in mathematics. The mathematical expression of the Euclidean distance between the vectors X and Y is as follows:(9)Euclidean distanceX,Y=X−Y.Cosine similarity is to calculate the cosine value of the angle between two vectors, which can be used to judge the similarity in the direction of the vectors. If the two vectors are perpendicular, the similarity is 0; conversely, if the two vectors are parallel, the similarity is 1. The mathematical form of the cosine similarity of two vectorsM and N is defined as follows:(10)cosθM,N=M⋅NMN.Pearson similarity is to calculate the relative distance between the two. The value range of Pearson similarity is [−1, +1], −1 means dissimilar, +1 means similar, and the range from −1 to +1 means similarity. The degree of dissimilarity or similarity between the two is as follows:(11)srm,n=∑u∈Umnrum−rm¯run−rn¯∑u∈Umnrum−rm¯2∑u∈Umnrun−rn¯2,where sr stands for similar, which represents the degree of similarity between items, rum and run represent user u’s ratings of items m and n, respectively, Umn represents users who have rated both items m and n, rm¯ represents the average score of users in Umn for item m, and rn¯ represents the average score of users in Umn for item n.Jaccard Coefficient. It is equal to the ratio of the number of intersections of the sample set to the number of unions and is used to measure the similarity of two sets. The calculation of this index is shown in formula (4).(12)sri,j=Ni∩NjNi∪Nj,where sri,j represents the similarity between user i and user j and N(i) and N(j), respectively, represent the number of items rated by user i and user j [14].Cosine Similarity. It judges similarity by calculating the cosine value of the angle between two vector dot product spaces, and its cosine value range is [−1, 1]. The key to cosine similarity is to look at the difference in vector direction, not the difference in length or distance [15]. The calculation of this index is shown in the following formula:(13)srm,n=∑u∈Umnrumrun∑u∈Umrum2∑u∈Unrun2.After calculating the similarity of the aforementioned scoring matrix or behavior matrix, the data are screened according to the similarity to find the nearest neighbor set of the target item or user. There are generally two methods for screening and generating the nearest neighbor set: one is the nearest neighbor classification algorithm [16] and the other is the threshold method [17]. In the nearest neighbor classification algorithm, the predicted data should be compared with the training samples to find the most similar K training samples, and the label that appears the most in these K training samples is used as the final prediction label. The commonly used algorithm is mainly the KNN algorithm.


#### 2.3.3. Generating Recommendation Results Based on the Nearest Neighbor Set

After generating the nearest neighbor set, we can predict the ratings of other unrated items and movies based on the target user’s ratings of items and movies, then select the top N movies with the highest predicted scores, and recommend them to the users. The prediction scoring formula is as follows:(14)Qux=∑y∈Nsrx,yrux∑y∈Nsrx,y,Qux=rx¯+∑y∈Nsrx,yrux−ry¯∑y∈Nsrx,y.


## 2.1. Machine Learning

The neural network and support vector machine training model is based on two variables: conflict rate and arrival rate [3, 4]. In the neural network, if the possibility of detecting a DoS attack is greater than the set threshold, it is considered that a DoS attack has occurred. The SVM classifies DoS attacks into two levels, low or high, and detects whether an attack has occurred in sequence from low to high [5]. As for the security issues of the Internet of Things, combined with machine learning, the security of the Internet of Things has been greatly improved, effectively reducing failures and preventing privacy leakage. Supervised learning is to infer a model with the ability to identify and judge the future from the labeled training data. Each sample contains an input object and an output object.


## 2.2. IoT Security

Internet of Things security technology includes several key technologies: network security; identity authorization; encryption; secure side channel attacks; security analysis and threat prediction; interface protection; delivery mechanism; and system development [6, 7]. The Internet of Things generally consists of three levels: perception layer, network layer, and application layer. As shown in the figure below, the sensing layer is located at the bottom layer, which contains various data collection terminals such as sensors, RFID readers, tags, and cameras [8]. The architecture of the Internet of Things is shown in Figure 1. In the movie recommendation algorithm, based on the collaborative filtering algorithm, this paper uses the idea of content filtering to filter out the movies that are different from users’ interests, so as to improve the collaborative filtering and improve the accuracy of movie recommendation.Figure 1
IoT architecture.After collecting various data, it is necessary to implement data classification through a classifier. Different classification algorithms have different accuracy, speed, robustness, etc. The characteristics of the classification algorithm determine the accuracy of the final recommendation. The following introduces three basic classification algorithms and comprehensively compares their performance.


### 2.2.1. Decision Tree

Decision tree classification algorithm is based on instance samples to classify. It classifies unordered instance samples and infers from them the classification rules in the form of decision tree representation. Through a top-down recursive method, internal nodes (non-leaf nodes) compare attribute values one by one, complete the branch, and finally make a decision at the end of the decision tree (leaf node). The decision tree generation process is shown in Figure2.Figure 2
Schematic diagram of the decision tree generation process.


### 2.2.2. Artificial Neural Network

Artificial neural network (ANN) can abstract, simplify, and simulate the structure and function of the human brain. Artificial neural networks can generally be divided into feedforward networks and feedback networks. In practical applications, the most widely used neural network is the feedforward network, and its network structure is shown in Figure3.Figure 3
Diagram of the decision tree network structure.Although such recommendations may arouse new interests of current users, it is obviously risky to put movies of movie types that users have never ordered in the top position. Therefore, what should be done is to retain but reduce their ranking in the recommendation list. Taking the three-layer BP neural network as an example, the number of neurons in each layer is indeterminate. Assuming that the number of neurons in the input layer, output layer, and hidden layer isn, m, and k respectively, we get(1)hihj=∑i=1nωihxij−bh,h=1,2,…,k,(2)hlhj=fhihjh=1,2,…,k,(3)yilj=∑h=1kωhlhlhj−bl,l=1,2,…,m,(4)yllj=fyiljl=1,2,…,m.By decentralizing and increasing transparency and credibility to protect users’ privacy and key information, it puts forward a new solution direction for solving the security of the Internet of Things. In the above formula,xij is the j-th input sample; in the hidden layer, hi is the input vector and hl is the output vector; in the output layer, yi is the input vector and yl is the output vector; and f∗ is the activation function. The learning and training is to make the error sum of squares reach the minimum, and the error function is(5)e=12∑l=1mdlj−yllj2.The formula for the global error is as follows:(6)E=12q∑l=1mdlj−yllj2.


### 2.2.3. Support Vector Machine

Support vector machine (SVM) is the most commonly used classification algorithm in classification algorithms. It is developed based on the evolution of the optimal classification surface in the case of linear separability. The essence is to divide the points in the space into two categories.For the linearly separable case, it is necessary to find the classification hyperplaneH:(7)ωTx+b=0,yiωTx+b−1≥0.Then, theH hyperplane can separate the two types of sample points, and the distance formula from any point x to H is(8)d=ωTx+bω.


## 2.2.1. Decision Tree

Decision tree classification algorithm is based on instance samples to classify. It classifies unordered instance samples and infers from them the classification rules in the form of decision tree representation. Through a top-down recursive method, internal nodes (non-leaf nodes) compare attribute values one by one, complete the branch, and finally make a decision at the end of the decision tree (leaf node). The decision tree generation process is shown in Figure2.Figure 2
Schematic diagram of the decision tree generation process.


## 2.2.2. Artificial Neural Network

Artificial neural network (ANN) can abstract, simplify, and simulate the structure and function of the human brain. Artificial neural networks can generally be divided into feedforward networks and feedback networks. In practical applications, the most widely used neural network is the feedforward network, and its network structure is shown in Figure3.Figure 3
Diagram of the decision tree network structure.Although such recommendations may arouse new interests of current users, it is obviously risky to put movies of movie types that users have never ordered in the top position. Therefore, what should be done is to retain but reduce their ranking in the recommendation list. Taking the three-layer BP neural network as an example, the number of neurons in each layer is indeterminate. Assuming that the number of neurons in the input layer, output layer, and hidden layer isn, m, and k respectively, we get(1)hihj=∑i=1nωihxij−bh,h=1,2,…,k,(2)hlhj=fhihjh=1,2,…,k,(3)yilj=∑h=1kωhlhlhj−bl,l=1,2,…,m,(4)yllj=fyiljl=1,2,…,m.By decentralizing and increasing transparency and credibility to protect users’ privacy and key information, it puts forward a new solution direction for solving the security of the Internet of Things. In the above formula,xij is the j-th input sample; in the hidden layer, hi is the input vector and hl is the output vector; in the output layer, yi is the input vector and yl is the output vector; and f∗ is the activation function. The learning and training is to make the error sum of squares reach the minimum, and the error function is(5)e=12∑l=1mdlj−yllj2.The formula for the global error is as follows:(6)E=12q∑l=1mdlj−yllj2.


## 2.2.3. Support Vector Machine

Support vector machine (SVM) is the most commonly used classification algorithm in classification algorithms. It is developed based on the evolution of the optimal classification surface in the case of linear separability. The essence is to divide the points in the space into two categories.For the linearly separable case, it is necessary to find the classification hyperplaneH:(7)ωTx+b=0,yiωTx+b−1≥0.Then, theH hyperplane can separate the two types of sample points, and the distance formula from any point x to H is(8)d=ωTx+bω.


## 2.3. Recommendation Algorithm

The memory-based collaborative filtering algorithm has been proposed for a long time and has a long research history. The implementation steps of the algorithm are generally divided into two steps: the first step is to calculate the similarity between the target user and other users and the second step is to find the closest dataset of the target user according to the similarity and then use this dataset to predict the target user’s score for the scored item [9]. In addition, it can also calculate the similarity between the target item and other items [10]. The classification of recommended algorithms is shown in Figure 4.Figure 4
Recommended algorithm classification.Project-based collaborative filtering pays more attention to users’ existing hobbies. Generally, movies that are consistent with users’ historical preferences are recommended. The movie recommendation algorithm divides the process into three parts, namely, the feature extraction part, the Markov decision process modeling part, and the model training part. The detailed diagram of the movie recommendation algorithm is shown in Figure5.Figure 5
Schematic diagram of movie recommendation algorithm.The algorithm steps based on the memory algorithm are mainly divided into the following 3 steps.


### 2.3.1. Building a User-Item Rating Matrix

Recommendation systems usually involve two user feedback mechanisms: one is that users rate items, and the system saves the rating information in a relational database. In thei × j matrix, there are m users and n items. The corresponding value in the matrix is the rating of user i on item j, and null means that there is no rating behavior. The other is to collect user behaviors, such as user likes and favorites. When constructing the user-item behavior matrix, this type of behavior is usually expressed in binary. In the i × j matrix, there are i users and j items, indicating whether user i has performed a certain behavior on item j; 0 indicates that the behavior has not occurred, and 1 indicates that the behavior has occurred.The matrix composed of ratings between users and items is shown in Table1, and the matrix composed of ratings between users and behaviors is shown in Table 2.Table 1
User-item rating matrix.
Item1Item2...ItemiUser1R11null...nullUser2nullR22...null...............UserjR11R11...RijTable 2
User-item behavior matrix.
Item1Item2...ItemiUser111...1User211...0...............Userj10...1


### 2.3.2. Calculating the Similarity between Users and Items

It calculates similar items based on users’ interests and preferences. In a memory-based algorithm, it is necessary to calculate the similarity between users and items. Commonly used similarity calculation formulas include the Jaccard similarity coefficient [11], Pearson similarity [12], cosine similarity [13], and so on.Pearson Similarity. Euclidean distance is a commonly used method in mathematics to find the distance between two points. It can find the absolute distance between two vectors, and it is also a method of calculating similarity. The Euclidean distance is very commonly used in mathematics. The mathematical expression of the Euclidean distance between the vectors X and Y is as follows:(9)Euclidean distanceX,Y=X−Y.Cosine similarity is to calculate the cosine value of the angle between two vectors, which can be used to judge the similarity in the direction of the vectors. If the two vectors are perpendicular, the similarity is 0; conversely, if the two vectors are parallel, the similarity is 1. The mathematical form of the cosine similarity of two vectorsM and N is defined as follows:(10)cosθM,N=M⋅NMN.Pearson similarity is to calculate the relative distance between the two. The value range of Pearson similarity is [−1, +1], −1 means dissimilar, +1 means similar, and the range from −1 to +1 means similarity. The degree of dissimilarity or similarity between the two is as follows:(11)srm,n=∑u∈Umnrum−rm¯run−rn¯∑u∈Umnrum−rm¯2∑u∈Umnrun−rn¯2,where sr stands for similar, which represents the degree of similarity between items, rum and run represent user u’s ratings of items m and n, respectively, Umn represents users who have rated both items m and n, rm¯ represents the average score of users in Umn for item m, and rn¯ represents the average score of users in Umn for item n.Jaccard Coefficient. It is equal to the ratio of the number of intersections of the sample set to the number of unions and is used to measure the similarity of two sets. The calculation of this index is shown in formula (4).(12)sri,j=Ni∩NjNi∪Nj,where sri,j represents the similarity between user i and user j and N(i) and N(j), respectively, represent the number of items rated by user i and user j [14].Cosine Similarity. It judges similarity by calculating the cosine value of the angle between two vector dot product spaces, and its cosine value range is [−1, 1]. The key to cosine similarity is to look at the difference in vector direction, not the difference in length or distance [15]. The calculation of this index is shown in the following formula:(13)srm,n=∑u∈Umnrumrun∑u∈Umrum2∑u∈Unrun2.After calculating the similarity of the aforementioned scoring matrix or behavior matrix, the data are screened according to the similarity to find the nearest neighbor set of the target item or user. There are generally two methods for screening and generating the nearest neighbor set: one is the nearest neighbor classification algorithm [16] and the other is the threshold method [17]. In the nearest neighbor classification algorithm, the predicted data should be compared with the training samples to find the most similar K training samples, and the label that appears the most in these K training samples is used as the final prediction label. The commonly used algorithm is mainly the KNN algorithm.


### 2.3.3. Generating Recommendation Results Based on the Nearest Neighbor Set

After generating the nearest neighbor set, we can predict the ratings of other unrated items and movies based on the target user’s ratings of items and movies, then select the top N movies with the highest predicted scores, and recommend them to the users. The prediction scoring formula is as follows:(14)Qux=∑y∈Nsrx,yrux∑y∈Nsrx,y,Qux=rx¯+∑y∈Nsrx,yrux−ry¯∑y∈Nsrx,y.


## 2.3.1. Building a User-Item Rating Matrix

Recommendation systems usually involve two user feedback mechanisms: one is that users rate items, and the system saves the rating information in a relational database. In thei × j matrix, there are m users and n items. The corresponding value in the matrix is the rating of user i on item j, and null means that there is no rating behavior. The other is to collect user behaviors, such as user likes and favorites. When constructing the user-item behavior matrix, this type of behavior is usually expressed in binary. In the i × j matrix, there are i users and j items, indicating whether user i has performed a certain behavior on item j; 0 indicates that the behavior has not occurred, and 1 indicates that the behavior has occurred.The matrix composed of ratings between users and items is shown in Table1, and the matrix composed of ratings between users and behaviors is shown in Table 2.Table 1
User-item rating matrix.
Item1Item2...ItemiUser1R11null...nullUser2nullR22...null...............UserjR11R11...RijTable 2
User-item behavior matrix.
Item1Item2...ItemiUser111...1User211...0...............Userj10...1


## 2.3.2. Calculating the Similarity between Users and Items

It calculates similar items based on users’ interests and preferences. In a memory-based algorithm, it is necessary to calculate the similarity between users and items. Commonly used similarity calculation formulas include the Jaccard similarity coefficient [11], Pearson similarity [12], cosine similarity [13], and so on.Pearson Similarity. Euclidean distance is a commonly used method in mathematics to find the distance between two points. It can find the absolute distance between two vectors, and it is also a method of calculating similarity. The Euclidean distance is very commonly used in mathematics. The mathematical expression of the Euclidean distance between the vectors X and Y is as follows:(9)Euclidean distanceX,Y=X−Y.Cosine similarity is to calculate the cosine value of the angle between two vectors, which can be used to judge the similarity in the direction of the vectors. If the two vectors are perpendicular, the similarity is 0; conversely, if the two vectors are parallel, the similarity is 1. The mathematical form of the cosine similarity of two vectorsM and N is defined as follows:(10)cosθM,N=M⋅NMN.Pearson similarity is to calculate the relative distance between the two. The value range of Pearson similarity is [−1, +1], −1 means dissimilar, +1 means similar, and the range from −1 to +1 means similarity. The degree of dissimilarity or similarity between the two is as follows:(11)srm,n=∑u∈Umnrum−rm¯run−rn¯∑u∈Umnrum−rm¯2∑u∈Umnrun−rn¯2,where sr stands for similar, which represents the degree of similarity between items, rum and run represent user u’s ratings of items m and n, respectively, Umn represents users who have rated both items m and n, rm¯ represents the average score of users in Umn for item m, and rn¯ represents the average score of users in Umn for item n.Jaccard Coefficient. It is equal to the ratio of the number of intersections of the sample set to the number of unions and is used to measure the similarity of two sets. The calculation of this index is shown in formula (4).(12)sri,j=Ni∩NjNi∪Nj,where sri,j represents the similarity between user i and user j and N(i) and N(j), respectively, represent the number of items rated by user i and user j [14].Cosine Similarity. It judges similarity by calculating the cosine value of the angle between two vector dot product spaces, and its cosine value range is [−1, 1]. The key to cosine similarity is to look at the difference in vector direction, not the difference in length or distance [15]. The calculation of this index is shown in the following formula:(13)srm,n=∑u∈Umnrumrun∑u∈Umrum2∑u∈Unrun2.After calculating the similarity of the aforementioned scoring matrix or behavior matrix, the data are screened according to the similarity to find the nearest neighbor set of the target item or user. There are generally two methods for screening and generating the nearest neighbor set: one is the nearest neighbor classification algorithm [16] and the other is the threshold method [17]. In the nearest neighbor classification algorithm, the predicted data should be compared with the training samples to find the most similar K training samples, and the label that appears the most in these K training samples is used as the final prediction label. The commonly used algorithm is mainly the KNN algorithm.


## 2.3.3. Generating Recommendation Results Based on the Nearest Neighbor Set

After generating the nearest neighbor set, we can predict the ratings of other unrated items and movies based on the target user’s ratings of items and movies, then select the top N movies with the highest predicted scores, and recommend them to the users. The prediction scoring formula is as follows:(14)Qux=∑y∈Nsrx,yrux∑y∈Nsrx,y,Qux=rx¯+∑y∈Nsrx,yrux−ry¯∑y∈Nsrx,y.


## 3. Experimental Design

### 3.1. Data Preprocessing

The film introduction information contains a large number of invalid information such as punctuation marks and spaces, which cannot be used as the input of the CNN structure. Therefore, it is necessary to preprocess the movie introduction information. First, remove the punctuation marks, spaces, prepositions, and other characters in the movie information. The maximum number of all words in each profile is max_length. If the length exceeds this length, it will be truncated directly, and only the words before max_length in the profile will be processed. Then, put all the words introduced in the movie into a listL, sort the words from high to low, and select the vocab_size words with the highest frequency and not exceed the threshold max_df to form the list Voc. Perform word vector transformation on the words in L. For words that appear in L but not in Voc, the average value of all word vectors in Voc is used for word vectorization. It simulates the processing method of biological neurons. When the signal reaches a certain condition after processing, it transmits the signal to the next layer.


### 3.2. CNN Model and Hyperparameters

The specific design of CNN network structure is shown in Figure6. Figure 6 details the design and specific configuration of each layer in the CNN network structure. This paper optimizes the recommendation system based on collaborative filtering to make the recommendation system more personalized and accurate.Figure 6
CNN structure’s specific design drawing.The convolution layer contains three convolution kernels with sizes of 300 ∗ 3, 300 ∗ 4, and 300 ∗ 5. The input of the convolutional layer is the output of the embedding layer. After each convolutional layer, there is a pooling layer, and the three pooling layers get output results of size 100, respectively. Connect these three pooling layers in parallel as the input of the fully connected layer 1. Each model has a corresponding hyperparameter, and each hyperparameter will have a different impact on the accuracy of the model. Especially in deep learning technology, parameter training and selection are extremely important and require a lot of time and energy.


### 3.3. ConvMF-Word2vec

The original data are randomly shuffled and then sliced, divided into training set, verification set, and test set according to 8 : 1 : 1. The training set is used to train the ConvMF-word2vec model, and the validation set is used to verify the results of the trained model. Finally, the performance of the ConvMF-word2vec model is tested on the test set to obtain the final RMSE. The Google Engine database training set is used as the initial embedding layer of CNN in the ConvMF-word2vec experimental process.


### 3.4. ConvMF-KNN

The original data are randomly shuffled and then sliced, divided into training set, verification set, and test set according to 8 : 1 : 1. Train the ConvMF-KNN model on the training set, verify the model obtained after training on the training set in the validation set, and finally judge the performance of the ConvMF-KNN model on the test set to get the final RMSE. In the ConvMF-KNN experiment process, KNN is used to correct each scoring item predicted by ConvMF.


## 3.1. Data Preprocessing

The film introduction information contains a large number of invalid information such as punctuation marks and spaces, which cannot be used as the input of the CNN structure. Therefore, it is necessary to preprocess the movie introduction information. First, remove the punctuation marks, spaces, prepositions, and other characters in the movie information. The maximum number of all words in each profile is max_length. If the length exceeds this length, it will be truncated directly, and only the words before max_length in the profile will be processed. Then, put all the words introduced in the movie into a listL, sort the words from high to low, and select the vocab_size words with the highest frequency and not exceed the threshold max_df to form the list Voc. Perform word vector transformation on the words in L. For words that appear in L but not in Voc, the average value of all word vectors in Voc is used for word vectorization. It simulates the processing method of biological neurons. When the signal reaches a certain condition after processing, it transmits the signal to the next layer.


## 3.2. CNN Model and Hyperparameters

The specific design of CNN network structure is shown in Figure6. Figure 6 details the design and specific configuration of each layer in the CNN network structure. This paper optimizes the recommendation system based on collaborative filtering to make the recommendation system more personalized and accurate.Figure 6
CNN structure’s specific design drawing.The convolution layer contains three convolution kernels with sizes of 300 ∗ 3, 300 ∗ 4, and 300 ∗ 5. The input of the convolutional layer is the output of the embedding layer. After each convolutional layer, there is a pooling layer, and the three pooling layers get output results of size 100, respectively. Connect these three pooling layers in parallel as the input of the fully connected layer 1. Each model has a corresponding hyperparameter, and each hyperparameter will have a different impact on the accuracy of the model. Especially in deep learning technology, parameter training and selection are extremely important and require a lot of time and energy.


## 3.3. ConvMF-Word2vec

The original data are randomly shuffled and then sliced, divided into training set, verification set, and test set according to 8 : 1 : 1. The training set is used to train the ConvMF-word2vec model, and the validation set is used to verify the results of the trained model. Finally, the performance of the ConvMF-word2vec model is tested on the test set to obtain the final RMSE. The Google Engine database training set is used as the initial embedding layer of CNN in the ConvMF-word2vec experimental process.


## 3.4. ConvMF-KNN

The original data are randomly shuffled and then sliced, divided into training set, verification set, and test set according to 8 : 1 : 1. Train the ConvMF-KNN model on the training set, verify the model obtained after training on the training set in the validation set, and finally judge the performance of the ConvMF-KNN model on the test set to get the final RMSE. In the ConvMF-KNN experiment process, KNN is used to correct each scoring item predicted by ConvMF.


## 4. Experimental Results and Analysis

### 4.1. Experimental Results and Analysis of ConvMF on MovieLens 100K

Under the premise of traditional passive intrusion detection system, the received signal strength of each node in the network is used to detect the intrusion signal. In order to optimize the ConvMF model, through grid search, on the MovieLines 100K dataset, when the learning rate = 0.00001, D = 50, = 100, =1, ConvMF at this time RMSE obtains the minimum value of 0.9258. The personalized movie recommendation system is usually active recommendation. Through the analysis of users’ information and behavior, it can mine users’ preferences and then recommend movies to users. Specifically, the impact of RMSE on MovieLens 100K is shown in Table3.Table 3
ConvMF vs. MovieLens 100K RMSE comparison.
αu = 1αu = 10αu = 100αu = 100αv = 11.27351.04020.95030.9293αv = 100.99490.95420.92650.9957αv = 1000.92580.92740.99451.2092αv = 10001.01931.17711.37231.9811Bold values represent the minimum value.


### 4.2. Experimental Results and Analysis of ConvMF-KNN on MovieLens 100K

On the dataset ml-100k, the recommended accuracy (RMSE) of ConvMF-KNN is affected by the value ofk. It can be seen from Figure 7 that when the value of k gradually increases from 10, the RMSE1 gradually decreases. When K = 100, the RMSE reaches the minimum value, and the recommended accuracy is the most accurate at this time. When the value of k is greater than 100, there is no significant change in RMSE1. From the dataset, we can calculate that the average number of movies rated by each user is about 100. Therefore, when K = 100, the recommendation accuracy is the most accurate, which means that the movies watched by each user have been fully considered. When K is greater than 100, RMSE1 obviously changes very little, as shown in Figure 7. Content-based recommendation algorithm mainly uses content filtering technology to filter out items similar to users’ interests in a large number of items, so as to recommend them to users.Figure 7
Experimental results of ConvMF-KNN on MovieLens 100K.


### 4.3. The Improved Model and the Experimental Results and Analysis of PMF and ConvMF on the Datasets MovieLens 100 K and MovieLens 1 M

The comparison of the experimental results of each model is shown in Table4.Table 4
Comparison of RMSE results of each model.
MovieLens 100 kMovieLens 1 MAIVPMF0.95220.89621.4253ConvMF0.92480.85131.1343ConvMF-word2vec0.92120.85621.1256ConvMF-KNN0.90380.84721.0427Explanation and analysis of Table4:(1)
The improved models ConvMF-word2vec and ConvMF-KNN have improved accuracy on the datasets MovieLens 100 k, MovieLens 1 M, and AIV, respectively.(2)
After ConvMF-word2vec uses the Google engine database pretraining vector set, the recommendation accuracy on the MovieLens 100 k and MovieLens 1 M data sets is slightly improved compared to ConvMF, but the effect is not obvious, only about 1%.(3)
The ConvMF-KNN model combined with the KNN idea has a greater impact on the recommended accuracy. The accuracy of the PMF model on the MovieLens 100k, MovieLens 1M, and AIV datasets has increased by 5.26%, 6.31%, and 26.71%, respectively. Compared with the ConvMF model, its accuracy has increased by 2.26%, 1.22%, and 7.96%, respectively.


## 4.1. Experimental Results and Analysis of ConvMF on MovieLens 100K

Under the premise of traditional passive intrusion detection system, the received signal strength of each node in the network is used to detect the intrusion signal. In order to optimize the ConvMF model, through grid search, on the MovieLines 100K dataset, when the learning rate = 0.00001, D = 50, = 100, =1, ConvMF at this time RMSE obtains the minimum value of 0.9258. The personalized movie recommendation system is usually active recommendation. Through the analysis of users’ information and behavior, it can mine users’ preferences and then recommend movies to users. Specifically, the impact of RMSE on MovieLens 100K is shown in Table3.Table 3
ConvMF vs. MovieLens 100K RMSE comparison.
αu = 1αu = 10αu = 100αu = 100αv = 11.27351.04020.95030.9293αv = 100.99490.95420.92650.9957αv = 1000.92580.92740.99451.2092αv = 10001.01931.17711.37231.9811Bold values represent the minimum value.


## 4.2. Experimental Results and Analysis of ConvMF-KNN on MovieLens 100K

On the dataset ml-100k, the recommended accuracy (RMSE) of ConvMF-KNN is affected by the value ofk. It can be seen from Figure 7 that when the value of k gradually increases from 10, the RMSE1 gradually decreases. When K = 100, the RMSE reaches the minimum value, and the recommended accuracy is the most accurate at this time. When the value of k is greater than 100, there is no significant change in RMSE1. From the dataset, we can calculate that the average number of movies rated by each user is about 100. Therefore, when K = 100, the recommendation accuracy is the most accurate, which means that the movies watched by each user have been fully considered. When K is greater than 100, RMSE1 obviously changes very little, as shown in Figure 7. Content-based recommendation algorithm mainly uses content filtering technology to filter out items similar to users’ interests in a large number of items, so as to recommend them to users.Figure 7
Experimental results of ConvMF-KNN on MovieLens 100K.


## 4.3. The Improved Model and the Experimental Results and Analysis of PMF and ConvMF on the Datasets MovieLens 100 K and MovieLens 1 M

The comparison of the experimental results of each model is shown in Table4.Table 4
Comparison of RMSE results of each model.
MovieLens 100 kMovieLens 1 MAIVPMF0.95220.89621.4253ConvMF0.92480.85131.1343ConvMF-word2vec0.92120.85621.1256ConvMF-KNN0.90380.84721.0427Explanation and analysis of Table4:(1)
The improved models ConvMF-word2vec and ConvMF-KNN have improved accuracy on the datasets MovieLens 100 k, MovieLens 1 M, and AIV, respectively.(2)
After ConvMF-word2vec uses the Google engine database pretraining vector set, the recommendation accuracy on the MovieLens 100 k and MovieLens 1 M data sets is slightly improved compared to ConvMF, but the effect is not obvious, only about 1%.(3)
The ConvMF-KNN model combined with the KNN idea has a greater impact on the recommended accuracy. The accuracy of the PMF model on the MovieLens 100k, MovieLens 1M, and AIV datasets has increased by 5.26%, 6.31%, and 26.71%, respectively. Compared with the ConvMF model, its accuracy has increased by 2.26%, 1.22%, and 7.96%, respectively.


## 5. Conclusions

The Internet of Things security technology, machine learning, and recommendation algorithms are developing rapidly, and the recommendation of film and television literature is becoming more and more popular. People generally start to look for movies and literature they like on the Internet. The film industry has been developing for many years, a large number of films already exist in the world, and a large number of new films will be released every year, and the phenomenon of film information overload will become more and more serious. In the face of massive amounts of videos, the application of recommendation algorithms to the film and video industry has improved the user experience. The classic collaborative filtering algorithm has played an irreplaceable role, but with the development of the times and the maturity of deep learning and other technologies, traditional recommendation algorithms are gradually combined with deep learning and other technologies, and a series of new algorithms are gradually produced. This article introduces common recommendation algorithms and focuses on the recommendation algorithm based on scoring matrix and the probability matrix factorization recommendation algorithm and a recommendation algorithm based on deep learning, ConvMF, combined with the idea of KNN to improve the ConvMF algorithm. A new algorithm, ConvMF-KNN, improves the recommendation accuracy of the dataset. The application of recommendation algorithms in film and television literature will become increasingly widespread.



---

*Source: 4066267-2021-10-15.xml*