VowpalWabbit / vowpal_wabbit

Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning.
https://vowpalwabbit.org
Other
8.49k stars 1.93k forks source link

Segmentation fault in CATS #4631

Open ataymano opened 1 year ago

ataymano commented 1 year ago

Describe the bug

Specific cats command on small dataset is causing segmentation fault on linux

How to reproduce

data.txt:

ca 0.57:-0.5:1.0 | feature1
ca 0.58:-0.5:1.0 | feature1
ca 0.81:-0.5:1.0 | feature1
ca 0.03:-0.5:1.0 | feature1
ca 0.08:-0.5:1.0 | feature1

command line:

vw --cats 1 --min_value 0 --max_value 1 --bandwidth 1 -d data.txt -f model.bin

output:

final_regressor = model.bin
[info] VW 9.0.0 introduced a change to the default model save behavior. Please use '--predict_only_model' when using either '--invert_hash' or '--readable_model' to get the old behavior. Details: https://vowpalwabbit.org/link/1
predictions = pred.txt
[warning] Bandwidth is larger than continuous action range, this will result in a uniform pdf.
using no cache
Reading datafile = data.txt
num sources = 1
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
Enabled learners: gd, scorer-identity, binary, cats_tree, get_pmf, pmf_to_pdf, cb_explore_pdf, cats_pdf, sample_pdf, cats
Input label = CONTINUOUS
Output pred = ACTION_PDF_VALUE
average  since         example        example        current        current  current
loss     last          counter         weight          label        predict features
-0.50000 -0.50000            1            1.0  {0.57,-0.5,1}         0.05,1        2
-0.50000 -0.50000            2            2.0  {0.58,-0.5,1}         0.71,1        2
-0.50000 -0.50000            4            4.0  {0.03,-0.5,1}         0.94,1        2

finished run
number of examples = 6
weighted example sum = 6.000000
weighted label sum = 6.000000
average loss = -0.500000
total feature number = 11
Segmentation fault

Version

9.8.0

OS

Linux (Ubuntu)

Language

CLI

Additional context

No response

olgavrou commented 1 year ago

can you try with --cats 2? it isn't enforced (probably should be) but it is assumed that that argument is a power of 2

ataymano commented 1 year ago

1 = 2^0) but yeah it works with --cats 2. Probably should be explicit error message if certain value is not supported.