Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
task_A
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
RISHABH GARG
task_A
Commits
751138f6
Commit
751138f6
authored
Aug 28, 2016
by
RISHABH GARG
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Movies to watch
parent
4f8d298d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
collab-filter.py
collab-filter.py
+18
-0
No files found.
collab-filter.py
View file @
751138f6
...
...
@@ -38,3 +38,21 @@ for i in reviewdic:
stdRev
=
sqrt
((
sum
(
map
(
lambda
x
:
x
*
x
,
temp
))
/
len
(
temp
))
-
mean
)
pear
.
append
(
sum
([(
float
(
prefdict
[
j
])
-
avgUser
)
*
(
float
(
i
[
j
])
-
mean
)
/
(
len
(
var
)
*
stdRev
*
stdUser
)
for
j
in
var
]))
order_pear
=
sorted
(
zip
(
reviewers
,
pear
),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
unwatched_movies
=
[
i
for
i
in
prefdict
.
keys
()
if
float
(
prefdict
[
i
])
==-
1
]
finalrating
=
{}
for
movie
in
header
[
1
:]:
var
=
[
pear
[
i
]
*
float
(
reviewdic
[
i
][
movie
])
for
i
in
range
(
len
(
pear
))
if
float
(
reviewdic
[
i
][
movie
])
!=-
1
and
float
(
prefdict
[
movie
])
!=-
1
]
finalrating
[
movie
]
=
sum
(
var
)
finalorder
=
sorted
(
finalrating
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
towatch
=
[]
for
movie
,
rating
in
finalorder
:
if
movie
not
in
unwatched_movies
:
continue
else
:
towatch
.
append
(
movie
)
if
len
(
towatch
)
>=
3
:
for
i
in
range
(
3
):
print
(
towatch
[
i
])
else
:
for
movie
,
rating
in
finalorder
:
print
(
movie
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment