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

Enable missing values in instances #5

Merged
merged 3 commits into from
Feb 3, 2016

Conversation

paulgoetze
Copy link
Owner

Allows creating Weka::Core::DenseInstance objects by instantiation with just an integer (additionally to the initializer with a data array and the weight):

Weka::Core::DenseInstance.new(5)

creates an instance with 5 missing values.

Fixes internal type casting of allowed missing values ('?', nil, and Float::NAN) in an Attribute in order to allow adding instances with missing values:

# instances is a Weka::Core::Instances object
instances.add_instance([:sunny, '?', 75, nil, Float::NAN])
instances.instances.last.values
# => ['sunny', '?', 75, '?', '?']

Passing  only an Integer n on instantiation will create an intance
with n missing values. Missing values are returned as '?'.
Missing values can be written as '?', nil, or Float::NAN, e.g.
instances.add_instance([:sunny, Float::NAN, 91, nil, '?'])
will output ['sunny', '?', 91.0, '?', '?'] as the instance values.
paulgoetze added a commit that referenced this pull request Feb 3, 2016
…alues

Enable missing values in instances
@paulgoetze paulgoetze merged commit 3cdfa04 into develop Feb 3, 2016
@paulgoetze paulgoetze deleted the feature/instance-with-missing-values branch February 3, 2016 19:17
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

Successfully merging this pull request may close these issues.

1 participant