Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kharinaev_mobod_hw2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
harinaev artem
kharinaev_mobod_hw2
Commits
60252029
Commit
60252029
authored
1 year ago
by
petr.pogorelov
Browse files
Options
Downloads
Patches
Plain Diff
week 8 seminar upd
parent
f277851a
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
botify/botify/experiment.py
+3
-1
3 additions, 1 deletion
botify/botify/experiment.py
botify/botify/server.py
+20
-7
20 additions, 7 deletions
botify/botify/server.py
with
23 additions
and
8 deletions
botify/botify/experiment.py
+
3
−
1
View file @
60252029
...
...
@@ -69,6 +69,8 @@ class Experiments:
DSSM
=
Experiment
(
"
DSSM
"
,
Split
.
HALF_HALF
)
CONTEXTUAL
=
Experiment
(
"
CONTEXTUAL
"
,
Split
.
HALF_HALF
)
GCF
=
Experiment
(
"
GCF
"
,
Split
.
HALF_HALF
)
DIVERSITY
=
Experiment
(
"
DIVERSITY
"
,
Split
.
HALF_HALF
)
ALL
=
Experiment
(
"
ALL
"
,
Split
.
SEVEN_WAY
)
def
__init__
(
self
):
self
.
experiments
=
[
Experiments
.
GCF
]
self
.
experiments
=
[
Experiments
.
ALL
]
This diff is collapsed.
Click to expand it.
botify/botify/server.py
+
20
−
7
View file @
60252029
...
...
@@ -15,6 +15,7 @@ from botify.recommenders.Indexed import Indexed
from
botify.recommenders.random
import
Random
from
botify.recommenders.contextual
import
Contextual
from
botify.recommenders.toppop
import
TopPop
from
botify.recommenders.sticky_artist
import
StickyArtist
from
botify.track
import
Catalog
root
=
logging
.
getLogger
()
...
...
@@ -31,6 +32,7 @@ recommendations_lfm = Redis(app, config_prefix="REDIS_RECOMMENDATIONS")
recommendations_dssm
=
Redis
(
app
,
config_prefix
=
"
REDIS_RECOMMENDATIONS_DSSM
"
)
recommendations_contextual
=
Redis
(
app
,
config_prefix
=
"
REDIS_RECOMMENDATIONS_CONTEXTUAL
"
)
recommendations_gcf
=
Redis
(
app
,
config_prefix
=
"
REDIS_RECOMMENDATIONS_GCF
"
)
recommendations_div
=
Redis
(
app
,
config_prefix
=
"
REDIS_TRACKS_WITH_DIVERSE_RECS
"
)
data_logger
=
DataLogger
(
app
)
...
...
@@ -53,6 +55,10 @@ catalog.upload_recommendations(
catalog
.
upload_recommendations
(
recommendations_gcf
,
"
RECOMMENDATIONS_GCF_FILE_PATH
"
)
catalog
.
upload_recommendations
(
recommendations_div
,
"
TRACKS_WITH_DIVERSE_RECS_CATALOG_FILE_PATH
"
,
key_object
=
'
track
'
,
key_recommendations
=
'
recommendations
'
)
top_tracks
=
TopPop
.
load_from_json
(
app
.
config
[
"
TOP_TRACKS
"
])
...
...
@@ -84,15 +90,22 @@ class NextTrack(Resource):
args
=
parser
.
parse_args
()
treatment
=
Experiments
.
GCF
.
assign
(
user
)
treatment
=
Experiments
.
ALL
.
assign
(
user
)
if
treatment
==
Treatment
.
T1
:
recommender
=
Indexed
(
recommendations_gcf
.
connection
,
catalog
,
Random
(
tracks_redis
)
)
recommender
=
StickyArtist
(
tracks_redis
.
connection
,
artists_redis
.
connection
,
catalog
)
elif
treatment
==
Treatment
.
T2
:
recommender
=
TopPop
(
catalog
.
top_tracks
[:
100
],
Random
(
tracks_redis
.
connection
))
elif
treatment
==
Treatment
.
T3
:
recommender
=
Indexed
(
recommendations_lfm
.
connection
,
catalog
,
Random
(
tracks_redis
.
connection
))
elif
treatment
==
Treatment
.
T4
:
recommender
=
Indexed
(
recommendations_dssm
.
connection
,
catalog
,
Random
(
tracks_redis
.
connection
))
elif
treatment
==
Treatment
.
T5
:
recommender
=
Contextual
(
recommendations_contextual
.
connection
,
catalog
,
Random
(
tracks_redis
.
connection
))
elif
treatment
==
Treatment
.
T6
:
recommender
=
Contextual
(
recommendations_div
.
connection
,
catalog
,
Random
(
tracks_redis
.
connection
))
else
:
recommender
=
Indexed
(
recommendations_dssm
.
connection
,
catalog
,
Random
(
tracks_redis
)
)
recommender
=
Random
(
tracks_redis
.
connection
)
recommendation
=
recommender
.
recommend_next
(
user
,
args
.
track
,
args
.
time
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment