Skip to content

Commit

Permalink
fix dashboard (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored Mar 12, 2022
1 parent 987b5c8 commit b1d497a
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 176 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ Gorse is an open-source recommendation system written in Go. Gorse aims to be a

## Quick Start

- [Run Gorse manually](https://github.com/zhenghaoz/gorse/tree/master/cmd)
- [Run Gorse with Docker Compose](https://github.com/zhenghaoz/gorse/tree/master/docker)
- [Use Gorse to recommend awesome GitHub repositories](https://github.com/zhenghaoz/gitrec)
- [Read official documents](https://docs.gorse.io/)
- [Read develop roadmap](https://github.com/zhenghaoz/gorse/projects)
- [Visit official demo](https://gitrec.gorse.io/)

## Architecture

Expand All @@ -49,7 +46,7 @@ In addition, the administrator can perform system monitoring, data import and ex
<img src="https://contrib.rocks/image?repo=zhenghaoz/gorse" />
</a>

Any contribution is appreciated: report a bug, give advice or even create a pull request. You are welcome to submit [*Gorse In-Production User Registration*](https://forms.office.com/r/q04Fgkh18t) to add your product to the case studies section of [gorse.io](https://gorse.io/) if you are using Gorse in production.
Any contribution is appreciated: report a bug, give advice or even create a pull request.

## Acknowledgments

Expand Down
94 changes: 0 additions & 94 deletions cmd/README.md

This file was deleted.

1 change: 1 addition & 0 deletions config/config.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cache_store = "redis://localhost:6379/0"
# postgres://bob:[email protected]:5432/mydb?sslmode=verify-full
# clickhouse://user:password@host[:port]/database?param1=value1&...&paramN=valueN
# mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
# mongodb+srv://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
data_store = "mysql://gorse:gorse_pass@tcp(localhost:3306)/gorse?parseTime=true"

# The cache size for recommended/popular/latest items. The default value is 100.
Expand Down
58 changes: 0 additions & 58 deletions docker/README.md

This file was deleted.

51 changes: 47 additions & 4 deletions docker/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ cache_store = "redis://redis:6379"
# postgres://bob:[email protected]:5432/mydb?sslmode=verify-full
# clickhouse://user:password@host[:port]/database?param1=value1&...&paramN=valueN
# mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
# mongodb+srv://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
data_store = "mysql://gorse:gorse_pass@tcp(mysql:3306)/gorse?parseTime=true"

# The cache size for recommended/popular/latest items. The default value is 100.
cache_size = 200
cache_size = 100

# Insert new users while inserting feedback. The default value is true.
auto_insert_user = true
Expand Down Expand Up @@ -44,7 +45,7 @@ meta_timeout = 10 # cluster meta timeout (second)

# This section declares settings for the server node.
[server]
default_n = 20 # default number of returned items
default_n = 10 # default number of returned items
api_key = "" # secret key for RESTful APIs (SSL required)

# This section declares settings for recommendation.
Expand All @@ -54,7 +55,7 @@ api_key = "" # secret key for RESTful APIs (SSL required)
popular_window = 30

# The time period for model fitting (minutes). The default values is 60.
fit_period = 10
fit_period = 360

# The time period for model searching (minutes). The default values is 100.
search_period = 60
Expand All @@ -65,6 +66,9 @@ search_epoch = 100
# The number of trials for model searching. The default values is 10.
search_trials = 10

# The time period to check recommendation for users (minutes). The default values is 1.
check_recommend_period = 1

# The time period to refresh recommendation for inactive users (days). The default values is 5.
refresh_recommend_period = 1

Expand All @@ -75,6 +79,9 @@ refresh_recommend_period = 1
# Recommenders are used in order. The default values is ["latest"].
fallback_recommend = ["item_based", "latest"]

# The number of feedback used in fallback item-based similar recommendation. The default values is 10.
num_feedback_fallback_item_based = 10

# The type of neighbors for items. There are three types:
# similar: Neighbors are found by number of common labels.
# related: Neighbors are found by number of common users.
Expand All @@ -83,6 +90,15 @@ fallback_recommend = ["item_based", "latest"]
# The default values is "auto".
item_neighbor_type = "similar"

# Enable approximate item neighbor searching using vector index.
enable_item_neighbor_index = false

# Minimal recall for approximate item neighbor searching.
item_neighbor_index_recall = 0.8

# Maximal number of fit epochs for approximate item neighbor searching vector index.
item_neighbor_index_fit_epoch = 3

# The type of neighbors for users. There are three types:
# similar: Neighbors are found by number of common labels.
# related: Neighbors are found by number of common liked items.
Expand All @@ -91,6 +107,15 @@ item_neighbor_type = "similar"
# The default values is "auto".
user_neighbor_type = "similar"

# Enable approximate user neighbor searching using vector index.
enable_user_neighbor_index = false

# Minimal recall for approximate user neighbor searching.
user_neighbor_index_recall = 0.8

# Maximal number of fit epochs for approximate user neighbor searching vector index.
user_neighbor_index_fit_epoch = 3

# Enable latest recommendation during offline recommendation. The default values is false.
enable_latest_recommend = true

Expand All @@ -106,12 +131,30 @@ enable_item_based_recommend = false
# Enable collaborative filtering recommendation during offline recommendation. The default values is true.
enable_collaborative_recommend = true

# Enable approximate collaborative filtering recommend using vector index.
enable_collaborative_index = false

# Minimal recall for approximate collaborative filtering recommend.
collaborative_index_recall = 0.9

# Maximal number of fit epochs for approximate collaborative filtering recommend vector index.
collaborative_index_fit_epoch = 3

# Enable click-though rate prediction during offline recommendation. Otherwise, results from multi-way recommendation
# would be merged randomly. The default values is true.
enable_click_through_prediction = true

# The explore recommendation method is used to inject popular items or latest items into recommended result:
# popular: Recommend popular items to cold-start users.
# latest: Recommend latest items to cold-start users.
# Recommenders are used in order. The default values is { popular = 0.0, latest = 0.0 }.
# The default values is { popular = 0.0, latest = 0.0 }.
explore_recommend = { popular = 0.1, latest = 0.2 }

# Replace historical items back to recommendations.
enable_replacement = false

# Decay the weights of replaced items from positive feedbacks.
positive_replacement_decay = 0.8

# Decay the weights of replaced items from read feedbacks.
read_replacement_decay = 0.6
32 changes: 25 additions & 7 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
restart: unless-stopped
ports:
- 6379:6379

mysql:
image: mysql/mysql-server
restart: unless-stopped
Expand All @@ -16,7 +17,8 @@ services:
MYSQL_USER: gorse
MYSQL_PASSWORD: gorse_pass
volumes:
- ./var/lib/mysql:/var/lib/mysql
- mysql_data:/var/lib/mysql

worker:
image: zhenghaoz/gorse-worker
restart: unless-stopped
Expand All @@ -26,8 +28,11 @@ services:
--master-host master --master-port 8086 --http-host 0.0.0.0 --http-port 8089
--log-path /var/log/gorse/worker.log --cache-path /var/lib/gorse/worker_cache.data
volumes:
- ./var/log/gorse:/var/log/gorse
- ./var/lib/gorse:/var/lib/gorse
- gorse_log:/var/log/gorse
- worker_data:/var/lib/gorse
depends_on:
- master

server:
image: zhenghaoz/gorse-server
restart: unless-stopped
Expand All @@ -37,8 +42,11 @@ services:
--master-host master --master-port 8086 --http-host 0.0.0.0 --http-port 8087
--log-path /var/log/gorse/server.log --cache-path /var/lib/gorse/server_cache.data
volumes:
- ./var/log/gorse:/var/log/gorse
- ./var/lib/gorse:/var/lib/gorse
- gorse_log:/var/log/gorse
- server_data:/var/lib/gorse
depends_on:
- master

master:
image: zhenghaoz/gorse-master
restart: unless-stopped
Expand All @@ -48,5 +56,15 @@ services:
command: -c /etc/gorse/config.toml --log-path /var/log/gorse/master.log --cache-path /var/lib/gorse/master_cache.data
volumes:
- ./config.toml:/etc/gorse/config.toml
- ./var/log/gorse:/var/log/gorse
- ./var/lib/gorse:/var/lib/gorse
- gorse_log:/var/log/gorse
- master_data:/var/lib/gorse
depends_on:
- redis
- mysql

volumes:
mysql_data:
worker_data:
server_data:
master_data:
gorse_log:
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/go-redis/redis/v8 v8.11.0
github.com/go-sql-driver/mysql v1.6.0
github.com/gorilla/securecookie v1.1.1
github.com/gorse-io/dashboard v0.0.0-20220221123215-3c20525d5e96
github.com/gorse-io/dashboard v0.0.0-20220312053149-edd363d0232a
github.com/haxii/go-swagger-ui v3.19.4+incompatible
github.com/json-iterator/go v1.1.12
github.com/juju/errors v0.0.0-20220203013757-bd733f3c86b9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyC
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorse-io/dashboard v0.0.0-20220221123215-3c20525d5e96 h1:z5toIn/jqYvojGx474O96yvieXiO+nWcw/GzOBeE3DY=
github.com/gorse-io/dashboard v0.0.0-20220221123215-3c20525d5e96/go.mod h1:14j0KVMmOAAN0xvsa2wxFoV/X8Aa/gCeNFRLjtYP6+M=
github.com/gorse-io/dashboard v0.0.0-20220312053149-edd363d0232a h1:LlFvpY6VVr2oBpnRsL8eK+snwj25ib7gc66G0LNpJ1g=
github.com/gorse-io/dashboard v0.0.0-20220312053149-edd363d0232a/go.mod h1:14j0KVMmOAAN0xvsa2wxFoV/X8Aa/gCeNFRLjtYP6+M=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
Expand Down
2 changes: 1 addition & 1 deletion master/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (m *Master) getRecommend(request *restful.Request, response *restful.Respon
results, err = m.Recommend(userId, category, n, m.RecommendUserBased)
case "item_based":
results, err = m.Recommend(userId, category, n, m.RecommendItemBased)
case "":
case "_":
recommenders := []server.Recommender{m.RecommendOffline}
for _, recommender := range m.GorseConfig.Recommend.FallbackRecommend {
switch recommender {
Expand Down
Loading

0 comments on commit b1d497a

Please sign in to comment.