import tensorflow as tf
import os
import tensorflow.keras.backend as K
import numpy as np
np.set_printoptions(threshold=np.inf)
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
# load sample as tf dataset
def get_dataset(file_path):
dataset = tf.data.experimental.make_csv_dataset(
file_path,
batch_size=2,
label_name='label',
na_value="0",
num_epochs=1,
ignore_errors=True)
return dataset
# split as test dataset and training dataset
train_dataset = get_dataset('/Users/admin/数据集/ml-20m/sampledata/trainingSamples/part-00000-ac6dc90d-fc7c-46e8-a728-6375ec6b010e-c000.csv')
test_dataset = get_dataset('/Users/admin/数据集/ml-20m/sampledata/testSamples/part-00000-5612acfa-2ff1-43f4-9379-2fab9eec9f25-c000.csv')
# genre features vocabulary
genre_vocab = ['Film-Noir', 'Action', 'Adventure', 'Horror', 'Romance', 'War', 'Comedy', 'Western', 'Documentary',
'Sci-Fi', 'Drama', 'Thriller', 'Crime', 'Fantasy', 'Animation', 'IMAX', 'Mystery', 'Children', 'Musical']
GENRE_FEATURES = {
'userGenre1': genre_vocab,
'userGenre2': genre_vocab,
'movieGenre1': genre_vocab,
'movieGenre2': genre_vocab,
}
# all categorical features
categorical_columns = []
for feature, vocab in GENRE_FEATURES.items():
cat_col = tf.feature_column.categorical_column_with_vocabulary_list(key=feature, vocabulary_list=vocab)
emb_col = tf.feature_column.embedding_column(cat_col, 2)
categorical_columns.append(emb_col)
# movie id embedding feature
movie_col = tf.feature_column.categorical_column_with_identity(key='movieId', num_buckets=122001)
movie_emb_col = tf.feature_column.embedding_column(movie_col, 2)
categorical_columns.append(movie_emb_col)
# user id embedding feature
user_col = tf.feature_column.categorical_column_with_identity(key='userId', num_buckets=330001)
user_emb_col = tf.feature_column.embedding_column(user_col, 2)
categorical_columns.append(user_emb_col)
# all numerical features
numerical_columns = [
tf.feature_column.numeric_column('movieRatingCount'),
tf.feature_column.numeric_column('movieAvgRating'),
tf.feature_column.numeric_column('movieRatingStddev'),
tf.feature_column.numeric_column('userRatingCount'),
tf.feature_column.numeric_column('userAvgRating'),
tf.feature_column.numeric_column('userRatingStddev')]
# cross feature between current movie and user historical movie
rated_movie = tf.feature_column.categorical_column_with_identity(key='userRatedMovie1', num_buckets=1001)
crossed_feature = tf.feature_column.indicator_column(tf.feature_column.crossed_column([movie_col, rated_movie], 100))#交叉结果维度
# define input for keras model
inputs = {
'movieAvgRating': tf.keras.layers.Input(name='movieAvgRating', shape=(), dtype='float32'),
'movieRatingStddev': tf.keras.layers.Input(name='movieRatingStddev', shape=(), dtype='float32'),
'movieRatingCount': tf.keras.layers.Input(name='movieRatingCount', shape=(), dtype='int32'),
'userAvgRating': tf.keras.layers.Input(name='userAvgRating', shape=(), dtype='float32'),
'userRatingStddev': tf.keras.layers.Input(name='userRatingStddev', shape=(), dtype='float32'),
'userRatingCount': tf.keras.layers.Input(name='userRatingCount', shape=(), dtype='int32'),
'movieId': tf.keras.layers.Input(name='movieId', shape=(), dtype='int32'),
'userId': tf.keras.layers.Input(name='userId', shape=(), dtype='int32'),
'userRatedMovie1': tf.keras.layers.Input(name='userRatedMovie1', shape=(), dtype='int32'),
'userGenre1': tf.keras.layers.Input(name='userGenre1', shape=(), dtype='string'),
'userGenre2': tf.keras.layers.Input(name='userGenre2', shape=(), dtype='string'),
'movieGenre1': tf.keras.layers.Input(name='movieGenre1', shape=(), dtype='string'),
'movieGenre2': tf.keras.layers.Input(name='movieGenre2', shape=(), dtype='string'),
}
# wide and deep 部分
all_inputs = K.print_tensor(inputs, message='wide和deep的全部输入') # 使用此方法打印变量,而不能使用tf.print。注意需要新建一个变量名
deep_input_tensor = tf.keras.layers.DenseFeatures(numerical_columns + categorical_columns)(all_inputs)
deep = K.print_tensor(deep_input_tensor, message='根据全部输入,生成的wide部分的tensor') # 使用此方法打印变量,而不能使用tf.print。注意需要新建一个变量名
deep = tf.keras.layers.Dense(128, activation='relu')(deep)
deep = tf.keras.layers.Dense(64, activation='relu')(deep)
# 交叉部分作为wide。
wide_input_tensor = tf.keras.layers.DenseFeatures(crossed_feature)(all_inputs)
wide = K.print_tensor(wide_input_tensor, message='根据全部输入,生成的deep部分的tensor') # 使用此方法打印变量,而不能使用tf.print。注意需要新建一个变量名
both = tf.keras.layers.concatenate([wide, deep]) #拼接
output_layer = tf.keras.layers.Dense(1, activation='sigmoid')(both)
model = tf.keras.Model(inputs, output_layer)
# compile the model, set loss function, optimizer and evaluation metrics
model.compile(loss='binary_crossentropy', optimizer='adam',
metrics=['accuracy', tf.keras.metrics.AUC(curve='ROC'), tf.keras.metrics.AUC(curve='PR')])
# train the model
model.fit(train_dataset, epochs=1)
# evaluate the model
test_loss, test_accuracy, test_roc_auc, test_pr_auc = model.evaluate(test_dataset)
print('\n\nTest Loss {}, Test Accuracy {}, Test ROC AUC {}, Test PR AUC {}'.format(test_loss, test_accuracy,test_roc_auc, test_pr_auc))
# print some predict results
predictions = model.predict(test_dataset)
for prediction, goodRating in zip(predictions[:12], list(test_dataset)[0][1][:12]):
print("Predicted good rating: {:.2%}".format(prediction[0]),
" | Actual rating label: ",("Good Rating" if bool(goodRating) else "Bad Rating"))
例如:某个batch的数据 feature_dict:
{
'movieAvgRating': [4.01 3.79],
?'movieGenre1': ["Action" "Comedy"],
?'movieGenre2': ["Adventure" "Drama"],
?'movieId': [1291 1784],
?'movieRatingCount': [31280 21684],
?'movieRatingStddev': [0.81 0.9],
?'userAvgRating': [3.59 4.12],
?'userGenre1': ["Comedy" "Drama"],
?'userGenre2': ["Thriller" "Thriller"],
?'userId': [56831 1372],
?'userRatedMovie1': [1777 36],
?'userRatingCount': [34 100],
?'userRatingStddev': [1.18 0.7]
?}
deep_input_tensor:
[[4.01 0.225543842 0.0391702354 -0.191415444 0.28910163 0.435190439 -0.626651287 31280 0.81 3.59 1.23838937 0.552055895 0.688286602 -0.775056899 0.573116541 0.501889 34 1.18]
?[3.79 -0.712801516 -0.455487877 -0.461724907 -0.0947912708 0.230520308 -0.368871033 21684 0.9 4.12 -0.309578866 -1.23044479 0.688286602 -0.775056899 -0.335008532 0.232901707 100 0.7]]
wide_input_tensor:
[[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0]
?[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0]]
总结: ①生成deep_input_tensor和wide_input_tensor所需要的特征,都放到feature_dict中。 ②deep_input_tensor用到了feature_dict中的userRatedMovie1以外的字段,wide_input_tensor用了movieId和userRatedMovie1两个特征。向量由movieId和userRatedMovie1交叉而来,可以理解成'当前用户最近看过这个电影'这个因素对预测结果的影响。 ③my_keras_tensor = tf.keras.layers.DenseFeatures(feautures_columns)(feature_dict)。my_keras_tensor类型是KerasTensor。feature_dict是一个有序的dict。 ④my_keras_tensor中向量的维度不是按照feautures_columns的顺序,而是按照feature_dict的key的顺序进行排列。 ⑤my_keras_tensor中向量的第1维度值(4.01),就是feature_dict中一个key(movieAvgRating)对应的第一个元素。 ⑥my_keras_tensor中向量的第2、3维度值,是movieGenre1的向量表达。即"Action"用一个二维向量[0.225543842 0.0391702354]来表达。同理movieGenre2、movieId。 ⑦输入向量长度为18,正好=movieAvgRating(1)+movieGenre1(2)+movieGenre2(2)+movieId(2)+movieRatingCount(1)+movieRatingStddev(1)+userAvgRating(1)+userGenre1(2)+ userGenre2(2)+userId(2)+userRatingCount(1)+userRatingStddev(1)。这里注意没有userRatedMovie1 ?
特征处理函数说明:
①tf.feature_column.embedding_column
作用:对稀疏特征进行Embedding
②tf.feature_column.categorical_column_with_identity
作用:把连续值进行one-hot升维转成类别特征。
示例:例如对于'movieId': [[0], [1], [1], [3], [4], [5], [6], [7]]
执行movie_col = tf.feature_column.categorical_column_with_identity(key='movieId', num_buckets=10),得到结果:
[[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.] #[0]
?[0. 1. 0. 0. 0. 0. 0. 0. 0. 0.] #[1]
?[0. 1. 0. 0. 0. 0. 0. 0. 0. 0.] #[1]
?[0. 0. 0. 1. 0. 0. 0. 0. 0. 0.] #[3]
?[0. 0. 0. 0. 1. 0. 0. 0. 0. 0.] #[4]
?[0. 0. 0. 0. 0. 1. 0. 0. 0. 0.] #[5]
?[0. 0. 0. 0. 0. 0. 1. 0. 0. 0.] #[6]
?[0. 0. 0. 0. 0. 0. 0. 1. 0. 0.]] #[7]
执行movie_col = tf.feature_column.categorical_column_with_identity(key='movieId', num_buckets=5),会报错。因为特征值范围必须在[0, num_buckets)中!说三遍!!
执行movie_col = tf.feature_column.categorical_column_with_identity(key='movieId', num_buckets=5,default_value=0),得到结果:
[[1. 0. 0. 0. 0.] #[0]
?[0. 1. 0. 0. 0.] #[1]
?[0. 1. 0. 0. 0.] #[1]
?[0. 0. 0. 1. 0.] #[3]
?[0. 0. 0. 0. 1.] #[4]
?[1. 0. 0. 0. 0.] #[5]超出bucket的,归为default_value,onehot值同default_value=0的情况
?[1. 0. 0. 0. 0.] #[6]
?[1. 0. 0. 0. 0.]] #[7]
③tf.feature_column.categorical_column_with_vocabulary_list
作用:按照词表对稀疏特征编码,适用于可穷举的特征。
示例:对于'sex': ['male','female','male'],
执行sex_column = tf.feature_column.categorical_column_with_vocabulary_list('sex', ['male', 'female'])得到:
[[1. 0.]
[0. 1.]
[1. 0.]]
④tf.feature_column.bucketized_column
作用:hash分桶,适用于高度稀疏的离散特征。
⑤tf.feature_column.crossed_column([sex, department], 10)
作用:对特征进行交叉。并进行分桶
说明:例如sex有两种类型,department有5种类型,交叉可以出现10种类型。当前我们也可以用过强制把桶设置为8,减小交叉后的维度,但是会增加hash冲突。
常用:
对稀疏特征进行hash分桶,然后Embedding:(很稀疏的离散特征)
department = tf.feature_column.categorical_column_with_hash_bucket('department', 10, dtype=tf.string)
columns = tf.feature_column.embedding_column(department, dimension=64)
对离散特征,按照此表下标进行编码(不稀疏的离散特征-部门名称)
sex_column = tf.feature_column.categorical_column_with_vocabulary_list('sex', ['male', 'female'])
sex_column = tf.feature_column.indicator_column(sex_column)
对连续特征升维,然后Embedding-(uid类型)
movie_col = tf.feature_column.categorical_column_with_identity(key='movieId', num_buckets=1001)
movie_emb_col = tf.feature_column.embedding_column(movie_col, 64)
对连续特征分段,然后Embedding-(salary类型)
tmp_numeric = tf.feature_column.embedding_column(tf.feature_column.bucketized_column(tf.feature_column.numeric_column(feat_col.name, dtype=tf.float32),boundaries=feat_col.boundary), dimension=feat_col.dimension)
注意:所有的Catogorical Column类型最终都要通过indicator_column转换成Dense Column类型才能传入模型!
tf2.0无法创建静态tensor,但是tf2.4+可以创建。
from tensorflow.keras.layers import Input, Layer
import tensorflow as tf
import numpy as np
const_np = np.random.rand(2,10,3)
const_tf = tf.convert_to_tensor(const_np, dtype=tf.float32)
const_k = tf.keras.Input(tensor=const_tf)
input_layer = keras.Input(shape=(4,)) keras.Input方法能创建KerasTensor对象。KerasTensor使用input_layer2 = K.print_tensor(input_layer, message='y_true = ')打印张量值。
inputs_2 = K.print_tensor(inputs, message='前前') 可以打印KerasTensor,也可以打印<str,KerasTensor>类型的dict。
KerasTensor打印的时候省略怎么办? 内部也是调用的print_v2。改源码,增加一个summarize=200参数。
参考资料:https://blog.csdn.net/pearl8899/article/details/107967302
参考代码:https://github.com/wzhe06/SparrowRecSys
测试数据集(直接作为train就能跑,全量数据集可以去SparrowRecSys生成):
movieId,userId,rating,timestamp,label,releaseYear,movieGenre1,movieGenre2,movieGenre3,movieRatingCount,movieAvgRating,movieRatingStddev,userRatedMovie1,userRatedMovie2,userRatedMovie3,userRatedMovie4,userRatedMovie5,userRatingCount,userAvgReleaseYear,userReleaseYearStddev,userAvgRating,userRatingStddev,userGenre1,userGenre2,userGenre3,userGenre4,userGenre5
1,102536,3.0,1178898678,0,"",Adventure,Animation,Children,49695,3.92,0.89,8961,2762,593,2858,4306,46,"","",3.52,0.91,Sci-Fi,Action,Adventure,Thriller,Drama
1,105705,4.5,1299686523,1,"",Adventure,Animation,Children,49695,3.92,0.89,260,593,480,296,2959,100,"","",3.52,0.85,Comedy,Action,Crime,Thriller,Adventure
1,111982,4.0,1203696431,1,"",Adventure,Animation,Children,49695,3.92,0.89,54503,7147,587,588,3114,100,"","",3.69,1.14,Comedy,Drama,Romance,Fantasy,Thriller
1,117280,3.5,1190687414,1,"",Adventure,Animation,Children,49695,3.92,0.89,8464,2908,1270,2291,37741,100,"","",3.78,0.59,Drama,Comedy,Thriller,Adventure,Crime
1,121197,5.0,953308503,1,"",Adventure,Animation,Children,49695,3.92,0.89,448,3418,36,589,2289,64,"","",4.20,0.95,Drama,Crime,Adventure,Comedy,Action
1,134851,4.0,951879291,1,"",Adventure,Animation,Children,49695,3.92,0.89,1702,2294,1359,1688,374,92,"","",3.58,0.94,Children,Adventure,Comedy,Fantasy,Drama
1,135343,3.5,1197174698,1,"",Adventure,Animation,Children,49695,3.92,0.89,780,1307,7143,919,41566,100,"","",3.88,0.82,Action,Adventure,Drama,Thriller,Sci-Fi
1,135901,5.0,859834335,1,"",Adventure,Animation,Children,49695,3.92,0.89,648,"","","","",3,"","",3.33,0.58,Action,Adventure,Mystery,Thriller,""
1,136202,3.0,1167755215,0,"",Adventure,Animation,Children,49695,3.92,0.89,589,1196,1210,5445,1580,27,"","",3.54,0.72,Action,Adventure,Sci-Fi,Thriller,Comedy
1,138305,3.5,1128490639,1,"",Adventure,Animation,Children,49695,3.92,0.89,3441,8675,5001,5060,1272,100,"","",2.75,1.10,Action,Drama,War,Sci-Fi,Comedy
1,17686,2.5,1195553727,0,"",Adventure,Animation,Children,49695,3.92,0.89,7438,7361,380,6377,318,41,"","",2.40,1.71,Comedy,Drama,Romance,Action,Adventure
1,18634,4.5,1140926165,1,"",Adventure,Animation,Children,49695,3.92,0.89,6639,4117,1303,37736,2313,84,"","",3.87,0.54,Drama,Comedy,Romance,Adventure,War
1,27108,3.0,865275011,0,"",Adventure,Animation,Children,49695,3.92,0.89,780,648,736,"","",6,"","",3.67,1.21,Action,Adventure,Thriller,Romance,Mystery
1,28426,4.0,1021740716,1,"",Adventure,Animation,Children,49695,3.92,0.89,3527,3702,2985,2001,3703,25,"","",4.28,0.79,Action,Thriller,Adventure,Sci-Fi,Drama
1,44032,4.0,1176224254,1,"",Adventure,Animation,Children,49695,3.92,0.89,2795,2013,2431,1256,2231,16,"","",3.59,0.78,Comedy,Drama,Sci-Fi,Action,Adventure
1,47919,5.0,1212176147,1,"",Adventure,Animation,Children,49695,3.92,0.89,589,590,150,592,457,66,"","",3.46,1.48,Drama,Crime,Comedy,Thriller,Action
1,61354,5.0,863104667,1,"",Adventure,Animation,Children,49695,3.92,0.89,141,736,"","","",4,"","",3.00,1.41,Action,Adventure,Romance,Thriller,Comedy
1,67525,5.0,947210582,1,"",Adventure,Animation,Children,49695,3.92,0.89,1036,1704,2352,1266,2791,100,"","",4.12,0.73,Drama,Comedy,Crime,Thriller,Romance
1,81093,4.0,954087671,1,"",Adventure,Animation,Children,49695,3.92,0.89,2396,34,1270,1197,1265,36,"","",3.81,0.79,Comedy,Drama,Adventure,Romance,Sci-Fi
10,103050,3.5,1231370079,1,"",Action,Adventure,Thriller,29005,3.43,0.86,27876,16,1208,55765,44199,95,"","",4.03,0.64,Thriller,Crime,Drama,Action,Adventure
10,11888,1.0,845674484,0,"",Action,Adventure,Thriller,29005,3.43,0.86,318,480,231,595,588,22,"","",3.36,1.14,Comedy,Thriller,Adventure,Crime,Drama
10,124057,4.0,828070731,1,"",Action,Adventure,Thriller,29005,3.43,0.86,1,17,"","","",5,"","",3.60,0.89,Drama,Romance,Adventure,Animation,Children
10,132466,3.0,938785557,0,"",Action,Adventure,Thriller,29005,3.43,0.86,592,2013,969,480,1304,63,"","",3.95,0.81,Action,Adventure,Drama,Sci-Fi,Thriller
10,136202,3.0,1167758179,0,"",Action,Adventure,Thriller,29005,3.43,0.86,2291,2,2797,2396,34,100,"","",3.08,0.69,Action,Drama,Comedy,Adventure,Crime
10,13865,3.0,846462002,0,"",Action,Adventure,Thriller,29005,3.43,0.86,318,292,356,457,165,13,"","",3.62,0.77,Thriller,Action,Drama,Comedy,Romance
10,23843,3.0,839630805,0,"",Action,Adventure,Thriller,29005,3.43,0.86,161,457,434,595,588,15,"","",3.67,1.11,Thriller,Drama,Adventure,Comedy,Animation
10,27248,3.0,962837542,0,"",Action,Adventure,Thriller,29005,3.43,0.86,733,1370,1092,47,280,100,"","",3.47,0.70,Drama,Thriller,Musical,Action,Mystery
10,3210,3.0,1119396450,0,"",Action,Adventure,Thriller,29005,3.43,0.86,8972,2045,4321,2006,1204,78,"","",4.08,0.63,Adventure,Action,Drama,Comedy,Sci-Fi
10,55445,4.0,837240160,1,"",Action,Adventure,Thriller,29005,3.43,0.86,161,457,593,292,318,18,"","",4.17,0.62,Thriller,Action,Adventure,Drama,Crime
10,59467,4.0,832051605,1,"",Action,Adventure,Thriller,29005,3.43,0.86,153,296,"","","",11,"","",3.18,0.75,Comedy,Crime,Drama,Thriller,Action
10,60070,4.0,848462654,1,"",Action,Adventure,Thriller,29005,3.43,0.86,185,110,480,292,434,14,"","",4.21,0.80,Thriller,Action,Comedy,Drama,Crime
10,63647,5.0,834671059,1,"",Action,Adventure,Thriller,29005,3.43,0.86,318,231,595,165,153,13,"","",4.08,0.76,Comedy,Crime,Thriller,Action,Adventure
10,7252,2.0,842958808,0,"",Action,Adventure,Thriller,29005,3.43,0.86,110,457,349,296,380,17,"","",3.35,0.93,Drama,Thriller,Action,Adventure,Comedy
10,89669,2.0,838462748,0,"",Action,Adventure,Thriller,29005,3.43,0.86,"","","","","",4,"","",3.00,0.00,"","","","",""
10,90878,4.0,1056834176,1,"",Action,Adventure,Thriller,29005,3.43,0.86,3763,4701,170,2023,5574,100,"","",3.50,0.91,Action,Thriller,Adventure,Drama,Crime
100,27248,3.0,962837560,0,"",Drama,Thriller,"",4115,3.22,0.80,587,733,1370,1092,47,100,"","",3.47,0.70,Drama,Thriller,Musical,Action,Mystery
100108,119655,2.5,1381093254,0,"",Crime,Thriller,"",147,3.05,0.87,104913,104841,103141,104241,103810,100,"","",3.32,0.79,Action,Drama,Thriller,Comedy,Crime
1003,23843,3.0,864044378,0,"",Drama,Thriller,"",1615,3.14,0.88,999,708,86,1049,62,100,"","",3.60,0.75,Drama,Comedy,Romance,Thriller,Action
1003,81824,3.0,847089721,0,"",Drama,Thriller,"",1615,3.14,0.88,1148,97,665,96,756,100,"","",2.88,0.83,Drama,Comedy,Crime,War,Adventure
100383,119655,4.5,1364433824,1,"",Crime,Drama,Mystery,564,3.64,0.71,97024,99149,97923,98961,99910,100,"","",3.31,0.84,Drama,Action,Thriller,Crime,Comedy
100498,119655,3.0,1363224394,0,"",Action,Crime,Thriller,322,2.60,0.98,97024,99149,97923,98961,99910,100,"","",3.31,0.85,Drama,Action,Thriller,Crime,Comedy
1005,20868,2.5,1285684630,0,"",Children,Comedy,"",2022,2.45,1.17,"","","","","",4,"","",2.62,0.48,"","","","",""
1009,47880,3.0,979316753,0,"",Adventure,Children,Fantasy,2604,3.14,0.95,616,1371,2877,3985,3066,71,"","",3.83,0.81,Drama,Comedy,Adventure,Action,Thriller
101,18574,4.0,1109448850,1,"",Adventure,Comedy,Crime,4298,3.79,0.89,6710,7199,31445,4888,778,100,"","",3.10,1.17,Drama,Comedy,Crime,Fantasy,Romance
101,57496,5.0,1153154211,1,"",Adventure,Comedy,Crime,4298,3.79,0.89,1032,1441,1678,1914,1921,79,"","",3.37,1.31,Comedy,Action,Adventure,Drama,Thriller
101142,56662,3.0,1385677332,0,"",Adventure,Animation,Comedy,264,3.41,0.88,103141,91485,1035,2949,3633,100,"","",3.29,0.86,Action,Adventure,Thriller,Drama,Comedy
1012,119675,3.0,953690874,0,"",Children,Drama,"",3427,3.56,0.98,1188,1234,1263,1678,29,100,"","",4.10,0.83,Drama,Comedy,Thriller,Crime,Romance
1012,23843,5.0,864046092,1,"",Children,Drama,"",3427,3.56,0.98,1266,914,111,1263,1213,100,"","",4.13,0.79,Drama,Action,Adventure,Comedy,Thriller
1012,45141,4.0,851626125,1,"",Children,Drama,"",3427,3.56,0.98,121,22,280,1086,490,78,"","",3.32,0.92,Drama,Thriller,Romance,Crime,Comedy
1012,86804,2.0,851450037,0,"",Children,Drama,"",3427,3.56,0.98,904,1197,1161,1081,912,100,"","",3.24,0.55,Drama,Thriller,Romance,Comedy,Crime
101285,66401,3.0,1366783001,0,"",Comedy,Crime,Drama,251,3.03,1.21,101864,101973,99741,101612,96488,100,"","",3.49,0.72,Drama,Thriller,Comedy,Action,Crime
101362,56662,3.0,1385677308,0,"",Action,Thriller,"",301,3.14,0.93,91485,1035,2949,3633,3635,100,"","",3.29,0.86,Action,Adventure,Thriller,Drama,Comedy
1015,117465,3.0,965357417,0,"",Adventure,Children,Drama,3501,3.26,0.99,2871,1259,145,2989,2993,100,"","",2.91,0.87,Drama,Romance,Thriller,Adventure,Crime
1015,128814,4.0,1373345606,1,"",Adventure,Children,Drama,3501,3.26,0.99,4084,934,3608,2366,2694,13,"","",3.12,0.85,Comedy,Action,Adventure,Animation,Children
101612,66401,3.5,1364968695,1,"",Comedy,Romance,"",111,2.83,0.82,96488,101525,101360,101112,100527,100,"","",3.49,0.73,Drama,Comedy,Thriller,Action,Crime
1017,127704,5.0,945863034,1,"",Adventure,Children,"",3254,3.51,0.90,2688,2706,1487,2084,7,100,"","",3.64,0.96,Comedy,Romance,Drama,Crime,Musical
1017,132159,5.0,1410139372,1,"",Adventure,Children,"",3254,3.51,0.90,2059,3477,6188,6297,47099,48,"","",3.72,0.95,Comedy,Drama,Romance,Action,Adventure
1017,56662,4.5,1265679891,1,"",Adventure,Children,"",3254,3.51,0.90,5218,5445,3959,5103,1097,100,"","",3.48,0.80,Action,Adventure,Drama,Thriller,Comedy
1019,135343,3.5,1377234218,1,"",Adventure,Drama,Sci-Fi,6215,3.55,0.87,5630,1250,4148,7619,55444,100,"","",3.43,0.71,Drama,Thriller,Action,Adventure,Comedy
1019,18333,4.0,945588017,1,"",Adventure,Drama,Sci-Fi,6215,3.55,0.87,2528,1573,2640,260,750,100,"","",3.34,0.98,Drama,Thriller,Romance,Sci-Fi,Crime
1019,50802,4.0,965331837,1,"",Adventure,Drama,Sci-Fi,6215,3.55,0.87,2021,3153,317,2161,2193,29,"","",3.45,0.99,Fantasy,Adventure,Drama,Children,Sci-Fi
101962,53380,5.0,1375344788,1,"",Animation,Fantasy,"",105,3.87,1.12,17,41889,6983,801,2422,18,"","",4.33,0.54,Adventure,Romance,Drama,Musical,Animation
102,127704,3.0,945249553,0,"",Comedy,"","",1992,2.43,1.05,1894,542,186,231,2052,100,"","",3.74,0.95,Comedy,Drama,Romance,Crime,Children
102,20219,2.0,867629954,0,"",Comedy,"","",1992,2.43,1.05,18,1393,1210,1356,104,83,"","",2.93,0.87,Action,Adventure,Thriller,Sci-Fi,Comedy
102,73463,1.0,1035576110,0,"",Comedy,"","",1992,2.43,1.05,1999,"","","","",100,"","",1.88,0.73,Horror,"","","",""
1020,123722,1.0,1372483536,0,"",Comedy,"","",6597,3.24,0.90,31,"","","","",4,"","",2.38,1.49,Drama,"","","",""
1020,21783,3.0,938850258,0,"",Comedy,"","",6597,3.24,0.90,1513,1517,500,1689,1711,43,"","",3.63,0.95,Comedy,Romance,Drama,Children,Fantasy
1020,28426,4.0,1021740866,1,"",Comedy,"","",6597,3.24,0.90,1580,2542,2671,587,1923,35,"","",4.37,0.77,Action,Comedy,Drama,Thriller,Adventure
1020,60081,4.0,864158221,1,"",Comedy,"","",6597,3.24,0.90,1129,927,1014,506,973,100,"","",3.58,0.68,Drama,Comedy,Romance,Action,Crime
1022,82971,3.0,1230425616,0,"",Animation,Children,Fantasy,8954,3.58,0.96,2080,26133,60487,6773,5618,40,"","",3.64,0.76,Animation,Drama,Children,Comedy,Fantasy
1023,64612,4.0,1115976171,1,"",Animation,Children,Musical,3234,3.76,1.07,2018,7942,1208,7303,6724,100,"","",3.38,0.89,Drama,Romance,Comedy,Thriller,Crime
1024,82297,3.0,861916118,0,"",Animation,Children,Musical,1085,3.18,1.00,407,373,912,327,969,100,"","",3.38,0.53,Drama,Comedy,Thriller,War,Romance
1027,108791,4.0,842787423,1,"",Adventure,Drama,"",7695,3.28,0.94,1023,7,1035,1028,1022,100,"","",3.79,0.80,Comedy,Romance,Drama,Children,Musical
1027,128505,5.0,966274621,1,"",Adventure,Drama,"",7695,3.28,0.94,1210,593,"","","",2,"","",5.00,0.00,Crime,Horror,Thriller,Action,Adventure
1027,36526,3.0,1308748908,0,"",Adventure,Drama,"",7695,3.28,0.94,247,1967,3863,2968,2021,100,"","",3.31,0.58,Drama,Sci-Fi,Adventure,Comedy,Thriller
1027,90878,3.0,1056915920,0,"",Adventure,Drama,"",7695,3.28,0.94,1104,1228,1207,1250,1203,100,"","",3.55,0.91,Drama,War,Comedy,Crime,Adventure
102716,66401,2.5,1370025693,0,"",Action,Crime,Thriller,284,3.31,1.00,102686,6662,59784,1032,2087,100,"","",3.49,0.75,Drama,Comedy,Thriller,Action,Crime
1028,113417,2.0,938953147,0,"",Children,Comedy,Fantasy,14096,3.73,0.98,2797,2390,52,2081,587,80,"","",3.79,1.21,Comedy,Romance,Drama,Crime,Adventure
1028,115713,4.0,966376366,1,"",Children,Comedy,Fantasy,14096,3.73,0.98,1597,1288,2145,1298,1921,36,"","",3.78,1.31,Comedy,Drama,Thriller,Romance,Action
1028,127704,5.0,944901918,1,"",Children,Comedy,Fantasy,14096,3.73,0.98,1022,914,2080,919,594,46,"","",3.52,1.22,Romance,Comedy,Drama,Fantasy,Children
1028,4937,4.0,972793909,1,"",Children,Comedy,Fantasy,14096,3.73,0.98,1282,2502,2084,27,2882,100,"","",3.80,1.02,Drama,Comedy,Romance,Children,Animation
1029,60081,3.0,860845367,0,"",Animation,Children,Drama,8951,3.49,0.98,1242,920,1293,913,1203,100,"","",3.87,0.92,Drama,Comedy,Romance,Crime,Adventure
1029,63738,5.0,1361075746,1,"",Animation,Children,Drama,8951,3.49,0.98,2294,1358,"","","",6,"","",3.50,0.84,Drama,Adventure,Animation,Children,Comedy
1029,90143,4.0,976594044,1,"",Animation,Children,Drama,8951,3.49,0.98,897,931,596,2018,963,100,"","",4.19,0.75,Drama,Comedy,Thriller,Adventure,Action
103042,35640,4.5,1418666127,1,"",Action,Adventure,Fantasy,1120,3.39,0.93,87232,96829,109487,7153,4993,59,"","",4.70,0.32,Drama,Action,Thriller,Sci-Fi,Crime
1031,111982,3.0,1213797031,0,"",Adventure,Children,Musical,4227,3.33,0.95,6502,3967,3186,45722,2090,100,"","",3.18,0.88,Drama,Children,Comedy,Animation,Adventure
1031,132610,3.0,843275265,0,"",Adventure,Children,Musical,4227,3.33,0.95,1012,880,1025,835,1019,61,"","",3.46,0.62,Comedy,Drama,Children,Thriller,Action
1031,72472,4.0,944932612,1,"",Adventure,Children,Musical,4227,3.33,0.95,2161,2987,2005,2115,1291,30,"","",4.17,0.75,Comedy,Adventure,Fantasy,Children,Action
1032,100227,3.5,1421061218,1,"",Adventure,Animation,Children,7842,3.63,0.92,33493,3408,1784,51662,3034,83,"","",3.72,0.56,Drama,Adventure,Action,Crime,Thriller
1032,120922,4.5,1353672693,1,"",Adventure,Animation,Children,7842,3.63,0.92,2565,914,1566,4734,3798,17,"","",3.94,0.70,Comedy,Adventure,Musical,Animation,Children
1032,3210,4.0,1119906617,1,"",Adventure,Animation,Children,7842,3.63,0.92,2078,2018,2137,8360,1029,100,"","",3.50,0.78,Action,Adventure,Comedy,Children,Animation
1032,86804,3.0,851449527,0,"",Adventure,Animation,Children,7842,3.63,0.92,912,1089,551,495,521,78,"","",3.31,0.65,Drama,Romance,Comedy,Thriller,Crime
103249,119655,4.0,1372794170,1,"",Action,Drama,Horror,954,3.36,0.85,95567,96821,103042,102903,101741,100,"","",3.29,0.84,Drama,Thriller,Action,Crime,Sci-Fi
103253,59370,3.5,1401320708,1,"",Action,Drama,Sci-Fi,944,3.28,0.83,37729,6377,5010,49530,106489,100,"","",3.91,0.73,Action,Sci-Fi,Thriller,Drama,Adventure
1033,119675,4.0,953675676,1,"",Animation,Children,Drama,3982,3.43,0.89,2139,2917,2458,3385,2375,100,"","",2.99,1.37,Drama,War,Comedy,Crime,Romance
1033,134851,5.0,951878555,1,"",Animation,Children,Drama,3982,3.43,0.89,2005,577,2141,837,317,47,"","",3.47,0.95,Children,Adventure,Comedy,Fantasy,Drama
1033,138004,2.5,1318296023,0,"",Animation,Children,Drama,3982,3.43,0.89,3267,4161,419,1296,1188,14,"","",3.25,0.83,Comedy,Romance,Children,Action,Fantasy
1033,64612,3.0,1115976366,0,"",Animation,Children,Drama,3982,3.43,0.89,2161,917,1023,2018,7942,100,"","",3.38,0.89,Drama,Romance,Comedy,Thriller,Fantasy
1033,85946,4.0,1293735962,1,"",Animation,Children,Drama,3982,3.43,0.89,1381,2398,2137,830,"",8,"","",3.50,0.76,Comedy,Animation,Children,Drama,Musical
103341,56662,3.5,1421974633,1,"",Action,Comedy,Sci-Fi,662,3.46,0.86,103772,86880,79293,106487,102125,100,"","",3.34,0.83,Action,Adventure,Thriller,Sci-Fi,IMAX
103341,66401,4.0,1378019325,1,"",Action,Comedy,Sci-Fi,662,3.46,0.86,103688,103883,104337,104303,103253,100,"","",3.39,0.71,Drama,Action,Comedy,Crime,Thriller
1034,132466,4.0,942349975,1,"",Comedy,Crime,Drama,1502,3.54,1.08,2764,1809,3019,2138,2095,100,"","",3.61,0.82,Drama,Romance,Comedy,Horror,Thriller
1035,107697,2.0,1030911549,0,"",Musical,Romance,"",14049,3.80,1.08,4034,4993,5470,908,5475,19,"","",3.74,1.24,Drama,Thriller,Romance,Adventure,Crime
1035,87097,5.0,842400818,1,"",Musical,Romance,"",14049,3.80,1.08,364,531,596,362,594,30,"","",4.17,0.87,Drama,Children,Adventure,Fantasy,Animation
103539,29549,3.0,1391900907,0,"",Comedy,Drama,Romance,213,3.54,0.75,106782,106918,106489,106100,106916,100,"","",3.54,0.66,Drama,Comedy,Action,Thriller,Crime
1036,105435,3.0,842008973,0,"",Action,Crime,Thriller,30399,3.93,0.85,318,593,527,110,380,17,"","",3.41,0.62,Drama,Adventure,Crime,Thriller,Comedy
1036,120848,4.0,903456344,1,"",Action,Crime,Thriller,30399,3.93,0.85,25,1208,1263,1354,1610,92,"","",3.86,0.93,Drama,Romance,Thriller,Comedy,Action
1036,124014,2.5,1200909468,0,"",Action,Crime,Thriller,30399,3.93,0.85,3175,8368,4896,40815,5816,99,"","",4.27,1.00,Drama,Adventure,Comedy,Crime,Action
1036,129041,4.0,944915878,1,"",Action,Crime,Thriller,30399,3.93,0.85,2313,1293,1957,1961,1288,100,"","",3.04,0.90,Drama,Comedy,Thriller,Romance,Mystery
1036,135343,3.5,1197174293,1,"",Action,Crime,Thriller,30399,3.93,0.85,4022,3176,2710,5299,6863,96,"","",3.98,0.83,Action,Adventure,Drama,Thriller,Sci-Fi
1036,136460,4.0,1111491344,1,"",Action,Crime,Thriller,30399,3.93,0.85,1961,1097,4027,2011,2001,22,"","",3.52,0.59,Comedy,Drama,Action,Romance,Adventure
1036,23843,5.0,864045573,1,"",Action,Crime,Thriller,30399,3.93,0.85,1196,1210,719,765,852,100,"","",3.55,0.74,Drama,Comedy,Action,Thriller,Romance
1036,3210,4.0,1119397431,1,"",Action,Crime,Thriller,30399,3.93,0.85,589,1408,110,8636,3578,100,"","",3.60,0.78,Adventure,Action,Fantasy,Children,Comedy
1036,36526,3.5,1308743916,1,"",Action,Crime,Thriller,30399,3.93,0.85,2987,592,4226,1210,1,100,"","",3.62,0.53,Action,Sci-Fi,Drama,Thriller,Adventure
1036,70097,4.0,842710413,1,"",Action,Crime,Thriller,30399,3.93,0.85,685,1032,211,534,314,100,"","",3.00,0.65,Drama,Thriller,Romance,Children,Fantasy
1036,89771,4.5,1216350289,1,"",Action,Crime,Thriller,30399,3.93,0.85,1291,39,185,1136,1265,93,"","",4.30,0.58,Action,Drama,Thriller,Comedy,Adventure
1036,98725,3.0,841708427,0,"",Action,Crime,Thriller,30399,3.93,0.85,778,608,246,223,29,36,"","",3.39,0.73,Comedy,Crime,Thriller,Drama,Action
103621,100227,3.0,1421061343,0,"",Horror,Sci-Fi,"",33,3.44,0.80,48385,1954,594,3081,1387,97,"","",3.65,0.55,Drama,Adventure,Action,Comedy,Crime
|