Skip to content

Support negative feedback type#1215

Merged
zhenghaoz merged 6 commits intogorse-io:masterfrom
zhenghaoz:negative-feedback-priority
Mar 26, 2026
Merged

Support negative feedback type#1215
zhenghaoz merged 6 commits intogorse-io:masterfrom
zhenghaoz:negative-feedback-priority

Conversation

@zhenghaoz
Copy link
Copy Markdown
Collaborator

@zhenghaoz zhenghaoz commented Mar 26, 2026

Fix #244
Fix #848

Design for issue gorse-io#848 - support explicit negative feedback with highest priority.

Key features:
- Add negative_feedback_types config option
- Negative feedback takes priority over positive feedback
- Backward compatible - no behavior change if not configured
Phase 1 of negative feedback priority implementation.

- Add NegativeFeedbackTypes field to DataSourceConfig
- Update Hash methods to include NegativeFeedbackTypes
- Backward compatible: defaults to empty array
Phase 2 of negative feedback priority implementation.

Changes:
- Add negFeedbackTypes parameter to LoadDataFromDatabase
- Load explicit negative feedback first (STEP 3)
- Exclude negative feedback items from positive set (STEP 4)
- Exclude negative/positive items from read set (STEP 5)
- Create dataset with priority: negative > positive > read (STEP 6)

The explicit negative feedback now has the highest priority:
- Items with negative feedback are always treated as negative samples
- Positive feedback on the same item is ignored
- Read feedback on the same item is also ignored
…ndations

Phase 3 of negative feedback priority implementation.

Changes:
- logics/recommend.go: Negative feedback items are always added to excludeSet
  regardless of EnableReplacement setting
- cmd/gorse-cli/main.go: Add NegativeFeedbackTypes parameter to LoadDataFromDatabase calls

This ensures items with explicit negative feedback are never recommended,
even when replacement is enabled.
Phase 4 of negative feedback priority implementation.

- Add comprehensive test for negative feedback priority
  - Tests user with both positive and negative feedback on same item
  - Verifies negative feedback takes priority in dataset creation
  - Verifies negative feedback items are excluded from recommendations
- Update design document with implementation status
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 80.82192% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.95%. Comparing base (cb7df46) to head (9808962).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
master/tasks.go 87.50% 4 Missing and 4 partials ⚠️
config/config.go 0.00% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1215      +/-   ##
==========================================
- Coverage   73.18%   72.95%   -0.23%     
==========================================
  Files          88       89       +1     
  Lines       16304    16569     +265     
==========================================
+ Hits        11932    12088     +156     
- Misses       3198     3242      +44     
- Partials     1174     1239      +65     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for explicit negative feedback types (configured via negative_feedback_types) and gives them highest priority during dataset construction and online recommendation exclusion, addressing the request in #244.

Changes:

  • Extend recommendation data source config with NegativeFeedbackTypes and include it in recommender/model digests.
  • Update dataset loading to treat explicit negative feedback as highest priority, and ensure it overrides positive/read samples.
  • Update online exclusion logic so negative-feedback items are always excluded from recommendations (even when replacement is enabled).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
master/tasks.go Loads explicit negative feedback first and applies priority rules when building CTR training samples.
logics/recommend.go Always excludes items with configured negative feedback types from recommendations.
config/config.go Adds negative_feedback_types to config and to hash/digest computations.
cmd/gorse-cli/main.go Wires the new NegativeFeedbackTypes into CLI dataset loading.
master/tasks_test.go Updates call sites for the new LoadDataFromDatabase signature and adds a priority/exclusion test.
docs/negative-feedback-design.md Adds a design document describing negative feedback priority behavior and configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread master/tasks.go Outdated
Comment thread master/tasks.go Outdated
Comment thread master/tasks_test.go Outdated
Comment thread docs/negative-feedback-design.md Outdated
@zhenghaoz zhenghaoz merged commit 36d6e19 into gorse-io:master Mar 26, 2026
12 of 13 checks passed
@zhenghaoz zhenghaoz deleted the negative-feedback-priority branch March 26, 2026 15:04
zhangzhenghao pushed a commit to zhangzhenghao/docs that referenced this pull request Apr 1, 2026
- Add 'Negative Feedback' section to data-source.md (English and Chinese)
- Document negative feedback types with examples and warnings
- Update configuration tables with negative_feedback_types
- Update example configurations

Related: gorse-io/gorse#1215
zhangzhenghao pushed a commit to zhangzhenghao/dashboard that referenced this pull request Apr 7, 2026
- Add Negative Feedback Types input field in RecFlow.vue
- Load negative_feedback_types from API in Overview.vue
- Include negative_feedback_types in feedbackTypes list in Recommend.vue

Related: gorse-io/gorse#1215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

是否支持反向反馈? Negative feedback types

2 participants