BiRankFr | R Documentation |
BiRank algorithm to compute fraud scores.
BiRankFr(
sNetwork,
fraudMat,
Today = Sys.Date(),
decayR = 0,
decayF = 0,
alpha = 0.85,
maxiter = 1000,
Epsilon = 1e-14,
PrintProgress = F,
pInit = NULL,
cInit = NULL,
ConvCriterion = c("Sep", "Whole", "Order")
)
sNetwork |
Data frame containing the variables startNode, endNode and possibly Date. |
fraudMat |
Data frame containing the variables FraudInd (binary variable indicatinf fraudulent claimes) and possibly Date. |
Today |
Date of analysis (e.g. 1/1/2020), default is |
decayR |
Parameter for exponential decay of recency of relation (in weeks). |
decayF |
Parameter for exponential decay of recency of fraud (in weeks). |
alpha |
Damping factor for propagation algorithm (return to start). |
maxiter |
Maximum number of iterations for propagation algorithm. |
Epsilon |
Positive convergence tolerance |
PrintProgress |
Logical, indicates whether progress of the algorithm has to be printed. |
pInit |
Initial values for the party score vector |
cInit |
Initial values for the fraud score vector |
ConvCriterion |
Which convergence criterion to use. |
A list with the following components:
ResultsClaims |
A data frame containing the claim IDs, fraud scores, scaled and normalized fraud scores. |
ResultsParties |
A data frame containing the party IDs, party scores, scaled and normalized party scores. |
AdjacencyMatrix |
Adjancency/weight matrix indicating which nodes are connected. |
iter |
Number of iterations that the algorithm needed to converge. |
Converged |
Logical, indicating whether the algorithm converged. |
library(BiRankFraud)
NetwLabel = data.frame(
startNode = c('P2', 'P3', 'P3', 'C1', 'C1', 'C5', 'P1', 'P4', 'C2', 'C2'),
endNode = c('C3', 'C3', 'C4', 'P2', 'P3', 'P3', 'C1', 'C5', 'P1', 'P4'),
stringsAsFactors = FALSE
)
NetwLabel[grepl("C", NetwLabel$startNode), 1:2] = NetwLabel[grepl("C", NetwLabel$startNode), 2:1]
NetwLabel = NetwLabel[order(NetwLabel$startNode), ]
NetwLabel$startNode = as.numeric(gsub("P", "", NetwLabel$startNode))
NetwLabel$endNode = as.numeric(gsub("C", "", NetwLabel$endNode))
NetwLabel
c0 = c(rep(0, 3), 1, 0)
Results = BiRankFr(NetwLabel, data.frame(FraudInd = c0))
Results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.