Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Loom._convert_to_proper_stattype to account for float/int differences #614

Closed
fsaad opened this issue Mar 2, 2018 · 0 comments
Closed

Comments

@fsaad
Copy link
Collaborator

fsaad commented Mar 2, 2018

def _convert_to_proper_stattype(self, bdb, generator_id, colno, value):
"""Convert a value returned by the logpdf_joint method parameters into a
form that Loom can handle. For instance, convert from an integer to
real or, from a string to an integer.
"""
if value is None:
return value
population_id = bayesdb_generator_population(bdb, generator_id)
stattype = bayesdb_variable_stattype(bdb, population_id, None, colno)
# If nominal then return the integer code.
if _is_nominal(stattype):
return self._get_integer_form(bdb, generator_id, colno, value)
# Return the value as float.
return float(value)

Returning float(value) will cause a problem for counts data (and boolean as well, I believe).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant