Learn R Programming

GTbasedIM (version 1.0.0)

Mell: Mell Function: Subset Data Based on Group Index Conditions

Description

The Mell function computes equation (1) in page 9 of Davila-Pena et al. (2024) when the dependency is positive and features are binary. It filters rows from Xdata and Ydata based on specific conditions of features' dependency as defined by index. It selects rows where the values of features within the same union, except for those in union ell, coincide.

Usage

Mell(Xdata, Ydata, index, ell)

Value

A list containing the following components:

Xdata.ell

A subset of Xdata that meets the specified group conditions.

Ydata.ell

The corresponding values from Ydata for the selected rows in Xdata.ell.

n.user.ell

The number of selected rows that meet the group condition.

Arguments

Xdata

Matrix. A dataset where rows represent observations and columns represent features.

Ydata

Vector. The response variable associated with each row in Xdata.

index

Vector. A grouping vector that assigns each feature in Xdata to a specific union. E.g., if we have the partition set P={{1},{2,4},{3}}, then index=c(1,2,3,2).

ell

Integer. The index of the union to exclude from the comparison.

Details

The Mell function iterates through each row of Xdata and compares the values of features within predefined unions (determined by index). For each union, excluding the one specified by ell, the function checks if all feature values in that union coincide. If this condition is satisfied for all unions except ell, the row is selected.

References

Davila-Pena, L., Saavedra-Nieves, A., & Casas-Méndez, B. (2024). On the influence of dependent features in classification problems: a game-theoretic perspective. arXiv preprint. tools:::Rd_expr_doi("10.48550/arXiv.2408.02481").

Examples

Run this code
# Example usage from Example 5.2 in Davila-Pena et al. (2024):

library(CoopGame)
n.user <- 16
Xdata <- createBitMatrix(4)[,-5]
Xdata <- rbind(c(0,0,0,0),Xdata)
Ydata <- rep(0,n.user)
Ydata[1+c(10,11,13,14,15)] <- 1

# Scenario 1:
Mell(Xdata = Xdata, Ydata = Ydata, index = c(1,2,3,4), ell = 3)
# Scenario 9:
Mell(Xdata = Xdata, Ydata = Ydata, index = c(1,2,1,2), ell = 2)

Run the code above in your browser using DataLab