0
$\begingroup$

I have been learning a bit about machine learning and have used a few model types (xgboost, LogisticRegression) with some test data. The more I use these models the more I realize there is a specific type of data that they work with, columns that can be turned into numbers. Even things like Make/Model of cars can be turned into numbers because they are finite and repeating in datasets.

The dataset that I really want to work with has things like First and Last Name, Company Name, Email Address, etc. Strings that are unique. Here is an example

First and Last Name Company Name Email Address Is Fraud
WHOLE FOODS CVS EVALUATION WHOLE FOODS/CVS EVALUATION [email protected] True
WHOLE FOODS STORE WHOLE FOODS STORE [email protected] True
Tina Rosen Best Wares Shoes [email protected] False
Joe John WHOLE FOODS MARKET SURVEY [email protected] True
Stacey Parket S Parket Outlet [email protected] False
Michael Phelan KROGER [email protected] True

This is a small set of the data that I have, but you can see it doesn't fit into the normal dataset for the models I've learned about and worked with. I've tried things like OneHotEncoder and LabelEncoder, but they turn them into integers that don't really mean anything, since they don't repeat.

I know it's easy to look at that sample and think "oh just write validators yourself looking for multiple periods in email, specific words in the name, etc" but there are thousands of iterations of the fraud accounts that wouldn't fit.

So my question is, is there a machine learning model that takes in things like those emails addresses/names and learns what fraud email addresses/names look like?

$\endgroup$
1
  • $\begingroup$ All models need to have numbers instead of strings as input since they are simply performing calculations. Depending on the type of text data, often used approaches are (word) embeddings or tf-idf vectors of the text data. Additionally it might still be valuable to create features yourself if you recognize patterns which are not captured when using embeddings/n-grams (e.g. the domain of the email address). $\endgroup$
    – Oxbowerce
    Commented Apr 29 at 16:14

1 Answer 1

2
$\begingroup$

Before struggling on 'what machine learning model to use', let's take a step back and ask 'does my features have a causal connection with the target?'

Machine learning is no magic. It cannot predict without useful information; garbage in, garbage out.

Let's start by making some hypothesis; For example in your dataset,

  1. For name, is there any logical reason that a person with certain first/last name is more likely to be "fraud"? E.g. is "John" more likely to commit fraud than "Mary", or would "Henderson" more likely to be faulty than "Rosen"?

  2. For email address, any logical reason that certain domains are more likely to be fraud? E.g. "gmail.com" vs. "yahoo.com".

If the answer to any of the above questions are "yes" or "maybe", we should follow up with feature engineering and extract the useful part, and worry about algorithms later. Otherwise, do not waste your time on this dataset; go out and collect data that have causal relationship with "fraud".

The take-home message is: what model/algorithm to use should be your last concern; instead, think about what connection your data have with your target. Otherwise, in the end you would get hit by this statement over and over: garbage in, garbage out.

$\endgroup$
4
  • $\begingroup$ Thank you for this well written response! Let's say that I analyze the Company Name column and find that customers with WHOLE FOODS or KROGER in the name are more likely to be fraud. Are there any resources you can point me to for feature engineering that column? $\endgroup$
    – Jrow
    Commented May 4 at 17:00
  • $\begingroup$ So the hypothesis is (part of) a company' name is related to target. Trouble is a company's name can be a sub-string of the 'Company Name' field, so you have to find a way to extract the names. If you already have a list of all (or suspected) companies' names then it can be as simple as a lookup; otherwise some NLP techniques e.g. longest common substring, n-gram are necessary. $\endgroup$
    – lpounng
    Commented May 6 at 2:32
  • $\begingroup$ after you have the name(s) of companies that exist in each sample, you can try different feature engineering techniques, starting from simplest ones e.g. does_any_suspected_company_present all the way down to feature hashing. $\endgroup$
    – lpounng
    Commented May 6 at 2:36
  • $\begingroup$ BTW, this is only a way to do it. Things get complicated if there exists a lot of companies and we do not have any suspect to start with, and that new companies are expected to present in future. In this case, you can try @Oxbowerce's comment and figure out a way and leverage some word-embedding techniques. $\endgroup$
    – lpounng
    Commented May 6 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.