liveBook · Manning

Regular expression

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A pattern notation for matching, extracting, or transforming text sequences.

A regular expression (regex) is a sequence of characters that defines a search pattern. Use it to match text and turn semi-structured descriptions into useful dataset features. section 7.1.2

For rental listings, patterns can capture an accommodation area, star rating, bedroom count, bed count, and bath count from one description field.

Python feature engineering

With pandas, apply str.extract() to create captured-value columns and use re.IGNORECASE when capitalization varies. Use str.contains() instead when a simple presence flag—such as studio, shared bath, or half-bath—is sufficient.

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines pattern matching and demonstrates practical extraction, but does not develop regex syntax comprehensively.
Examples
Uses Tokyo rental strings to extract area, ratings, bedrooms, beds, baths, and accommodation characteristics.
What it assumes
Assumes basic Python and pandas familiarity while using concrete strings to make pattern construction approachable.
What you can do after
Apply it via Python and pandas to transform text descriptions into numeric, categorical, and binary features.
How it connects
Connects regular expressions with feature engineering, string matching, pandas, Python, and binary features.

Also explained in

Compare how 27 books explain regular expression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.