It looks like you are following this TF tutorial, so I’ll be referencing that some. It looks like you’ve gotten some items out of order from the tutorial. It splits the original data into train and test sets and then pops the expense field for labels before anything else. Also, you will need to remove expenses from your categories (
NUMERIC_COLUMNS). Once you do this, you’ll get new errors you can sort out via Stack Overflow, which then leads to more errors after that, which are also easy to chase down.
Most of the problems are really not in your code, but in the tutorial not being explicit about the problem it’s trying to solve. First, it’s a linear classifier, which expects class labels, not numbers. The tutorial glosses this, but if you read very closely, you’ll see that the survival label they target is binary (the data is 0 or 1, might as well have been
alive). Since you want an expense, that is a number, not a label, so you could use the linear regressor (similar, but not in the tutorial), but then you’ll need to change the code after that to inspect the results and run the tests.
Or, you could follow this tutorial instead, which explicitly does a linear regression on fuel efficiency data. The only downside of this method is that you will have to build a model yourself.