lmaurits / BEASTling

A linguistics-focussed command line tool for generating BEAST XML files.
BSD 2-Clause "Simplified" License
20 stars 6 forks source link

Model weights need to be integers, but aren't for single-value models. #187

Closed Anaphory closed 6 years ago

Anaphory commented 6 years ago

I have added

[model grammar]
data = ../../gramrumah-data/values.csv
model = mk
file_format = cldf
rate_variation = True

to an existing beastling config. Beastling runs fine (after I fixed all issues in my values file), but beast does not:

Failed to set the string value to '6 9 9 10 9 12 16 11 15 11 25 20 13 31 19 25 17 19 7 17 3 18 11 34 22 12 7 20 26 12 12 25 23 13 29 6 5 20 21 11 5 21 8 21 23 15 12 11 12 17 18 12 19 14 20 17 18 24 9 15 19 6 19 13 20 14 14 21 22 21 7 14 10 27 26 15 24 20 5 18 24 14 23 15 26 13 24 24 6 21 15 22 9 20 15 18 20 21 10 3 4 21 35 27 10 14 19 24 23 13 16 25 11 15 22 33 21 15 11 10 11 11 17 20 11 12 14 16 18 9 18 19 18 29 27 30 8 8 15 10 19 11 19 21 4 23 10 12 4 6 23 21 13 2 15 15 16 12 30 24 7 18 30 9 9 9 15 19 21 13 15 22 17 17 27 20 18 27 23 22 18 20 10 15 36 17 25 4 21 8 20 15 25 25 21 28 15 17 16 17 14 22 20 10 25 16 27 9 19 8 14 17 19 11 12 7 20 14 19 17 30 9 16 20 27 15 18 21 20 18 21 8 16 23 4 15 5 16 17 14 24 15 22 11 15 14 31 7 20 11 11 20 23 12 13 6 15 8 24 6 19 7 12 17 14 18 13 18 18 5 7 16 11 19 20 14 11 19 14 22 11 10 11 12 9 15 20 27 30 14 17 22 10 9 11 10 6 4 11 10 15 15 13 16 6 18 9 9 22 9 27 18 12 23 14 7 27 14 30 22 11 18 5 13 23 16 23 16 16 17 12 22 29 20 19 15 11 11 13 12 22 11 16 23 10 7 22 14 12 8 8 10 20 8 7 16 10 20 18 26 20 10 10 10 11 22 21 20 18 14 14 13 9 20 2 21 21 15 15 28 23 17 24 5 19 9 13 9 21 22 17 7 10 14 20 29 14 4 16 23 17 14 6 4 23 25 24 15 17 16 15 23 14 19 18 7 8 24 4 8 10 25 15 19 15 21 11 18 23 18 14 17 19 26 26 31 19 12 25 23 24 21 19 16 18 19 14 22 17 19 21 22 27 23 20 21 9 18 15 16 12 25 18 25 20 29 14 14 14 14 19 14 15 16 20 22 18 15 21 19 20 20 29 19 21 22 20 15 16 28 32 15 21 20 14 18 25 11 15 19 20 17 14 17 11 14 16 27 6 18 20 11 12 18 9 13 20 20 6 16 9 16 23 24 23 20 21 16 11 10 19 21 21 11 15 18 20 21 23 18 35 23 22 20 16 16 26 16 18 20 11 15 22 22 8 28 16 13 15 16 17 9 9 11 12 12 12 11 26 8 7 16 15 13 13 14 11 13 22 26 24 14 16 17 12 19 19 23 28 18 9 14 13 27 22 20 18 22 8 10 13 19 24 16 14 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0' for beastobject id=featureClockRateWeightParameter:default

Error detected about here:
  <beast>
      <run id='mcmc' spec='MCMC'>
          <operator id='featureClockRateDeltaExchanger:default' spec='DeltaExchangeOperator'>
              <weightvector id='featureClockRateWeightParameter:default' spec='parameter.IntegerParameter'>

Note that it fails at an IntegerParameter object and the string ends with a sequence of 1.0s.

Anaphory commented 6 years ago

The culprit is this:

https://github.com/lmaurits/BEASTling/blob/e8dea8ff5c81c61426dfde028c932f40da7d7b02/beastling/models/basemodel.py#L300

Either that should append a 1, if we are sure that our weights should never be floats, or the weight vector should be a RealParameter:

https://github.com/lmaurits/BEASTling/blob/e8dea8ff5c81c61426dfde028c932f40da7d7b02/beastling/beastxml.py#L507

Anaphory commented 6 years ago

Given that DeltaExchangeOperator apparently requires integer weights (why?), the first option seems the one to choose.