-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from takuti/mf-alias
Make `MF` alias of `MatrixFactorization` fo readability
- Loading branch information
Showing
4 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 13 additions & 4 deletions
17
test/model/test_mf.jl → test/model/test_matrix_factorization.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
function test_mf() | ||
println("-- Testing MF-based recommender") | ||
|
||
function run(recommender::Type{T}) where {T<:Recommender} | ||
m = [NaN 3 NaN 1 2 1 NaN 4 | ||
1 2 NaN NaN 3 2 NaN 3 | ||
NaN 2 3 3 NaN 5 NaN 1] | ||
data = DataAccessor(m) | ||
|
||
recommender = MF(data, 2) | ||
recommender = recommender(data, 2) | ||
build!(recommender, learning_rate=15e-4, max_iter=100) | ||
|
||
# top-4 recommantion list should be same as CF/SVD-based recommender | ||
rec = recommend(recommender, 1, 4, [i for i in 1:8]) | ||
@test Set([first(r) for r in rec]) == Set([2, 5, 6, 8]) | ||
end | ||
|
||
function test_mf() | ||
println("-- Testing MF-based (aliased) recommender") | ||
run(MF) | ||
end | ||
|
||
function test_matrix_factorization() | ||
println("-- Testing Matrix Factorization-based recommender") | ||
run(MatrixFactorization) | ||
end | ||
|
||
test_mf() | ||
test_matrix_factorization() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters