dselivanov / text2vec

Fast vectorization, topic modeling, distances and GloVe word embeddings in R.
http://text2vec.org
Other
849 stars 135 forks source link

Error: 'colScale' is not an exported object from 'namespace:Matrix' #342

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

There are some errors in examples/tests:

* checking examples ... ERROR
Running examples in ‘text2vec-Ex.R’ failed
The error most likely occurred in:

> ### Name: BNS
> ### Title: BNS
> ### Aliases: BNS
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data("movie_review")
> N = 1000
> it = itoken(head(movie_review$review, N), preprocessor = tolower, tokenizer = word_tokenizer)
> vocab = create_vocabulary(it)
> dtm = create_dtm(it, vocab_vectorizer(vocab))
as(<dgTMatrix>, "dgCMatrix") is deprecated since Matrix 1.5-0; do as(., "CsparseMatrix") instead
> model_bns = BNS$new()
> dtm_bns = model_bns$fit_transform(dtm, head(movie_review$sentiment, N))
Error: 'colScale' is not an exported object from 'namespace:Matrix'
Execution halted

R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.8.0 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> Sys.setenv("R_TESTS" = "")
> library(testthat)
> library(text2vec)
> library(mlapi)
> data("movie_review")
> test_check("text2vec")
INFO  [01:19:15.903] early stopping at 100 iteration
INFO  [01:19:18.136] early stopping at 30 iteration
INFO  [01:20:32.813] soft_als: iter 001, frobenious norm change 350.807 loss NA
INFO  [01:20:32.833] soft_als: iter 002, frobenious norm change 0.290 loss NA
INFO  [01:20:32.851] soft_als: iter 003, frobenious norm change 0.042 loss NA
INFO  [01:20:32.868] soft_als: iter 004, frobenious norm change 0.013 loss NA
INFO  [01:20:32.886] soft_als: iter 005, frobenious norm change 0.006 loss NA
INFO  [01:20:32.905] soft_als: iter 006, frobenious norm change 0.003 loss NA
INFO  [01:20:32.924] soft_als: iter 007, frobenious norm change 0.002 loss NA
INFO  [01:20:32.939] soft_als: iter 008, frobenious norm change 0.001 loss NA
INFO  [01:20:32.955] soft_als: iter 009, frobenious norm change 0.001 loss NA
INFO  [01:20:32.959] soft_impute: converged with tol 0.001000 after 9 iter
INFO  [01:20:33.202] soft_als: iter 001, frobenious norm change 144.766 loss NA
INFO  [01:20:33.357] soft_als: iter 002, frobenious norm change 0.002 loss NA
INFO  [01:20:33.510] soft_als: iter 003, frobenious norm change 0.000 loss NA
INFO  [01:20:33.514] soft_impute: converged with tol 0.001000 after 3 iter
INFO  [01:20:33.787] soft_als: iter 001, frobenious norm change 144.849 loss NA
INFO  [01:20:33.943] soft_als: iter 002, frobenious norm change 0.002 loss NA
INFO  [01:20:34.096] soft_als: iter 003, frobenious norm change 0.000 loss NA
INFO  [01:20:34.099] soft_impute: converged with tol 0.001000 after 3 iter
INFO  [01:20:34.524] soft_als: iter 001, frobenious norm change 504.137 loss NA
INFO  [01:20:34.535] soft_als: iter 002, frobenious norm change 0.345 loss NA
INFO  [01:20:34.546] soft_als: iter 003, frobenious norm change 0.056 loss NA
INFO  [01:20:34.557] soft_als: iter 004, frobenious norm change 0.020 loss NA
INFO  [01:20:34.568] soft_als: iter 005, frobenious norm change 0.009 loss NA
INFO  [01:20:34.578] soft_als: iter 006, frobenious norm change 0.005 loss NA
INFO  [01:20:34.589] soft_als: iter 007, frobenious norm change 0.003 loss NA
INFO  [01:20:34.604] soft_als: iter 008, frobenious norm change 0.002 loss NA
INFO  [01:20:34.617] soft_als: iter 009, frobenious norm change 0.001 loss NA
INFO  [01:20:34.630] soft_als: iter 010, frobenious norm change 0.001 loss NA
INFO  [01:20:34.634] soft_impute: converged with tol 0.001000 after 10 iter
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 80 ]

══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-s3-interface.R:33:3'): S3 tf-idf ───────────────────────────────
Error in `h(simpleError(msg, call))`: error in evaluating the argument 'x' in selecting a method for function 'colSums': 'rowScale' is not an exported object from 'namespace:Matrix'
Backtrace:
    ▆
 1. ├─mlapi::fit_transform(dtm, tfidf) at test-s3-interface.R:33:2
 2. ├─mlapi:::fit_transform.Matrix(dtm, tfidf)
 3. │ └─model$fit_transform(x, y = y, ...)
 4. │   ├─private$get_idf(private$prepare_x(x))
 5. │   │ └─methods (local) colSums(abs(sign(x)))
 6. │   └─private$prepare_x(x)
 7. │     └─text2vec::normalize(x_internal, private$norm)
 8. └─base::.handleSimpleError(...)
 9.   └─base (local) h(simpleError(msg, call))
── Error ('test-s3-interface.R:41:3'): S3 bns ──────────────────────────────────
Error: 'colScale' is not an exported object from 'namespace:Matrix'
Backtrace:
    ▆
 1. ├─mlapi::fit_transform(dtm, bns, y) at test-s3-interface.R:41:2
 2. └─mlapi:::fit_transform.Matrix(dtm, bns, y)
 3.   └─model$fit_transform(x, y = y, ...)
 4.     └─self$transform(x, ...)

[ FAIL 2 | WARN 0 | SKIP 0 | PASS 80 ]
Error: Test failures
Execution halted
dselivanov commented 1 year ago

Thanks for reporting - duplicate #338. I will try to update on CRAN soon. In the meantime you can install Matrix >=1.5

barracuda156 commented 1 year ago

Thanks for reporting - duplicate #338. I will try to update on CRAN soon. In the meantime you can install Matrix >=1.5

Thank you, all tests pass now.