# Predicting model. Need help

Hello community!
I’m trying to create my own prediction model for family expenses. I had data for the last 2.5 years. I’m doing that as a homework for video " 4—STRUCTURED, TIME SERIES, & LANGUAGE MODELS"
And my main question is how to fix an error I had as soon as learn.fit() started.

I’m using fastai 0.7 and paperspace cloud.

I have next data in my formatted csv:
DATE - date when event happened
TYPE - expense or income
AMOUNT - amount of money in some currency
CURRENCY - for prev AMOUNT
GOAL - like gas, food and etc.
1EUR/1BYN - currency exchange rate for that date
100RUB/1BYN - currency exchange rate for that date
1USD/1BYN - currency exchange rate for that date
USD_AMOUNT - AMOUNT converted to USD based on exchange rate

Some of them probably useless and there are lots of features to engineer, but to make it simple it is how described above.

Here some pieces of code:

``````cat_vars = ['TYPE', 'CURRENCY', 'GOAL']
for v in cat_vars:
main_data[v] = main_data[v].astype('category').cat.as_ordered()
main_data_to_operate = main_data.set_index("DATE")
``````
``````x, y, nas, mapper = proc_df(main_data_to_operate, 'USD_AMOUNT', do_scale=True)
yl = np.log(y)
``````
``````data = ColumnarModelData.from_data_frame(PATH, val_idx, x, yl.astype(np.float32), cat_flds=cat_vars, bs=128)
``````
``````cat_sz = [('TYPE', 2), ('CURRENCY', 3), ('GOAL', 43)]
emb_szs = [(c, min(50, (c+1)//2)) for _,c in cat_sz]
``````
``````learn = data.get_learner(emb_szs, len(x.columns)-len(cat_vars), 0.04, 1, [1000,500], [0.001,0.01])
``````
``````lr = 1e-3
learn.fit(lr, 3, metrics=[accuracy])
``````

And the last piece of code gives me an error:

``````RuntimeError: cuda runtime error (59) : device-side assert triggered at /opt/conda/conda-bld/pytorch_1518244421288/work/torch/lib/THC/generic/THCTensorMathPairwise.cu:102
``````

What I’m doing wrong here?

P.S. Is it possible to create model that predicts TYPE, AMOUNT, CURRENCY, GOAL based on DATE and exchange rates? How should I change my code for that?