本文整理汇总了Python中Netflix.netflix_solve函数的典型用法代码示例。如果您正苦于以下问题:Python netflix_solve函数的具体用法?Python netflix_solve怎么用?Python netflix_solve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了netflix_solve函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_solve_1
def test_solve_1(self):
""" test solves input 1"""
inp = StringIO("2043:\n1417435\n2312054\n462685\n")
writer = StringIO()
netflix_solve(inp, writer)
self.assertEqual(
writer.getvalue(), "2043:\n3.6\n4.6\n3.9\nRMSE: 2.087128003334406\n")
示例2: test_solve_2
def test_solve_2(self):
""" test solves input 2"""
inp = StringIO("1:\n30878\n2043:\n462685\n")
writer = StringIO()
netflix_solve(inp, writer)
self.assertEqual(
writer.getvalue(), "1:\n3.7\n2043:\n3.9\nRMSE: 0.2180552033726668\n")
示例3: test_solve_3
def test_solve_3(self):
""" test solves input 3"""
inp = StringIO("2043:\n2312054\n1:\n30878\n")
writer = StringIO()
netflix_solve(inp, writer)
self.assertEqual(
writer.getvalue(), "2043:\n4.6\n1:\n3.7\nRMSE: 2.5264965005457753\n")
示例4: test_netflix_solve_3
def test_netflix_solve_3 (self) :
re = StringIO.StringIO("COSTUMERS_RATE\n1 3.4\n2 4.4\n3 2.4\n5 1.2\n4 2.2\nMOVIE_RATES\n2 2.5\n1 3.5")
getCatch(re)
r = StringIO.StringIO("1:\n2:")
w = StringIO.StringIO()
netflix_solve(r, w)
self.assert_(w.getvalue() == "1:\n2:\n")
示例5: test_netflix_solve_3
def test_netflix_solve_3 (self) :
r = StringIO('2043:\n1417435\n2312054\n462685\n2849:\n1198093\n1129293\n1417435\n1894792\n')
w = StringIO()
netflix_solve(r,w)
val = findall(r'\d\.\d\d+',w.getvalue())
# print(val)
self.assertEqual(len(val),1)
self.assertTrue(float(val[0]) < 1.75)
示例6: test_netflix_solve_2
def test_netflix_solve_2 (self) :
r = StringIO('2043:\n1417435\n2312054\n462685\n2849:\n1198093\n1129293\n1417435\n1894792\n')
w = StringIO()
netflix_solve(r,w)
self.assertNotEqual(w.getvalue(),'')
self.assertTrue('RMSE:' in w.getvalue())
示例7: test_solve4
def test_solve4 (self) :
r = io.StringIO("3676:\n1982226\n1495499\n1669842\n2639376\n1982597\n1426939\n")
w = io.StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "3676:\n3.7\n3.6\n4.5\n2.9\n4.2\n4.2\nRMSE: 0.6597351087461958\n")
示例8: test_solve_3
def test_solve_3 (self) :
r = StringIO("1:\n30878\n10:\n1952305\n1531863\n")
w = StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "3.7\n3.3\n3.2\n")
示例9: test_solve_2
def test_solve_2 (self) :
input_string = StringIO()
output_string = StringIO()
netflix_solve(input_string, output_string)
self.assertEqual("RMSE: 0.00\n", output_string.getvalue())
示例10: test_solve_3
def test_solve_3 (self) : #
r = StringIO("2043:\n1417435\n2312054\n2043:\n1417435\n2312054\n2043:") #two sets and an incomplete
w = StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "2043:\n3.6\n4.6\n2043:\n3.6\n4.6\n2043:\nRMSE:2.5807\n")
示例11: test_solve_1
def test_solve_1 (self) :
r = StringIO("1:\n30878\n")
w = StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "3.7\n")
示例12: len
# ---------------------------
# CS 373 Project 3
# Anh-Khoi Dang - add562
# ---------------------------
# -------
# imports
# -------
import sys, time
from Netflix import netflix_read, netflix_eval, netflix_solve
# ----
# main
# ----
#s = time.clock()
if len(sys.argv) != 4 :
exit("Usage: python RunNetflix.py <movie titles file> <training set directory> <probe file>")
else :
movieTitlesFile = sys.argv[1]
trainingSetDir = sys.argv[2]
probeFile = sys.argv[3]
netflix_solve(sys.stdout, trainingSetDir, probeFile)
#e = time.clock()
#print (e - s), "seconds"
示例13: test_solve3
def test_solve3 (self) :
r = io.StringIO("10007:\n1204847\n2160216\n248206\n")
w = io.StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "10007:\n2.0\n2.7\n2.2\nRMSE: 1.6254316644013882\n")
示例14: test_solve2
def test_solve2 (self) :
r = io.StringIO("1:\n712610\n1772839\n1059319\n2380848\n548064\n")
w = io.StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "1:\n4.1\n4.2\n3.1\n5.0\n3.5\nRMSE: 0.7601868708858408\n")
示例15: test_solve1
def test_solve1 (self) :
r = io.StringIO("1:\n14756\n")
w = io.StringIO()
netflix_solve(r, w)
self.assertEqual(w.getvalue(), "1:\n3.7\nRMSE: 0.30654350027973454\n")