Comments (14)
I cannot reproduce the error on either the CRAN version or the development version.
library(arules)
data(Groceries)
rules <- apriori(Groceries,
parameter=list(support=0.001, confidence=0.8))
x <- 'milk'
rules <- subset(rules, subset = (lhs %pin% as.character(x)) & lift > 1)
rules
set of 63 rules
Please send me the data and the exact code that produces the error.
from arules.
The data set is proprietary but I can probably provide you a rules object that fails. Would that work?
from arules.
Yes, it would be great if you can modify my code from above so that it fails.
from arules.
I tried duplicating with a dataset I could share and failed, however it fails consistently with the private data set. It failed under versions 1.4-1, 1.4-2, and 1.4-2-1. I can provide a failed rules object and will continue to try and replicate from scratch with a public dataset. Is 'standardGeneric' the appropriate class for 'lhs' (or possibly the rules file in general) or should it be something else?
from arules.
interestingly if I remove the (lhs %pin% as.character(x)) &
portion of the subset, I receive the error "object 'lift' not found"
.
from arules.
I am pretty sure that this is your problem:
rules <- 10
subset(rules, subset = (lhs %pin% as.character(x)) & lift > 1)
Show Traceback
Rerun with Debug
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘%pin%’ for signature ‘"standardGeneric", "character"’
In other words, rules does not contain rules and R unfortunately says this not in a very readable way.
from arules.
It's possible. I'm honestly confused and suspect it could be a complication of how it is run. However when I remove the subset line and run I receive full output. Here is the plot output for plot(rules, method="grouped", measure="confidence"))
: https://s3.amazonaws.com/gabe1/arulesVis.png so I'm confident the rules file is some sort of rules file.
The execution path is private module -> function -> %do% -> function -> rmarkdown:render -> rmarkdown file -> sub-rmarkdown file (incorporated into the main file using knit_expand).
The rmarkdown::render() is called with envir=env.new(). Still, is it possible subset simply doesn't know how to deal with 'lift' and 'lhs' due to the way it is called?
from arules.
This is strange. Does everything also look ok if you say inspect(rules)?
from arules.
inspect(rules) looks normal:
## lhs rhs support confidence lift
## 1 {} => {victim.employee_count.Unknown} 0.2534307 0.2534307 1.000000
## 2 {} => {attribute.confidentiality.data.variety.Personal} 0.3153787 0.3153787 1.000000
## 3 {} => {attribute.confidentiality.data.variety.Unknown} 0.3827941 0.3827941 1.000000
## 4 {} => {actor.external.variety.Unknown} 0.4337762 0.4337762 1.000000
## 5 {} => {asset.variety.Unknown} 0.4582470 0.4582470 1.000000
## 6 {} => {asset.assets.variety.Unknown} 0.4582470 0.4582470 1.000000
## 7 {} => {actor.internal.variety.Unknown} 0.4863627 0.4863627 1.000000
## 8 {} => {attribute.confidentiality.data_disclosure.Potentially} 0.5349928 0.5349928 1.000000
## 9 {} => {victim.employee_count.Large} 0.7320986 0.7320986 1.000000
## 10 {} => {victim.industry2.92} 0.7357903 0.7357903 1.000000
## 11 {} => {victim.orgsize.Large} 0.7384539 0.7384539 1.000000
## 12 {asset.assets.variety.P - Other} => {pattern.Everything Else} 0.1335846 0.8854016 6.396792
## 13 {asset.assets.variety.P - Other} => {action.social.variety.Phishing} 0.1487095 0.9856494 6.607947
## 14 {asset.assets.variety.P - Other} => {action.social.vector.Email} 0.1486939 0.9855461 6.515403
## 15 {asset.assets.variety.P - Other} => {asset.variety.Person} 0.1508746 1.0000000 6.497874
## 16 {asset.assets.variety.P - Other} => {attribute.integrity.variety.Alter behavior} 0.1508590 0.9998968 6.480151
## 17 {asset.assets.variety.P - Other} => {actor.external.variety.Unknown} 0.1360769 0.9019203 2.079229
## 18 {asset.assets.variety.P - Other} => {victim.employee_count.Large} 0.1265752 0.8389428 1.145942
## 19 {asset.assets.variety.P - Other} => {victim.industry2.92} 0.1270736 0.8422465 1.144683
## 20 {asset.assets.variety.P - Other} => {victim.orgsize.Large} 0.1267465 0.8400785 1.137618
from arules.
The only odd thing is the 1<->1 mapping. I can't remember if that's an artifact of how I ran apriori or an anomaly.
Clearly I peg asset.assets.variety.P - Other
to the LHS, but i'm surprised I don't see groups.
from arules.
did you put the inspect right before the subset in the original code that creates the error (the markdown file)?
from arules.
The inspect is immediately after the subset, however the subset is commented out. (It would get rid of the empty LHS's if it were working.)
from arules.
This is really strange. Try to replace the subset with this:
rules[lhs(rules) %pin% as.character(x) & quality(rules)$lift>1]
Also, do you load a package that overwrites %pin%?
from arules.
It's possible that %pin% is being overwritten as I load a bunch of stuff, however I tried removing it and still received an error that 'lift' didn't exist. I also directly defined %pin% (%pin%` <- arules::`%pin%
) and still received the error.
Technically I used rules <- rules[lhs(rules) %pin% as.character(x) & quality(rules)$lift>1]
, but that worked. Received no errors and received the filtered output:
## lhs rhs support confidence lift
## 1 {asset.assets.variety.P - Other} => {pattern.Everything Else} 0.1335846 0.8854016 6.396792
## 2 {asset.assets.variety.P - Other} => {action.social.variety.Phishing} 0.1487095 0.9856494 6.607947
## 3 {asset.assets.variety.P - Other} => {action.social.vector.Email} 0.1486939 0.9855461 6.515403
## 4 {asset.assets.variety.P - Other} => {asset.variety.Person} 0.1508746 1.0000000 6.497874
## 5 {asset.assets.variety.P - Other} => {attribute.integrity.variety.Alter behavior} 0.1508590 0.9998968 6.480151
## 6 {asset.assets.variety.P - Other} => {actor.external.variety.Unknown} 0.1360769 0.9019203 2.079229
## 7 {asset.assets.variety.P - Other} => {victim.employee_count.Large} 0.1265752 0.8389428 1.145942
## 8 {asset.assets.variety.P - Other} => {victim.industry2.92} 0.1270736 0.8422465 1.144683
## 9 {asset.assets.variety.P - Other} => {victim.orgsize.Large} 0.1267465 0.8400785 1.137618
from arules.
Related Issues (20)
- Error in validObject(.Object) : invalid class “ngTMatrix” object: all row indices (slot 'i') must be between 0 and nrow-1 in a TsparseMatrix HOT 1
- interestMeasure count for itemsets HOT 1
- continuous features? HOT 1
- Help installing arules HOT 3
- Bug: RStudio generates X ammount of Rules, Knited Document has Y HOT 10
- Check item encoding HOT 1
- error in evaluating the argument 'x' in selecting a method for function 'colSums': 'NA' indices are not (yet?) supported for sparse Matrices HOT 4
- Error in transactions(AdultUCI) : could not find function "transactions" HOT 2
- issue when aggregating items HOT 5
- What is transIdenticalToItemsets? HOT 1
- Apriori " Error in deparse1(call) : could not find function "deparse1" " HOT 1
- Parameter to define minimum support (inclusion) HOT 7
- arules 1.7.3 doesn't seem to work with R 4.2 HOT 1
- Discretize is not passing the dig.lab method to cut HOT 1
- dependency with Matrix ? HOT 1
- Least Contradiction Range incorrect HOT 3
- (can't install package) ERROR: compilation failed for package 'fim4r' HOT 8
- find rule on the right side RHS apriori vs fpgrowth HOT 7
- arulesSequences error with timeout HOT 1
- Difference between is.significant() and InterestMeasure() - with same method HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arules.