We did not explain the movie_norm function. This function performs per dịch - We did not explain the movie_norm function. This function performs per Việt làm thế nào để nói

We did not explain the movie_norm f

We did not explain the movie_norm function. This function performs per-movie
normalization: some movies are just generally better and get higher average marks:
def movie_norm(x):
xc = x.copy().toarray()
We cannot use xc.mean(1) because we do not want to have the zeros counting for
the mean. We only want the mean of the ratings that were actually given:
x1 = np.array([xi[xi > 0].mean() for xi in xc])
In certain cases, there were no ratings and we got a NaN value, so we replace it with
zeros using np.nan_to_num, which does exactly this task:
x1 = np.nan_to_num(x1)
Now we normalize the input by removing the mean value from the non-zero
entries:
for i in xrange(xc.shape[0]):
xc[i] -= (xc[i] > 0) * x1[i]
Implicitly, this also makes the movies that the user did not rate have a value of
zero, which is average. Finally, we return the normalized array and the means:
return x,x1
You might have noticed that we converted to a regular (dense) array. This has the
added advantage that it makes the optimization much faster: while scikit-learn
works well with the sparse values, the dense arrays are much faster (if you can fit
them in memory; when you cannot, you are forced to use sparse arrays).
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Chúng tôi đã không giải thích các chức năng movie_norm. Chức năng này thực hiện một bộ phimbình thường hóa: một số phim chỉ nói chung tốt hơn và nhận được cao hơn trung bình là nhãn hiệu:def movie_norm(x):XC = x.copy().toarray()Chúng tôi không thể sử dụng xc.mean(1) bởi vì chúng tôi không muốn có các số không đếm chocó nghĩa là. Chúng tôi chỉ muốn có nghĩa là xếp hạng mà thực sự đã được đưa ra:x 1 = np.array ([xi [xi > 0].mean() cho xi trong xc])Trong một số trường hợp, có là không có đánh giá và chúng tôi đã nhận một giá trị NaN, do đó, chúng tôi thay thế nó vớiZero bằng cách sử dụng np.nan_to_num, mà thực hiện chính xác công việc này:x 1 = np.nan_to_num(x1)Bây giờ chúng tôi bình thường hóa các đầu vào bằng cách loại bỏ giá trị trung bình từ khác 0mục:cho tôi tại xrange(xc.shape[0]):XC [i]-= (xc [i] > 0) * 1 x [i]Ngầm, điều này cũng làm cho những bộ phim mà người dùng đã không đánh giá có giá trịZero, đó là trung bình. Cuối cùng, chúng tôi trở lại bình thường mảng và các phương tiện:trở lại x, x 1Bạn có thể thấy rằng chúng tôi chuyển đổi sang một mảng (dày đặc) thường xuyên. Điều này có cácthêm lợi thế là nó làm cho việc tối ưu hóa nhanh hơn nhiều: trong khi scikit-tìm hiểuhoạt động tốt với các giá trị thưa thớt, mảng dày đặc nhanh hơn nhiều (nếu bạn có thể phù hợp vớichúng trong bộ nhớ; Khi bạn không thể, bạn buộc phải sử dụng thưa thớt mảng).
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
We did not explain the movie_norm function. This function performs per-movie
normalization: some movies are just generally better and get higher average marks:
def movie_norm(x):
xc = x.copy().toarray()
We cannot use xc.mean(1) because we do not want to have the zeros counting for
the mean. We only want the mean of the ratings that were actually given:
x1 = np.array([xi[xi > 0].mean() for xi in xc])
In certain cases, there were no ratings and we got a NaN value, so we replace it with
zeros using np.nan_to_num, which does exactly this task:
x1 = np.nan_to_num(x1)
Now we normalize the input by removing the mean value from the non-zero
entries:
for i in xrange(xc.shape[0]):
xc[i] -= (xc[i] > 0) * x1[i]
Implicitly, this also makes the movies that the user did not rate have a value of
zero, which is average. Finally, we return the normalized array and the means:
return x,x1
You might have noticed that we converted to a regular (dense) array. This has the
added advantage that it makes the optimization much faster: while scikit-learn
works well with the sparse values, the dense arrays are much faster (if you can fit
them in memory; when you cannot, you are forced to use sparse arrays).
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: