liveBook · Manning

Binary variable

As explained in Fight Fraud with Machine Learning

A binary feature is an input variable whose value is restricted to two alternatives, represented here as 0 and 1.

A binary feature is an input variable limited to 0 and 1. In phishing data, it can represent a yes/no property such as NoHttps or RightClickDisabled, unlike numerical features such as URL length or number of dots. section 2.1

Start by inspecting feature values and types, then identify columns whose nonmissing values are all 0 or 1, excluding the fraud label. This separates binary indicators from other numeric inputs before rule design. section 2.1

Evaluate a binary feature as a possible fraud signal by:

  • Testing both direct and inverse interpretations: feature value 1 may predict fraud, or value 0 may predict fraud. section 2.1.1
  • Ranking features by the better of their two accuracy values when fraudulent and genuine samples are equally represented. section 2.1.1
  • Checking the feature-label relationship with a countplot and confusion matrix rather than relying on ranking alone. section 2.1.1
  • Turning strong indicators into simple rules, then comparing AND and OR combinations for accuracy. section 2.2 section 2.2.1

Certificate mismatch and email submission

FrequentDomainNameMismatch predicts fraud when its value is 1 and reaches 69.07% accuracy, above the 50% baseline. SubmitInfoToEmail is inversely related to fraud, so its rule predicts fraud when the value is 0. Combining these two rules with AND reaches 69.23%, while OR reaches 61.82%. section 2.2.1

Figure 2.18 Fraud detection system diagram for a logical AND combination of rules built on the binary features – FrequentDomainNameMismatch and SubmitInfoToEmail.

The diagram shows an end-to-end phishing detector whose AND decision combines two simple rules derived from binary features. section 2.2.1

Binary features make simple rules easy to inspect, but adding features creates exponentially many logical combinations. Rule-based systems therefore trade transparency for growing search and maintenance complexity. section 2.4

How Fight Fraud with Machine Learning covers it

How deep it goes
Defines 0/1 inputs, shows detection and correlation analysis, then builds and evaluates logical rules from them.
Examples
Uses NoHttps, RightClickDisabled, FrequentDomainNameMismatch, and SubmitInfoToEmail in a phishing webpage dataset.
What you can do after
Apply it via pandas, Seaborn, and scikit-learn to rank indicators, inspect correlations, and evaluate fraud rules.
How it connects
Connects binary features to numerical features, fraud labels, accuracy, confusion matrices, and rule-based systems.

Also explained in

Compare how 3 books explain binary variable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fight Fraud with Machine Learning. The section links point to the parts of the book it draws on.