How do I specify numerical and categorical variables in catboost with R?

229 views Asked by At

The tutorial for catboost with R says this:

library(catboost)

countries = c('RUS','USA','SUI')
years = c(1900,1896,1896)
phone_codes = c(7,1,41)
domains = c('ru','us','ch')

dataset = data.frame(countries, years, phone_codes, domains)

label_values = c(0,1,1)

fit_params <- list(iterations = 100,
                   loss_function = 'Logloss',
                   ignored_features = c(4,9),
                   border_count = 32,
                   depth = 5,
                   learning_rate = 0.03,
                   l2_leaf_reg = 3.5)

pool = catboost.load_pool(dataset, label = label_values, cat_features = c(0,3))

model <- catboost.train(pool, params = fit_params)

However, this results in: Error in catboost.from_data_frame(data, label, pairs, weight, group_id, : Unsupported column type: character

Many thanks,

0

There are 0 answers