weka 0.7.1-java → 0.7.4-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 720dd1a5ec6a7bd6805c4d780f2bb049c84f84f5f0f4b000fc867fae85e206cc
4
- data.tar.gz: c524af4d481d2dbb246537e1c7b3b3f799c6f2b9af9857b3ac481e10022f4242
3
+ metadata.gz: 310f0b949799325e257c946671eb64352943838fa3facf2a0dce5b890942c347
4
+ data.tar.gz: 587d8621743cd68621debfb8b2f539e593b1b6ad39de766838ce121fcc673ab2
5
5
  SHA512:
6
- metadata.gz: 2cfeeaa97c729e57cd8f6f571afb1bf2f4488242cf2d48eb41dca79033fba742c17f3036d9ee60e5b90e08b2757e0e9b85e6aee4882e2d9ba4655c8fe6f55307
7
- data.tar.gz: 86dba486f3133a92831591a5579c7dc3490369c5d2c5f77a436d200259c08a78e3e12e812d33c732abcdefc579f2512956fd0a7266ff0565b6ee7033c179a38e
6
+ metadata.gz: 63a55f7a748cc3c8ab0325add976a603b64b584efd5b223dc96d6322e1bb0bf76ee96fa4d54a0662b8a1c01409f6fa70fe0818bda6d13726493268096a21ba78
7
+ data.tar.gz: c93c4839d4954c7878e61fa8b0954caf1328b7f67aa66d1de449b696e4272ea459418db6507aaeadaa7a389f78c3a1fdb5420f5d9c0c2425082dc399378c617a
data/.gitignore CHANGED
@@ -1,11 +1,11 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
1
+ .bundle
2
+ .yardoc
3
+ Gemfile.lock
4
+ _yardoc
5
+ coverage
6
+ doc
7
+ pkg
8
+ spec/reports
9
+ tmp
10
10
  jars
11
- /lib/*_jars.rb
11
+ lib/*_jars.rb
data/.rubocop.yml CHANGED
@@ -14,7 +14,10 @@ Style/Documentation:
14
14
  Enabled: false
15
15
 
16
16
  Metrics/LineLength:
17
- Max: 80
17
+ Max: 105
18
+
19
+ Metrics/ClassLength:
20
+ Max: 250
18
21
 
19
22
  Layout/MultilineMethodCallIndentation:
20
23
  EnforcedStyle: indented
@@ -29,3 +32,28 @@ Metrics/ModuleLength:
29
32
  Metrics/BlockLength:
30
33
  Exclude:
31
34
  - "**/*_spec.rb"
35
+
36
+ Lint/ConstantDefinitionInBlock:
37
+ Exclude:
38
+ - "**/*_spec.rb"
39
+
40
+ Layout/EmptyLineBetweenDefs:
41
+ Enabled: false
42
+
43
+ Layout/HashAlignment:
44
+ Enabled: false
45
+
46
+ Lint/BooleanSymbol:
47
+ Enabled: false
48
+
49
+ Style/HashEachMethods:
50
+ Exclude:
51
+ - lib/weka/core/instances.rb
52
+ - spec/classifiers/evaluation_spec.rb
53
+
54
+ Naming/PredicateName:
55
+ Exclude:
56
+ - lib/weka/core/instances.rb
57
+
58
+ Metrics/CyclomaticComplexity:
59
+ Max: 8
data/CHANGELOG.md CHANGED
@@ -3,81 +3,134 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
- and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+ and this project adheres to
7
+ [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
8
 
8
9
  ## [Unreleased]
9
10
 
11
+ ## [0.7.4] – 2022-03-25
12
+
13
+ ### Changed
14
+
15
+ - Update Weka Jar dependency to weka-dev v3.9.6
16
+ Please also refer to the weka changelog for included updates & fixes:
17
+ https://www.cs.waikato.ac.nz/~ml/weka/CHANGELOG-3-9-6
18
+ - Update dev dependencies
19
+
20
+ ### Fixed
21
+
22
+ - `#use_options` in JRuby v9.3.4.0 (passing kwargs in internal method failed)
23
+
24
+ ## [0.7.3] – 2021-01-21
25
+
26
+ ### Changed
27
+
28
+ - Update Weka Jar dependency to weka-dev v3.9.5
29
+ Please also refer to the weka changelog for included updates & fixes:
30
+ https://www.cs.waikato.ac.nz/~ml/weka/CHANGELOG-3-9-5
31
+ - Update dev dependencies
32
+
33
+ ## [0.7.2] – 2020-03-20
34
+
35
+ ### Changed
36
+
37
+ - Update Weka Jar dependency to weka-dev v3.9.4
38
+ Please also refer to the weka changelog for included updates & fixes:
39
+ https://www.cs.waikato.ac.nz/~ml/weka/CHANGELOG-3-9-4
40
+ - Drop shoulda-matchers as dev-dependency
41
+
10
42
  ## [0.7.1] – 2018-11-09
43
+
11
44
  ### Changed
45
+
12
46
  - Update Weka Jar dependency to weka-dev v3.9.3
13
47
  - Update rake to \~>12.0, jar-dependencies to \~>0.4
14
48
 
15
49
  ### Fixed
50
+
16
51
  - Float::NAN check in Weka::Core::Attributes#internal_value_of
17
52
 
18
53
  ## [0.7.0] – 2018-01-01
54
+
19
55
  ### Added
56
+
20
57
  - Add new unsupervised attribute filters added in weka-dev v3.9.2
21
58
  - Make classes from weka.filters module available
22
59
  - Make WeightedInstancesHandlerWrapper available in Weka::Classifiers::Meta
23
- - Make FilteredClusterer & MakeDensityBasedClusterer available in Weka::Clusterers
60
+ - Make FilteredClusterer & MakeDensityBasedClusterer available in
61
+ Weka::Clusterers
24
62
 
25
63
  ### Changed
64
+
26
65
  - Update Weka Jar dependency to weka-dev v3.9.2
27
66
 
28
67
  ## [0.6.0] – 2017-12-17
68
+
29
69
  ### Added
70
+
30
71
  - #copy method for Weka::Core::Instances
31
72
 
32
73
  ### Changed
74
+
33
75
  - Load Jars with jar-dependencies instead of lock_jar gem
34
76
  - Make Weka::Core::Instances#instance_from public
35
77
 
36
78
  ### Fixed
79
+
37
80
  - Weka::UnassignedTrainingInstancesError when running #classify/#cluster and
38
81
  #distribution_for on deserialized classfiers and clusterers
39
82
 
40
-
41
83
  ## [0.5.0] – 2017-06-17
84
+
42
85
  ### Added
86
+
43
87
  - #to_m (to Matrix) method for Weka::Core::Instances
44
88
  - Curve classes in Weka::Classifiers::Evaluation module
45
89
  - Allow including additional modules on class building
46
90
  - Rubocop config for project
47
91
 
48
92
  ### Changed
93
+
49
94
  - Allow passing a hash to Weka::Core::Instances#add_instance
50
95
 
51
96
  ### Removed
52
- - Block argument in Weka::Core::Instances#initialize
53
97
 
98
+ - Block argument in Weka::Core::Instances#initialize
54
99
 
55
100
  ## [0.4.0] – 2016-12-22
101
+
56
102
  ### Added
103
+
57
104
  - C45 converters
58
105
  - Full support for string attributes
59
106
 
60
107
  ### Removed
61
- - ActiveSupport as dependency
62
108
 
109
+ - ActiveSupport as dependency
63
110
 
64
111
  ## [0.3.0] – 2016-02-10
112
+
65
113
  ### Added
114
+
66
115
  - Allow adding Instances with missing values
67
116
  - Allow creating DenseInstances with missing values
68
117
  - #merge method for Weka::Core:Instances
69
118
 
70
-
71
119
  ## [0.2.0] – 2016-01-19
120
+
72
121
  ### Added
122
+
73
123
  - Serialization/deserialization functionality
74
124
  - #apply_filters method for Weka::Core::Instances
75
125
 
76
-
77
126
  ## [0.1.0] – 2015-12-26
127
+
78
128
  Initial release
79
129
 
80
- [Unreleased]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.1...HEAD
130
+ [unreleased]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.4...HEAD
131
+ [0.7.4]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.3...v0.7.4
132
+ [0.7.3]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.2...v0.7.3
133
+ [0.7.2]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.1...v0.7.2
81
134
  [0.7.1]: https://github.com/paulgoetze/weka-jruby/compare/v0.7.0...v0.7.1
82
135
  [0.7.0]: https://github.com/paulgoetze/weka-jruby/compare/v0.6.0...v0.7.0
83
136
  [0.6.0]: https://github.com/paulgoetze/weka-jruby/compare/v0.5.0...v0.6.0
@@ -85,4 +138,5 @@ Initial release
85
138
  [0.4.0]: https://github.com/paulgoetze/weka-jruby/compare/v0.3.0...v0.4.0
86
139
  [0.3.0]: https://github.com/paulgoetze/weka-jruby/compare/v0.2.0...v0.3.0
87
140
  [0.2.0]: https://github.com/paulgoetze/weka-jruby/compare/v0.1.0...v0.2.0
88
- [0.1.0]: https://github.com/paulgoetze/weka-jruby/compare/ce6a985017c28ea755290a9baba4d81acddc2d20...v0.1.0
141
+ [0.1.0]:
142
+ https://github.com/paulgoetze/weka-jruby/compare/ce6a985017c28ea755290a9baba4d81acddc2d20...v0.1.0
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,13 +1,78 @@
1
- # Contributor Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
3
+ ## Our Pledge
4
4
 
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and
9
+ expression, level of experience, education, socio-economic status, nationality,
10
+ personal appearance, race, religion, or sexual identity and orientation.
6
11
 
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
12
+ ## Our Standards
8
13
 
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
10
16
 
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
12
22
 
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or reject
41
+ comments, commits, code, wiki edits, issues, and other contributions that are
42
+ not aligned to this Code of Conduct, or to ban temporarily or permanently any
43
+ contributor for other behaviors that they deem inappropriate, threatening,
44
+ offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at paul.christoph.goetze@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an
62
+ incident. Further details of specific enforcement policies may be posted
63
+ separately.
64
+
65
+ Project maintainers who do not follow or enforce the Code of Conduct in good
66
+ faith may face temporary or permanent repercussions as determined by other
67
+ members of the project's leadership.
68
+
69
+ ## Attribution
70
+
71
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72
+ version 1.4, available at
73
+ https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
74
+
75
+ [homepage]: https://www.contributor-covenant.org
76
+
77
+ For answers to common questions about this code of conduct, see
78
+ https://www.contributor-covenant.org/faq
data/MIT-LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2018 Paul Götze
1
+ Copyright (c) 2015-2022 Paul Götze
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Weka
2
2
 
3
+ [![Build Status](https://github.com/paulgoetze/weka-jruby/workflows/JRuby%20CI/badge.svg)](https://github.com/paulgoetze/weka-jruby/workflows/JRuby%20CI/badge.svg)
3
4
  [![Gem Version](https://badge.fury.io/rb/weka.svg)](http://badge.fury.io/rb/weka)
4
- [![Travis Build](https://travis-ci.org/paulgoetze/weka-jruby.svg)](https://travis-ci.org/paulgoetze/weka-jruby)
5
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/9634a6709ef545198e079a8daddff100)](https://www.codacy.com/app/paul-christoph-goetze/weka-jruby?utm_source=github.com&utm_medium=referral&utm_content=paulgoetze/weka-jruby&utm_campaign=Badge_Grade)
6
- [![Open Source Helpers](https://www.codetriage.com/paulgoetze/weka-jruby/badges/users.svg)](https://www.codetriage.com/paulgoetze/weka-jruby)
7
5
 
8
- Machine Learning & Data Mining with JRuby based on the [Weka](http://www.cs.waikato.ac.nz/~ml/weka/index.html) Java library.
6
+ Machine Learning & Data Mining with JRuby based on the
7
+ [Weka](http://www.cs.waikato.ac.nz/~ml/weka/index.html) Java library.
9
8
 
10
9
  ## Installation
11
10
 
@@ -31,47 +30,66 @@ Use Weka's Machine Learning and Data Mining algorithms by requiring the gem:
31
30
  require 'weka'
32
31
  ```
33
32
 
34
- The weka gem tries to carry over the namespaces defined in Weka and enhances some interfaces in order to allow a more Ruby-ish programming style when using the Weka library.
33
+ The weka gem tries to carry over the namespaces defined in Weka and enhances
34
+ some interfaces in order to allow a more Ruby-ish programming style when using
35
+ the Weka library.
35
36
 
36
- The idea behind keeping the namespaces is, that you can also use the [Weka documentation](http://weka.sourceforge.net/doc.dev/) for looking up functionality and classes.
37
+ The idea behind keeping the namespaces is, that you can also use the
38
+ [Weka documentation](http://weka.sourceforge.net/doc.dev/) for looking up
39
+ functionality and classes.
37
40
 
38
- Please refer to [the gem’s Wiki](https://github.com/paulgoetze/weka-jruby/wiki) for
39
- detailed information about how to use weka with JRuby and some examplary code snippets.
41
+ Please refer to [the gem’s Wiki](https://github.com/paulgoetze/weka-jruby/wiki)
42
+ for detailed information about how to use weka with JRuby and some examplary
43
+ code snippets.
40
44
 
41
45
  ## Development
42
46
 
43
47
  1. Check out the repo with `git clone git@github.com:paulgoetze/weka-jruby.git`.
44
- 2. Set a local environment variable `export JARS_VENDOR=false`.
45
- This will prevent
46
- compiling the jars into your repo’s /lib directory and will load them from your local maven repository instead.
47
- See the [jar-dependencies README](https://github.com/mkristian/jar-dependencies#for-development-you-do-not-need-to-vendor-the-jars-at-all) for more information.
48
+ 2. Set a local environment variable `export JARS_VENDOR=false`. This will
49
+ prevent compiling the jars into your repo’s /lib directory and will load them
50
+ from your local maven repository instead. See the
51
+ [jar-dependencies README](https://github.com/mkristian/jar-dependencies#for-development-you-do-not-need-to-vendor-the-jars-at-all)
52
+ for more information.
48
53
  3. Run `bin/setup` or `bundle install` to install the dependencies.
49
54
 
50
- Then, run `rake spec` to run the tests. You can also run `bin/console` or `rake irb` for an interactive prompt that will allow you to experiment.
55
+ Then, run `rake spec` to run the tests. You can also run `bin/console` or
56
+ `rake irb` for an interactive prompt that will allow you to experiment.
51
57
 
52
58
  ## Contributing
53
59
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/paulgoetze/weka-jruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant code of conduct](http://contributor-covenant.org/version/1/2/0).
60
+ Bug reports and pull requests are welcome on GitHub at
61
+ https://github.com/paulgoetze/weka-jruby. This project is intended to be a safe,
62
+ welcoming space for collaboration, and contributors are expected to adhere to
63
+ the
64
+ [Contributor Covenant Code of Conduct](https://github.com/paulgoetze/weka-jruby/blob/main/CODE_OF_CONDUCT.md).
55
65
 
56
- For development we use the [git branching model](http://nvie.com/posts/a-successful-git-branching-model/) described by [nvie](https://github.com/nvie).
66
+ For development we use the
67
+ [git branching model](http://nvie.com/posts/a-successful-git-branching-model/)
68
+ described by [nvie](https://github.com/nvie).
57
69
 
58
70
  Here’s how to contribute:
59
71
 
60
- 1. Fork it ( https://github.com/paulgoetze/weka-jruby/fork )
72
+ 1. Fork it (https://github.com/paulgoetze/weka-jruby/fork)
61
73
  2. Create your feature branch (`git checkout -b feature/my-new-feature develop`)
62
74
  3. Commit your changes (`git commit -am 'Add some feature'`)
63
75
  4. Push to the branch (`git push origin feature/my-new-feature`)
64
76
  5. Create a new Pull Request
65
77
 
66
- Please try to add RSpec tests along with your new features. This will ensure that your code does not break existing functionality and that your feature is working as expected.
78
+ Please try to add RSpec tests along with your new feature. This will ensure that
79
+ your code does not break existing functionality and that your feature is working
80
+ as expected.
67
81
 
68
- We use [Rubocop](https://github.com/bbatsov/rubocop) for code style recommendations.
69
- Please make sure your contributions comply with the project’s Rubocop config.
82
+ We use [Rubocop](https://github.com/bbatsov/rubocop) for code style
83
+ recommendations. Please make sure your contributions comply with the project’s
84
+ Rubocop config.
70
85
 
71
86
  ## Acknowledgement
72
87
 
73
- The original ideas for wrapping Weka in JRuby come from [@arrigonialberto86](https://github.com/arrigonialberto86) and his [ruby-band](https://github.com/arrigonialberto86/ruby-band) gem. Great thanks!
88
+ The original ideas for wrapping Weka in JRuby come from
89
+ [@arrigonialberto86](https://github.com/arrigonialberto86) and his
90
+ [ruby-band](https://github.com/arrigonialberto86/ruby-band) gem. Great thanks!
74
91
 
75
92
  ## License
76
93
 
77
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
94
+ The gem is available as open source under the terms of the
95
+ [MIT License](https://github.com/paulgoetze/weka-jruby/blob/main/MIT-LICENSE.txt).
@@ -88,6 +88,7 @@ module Weka
88
88
 
89
89
  def include_utils
90
90
  return unless utils_defined?
91
+
91
92
  "include #{utils}"
92
93
  end
93
94
 
@@ -116,6 +117,7 @@ module Weka
116
117
 
117
118
  def downcase_first_char(string)
118
119
  return if string.nil? || string.empty?
120
+
119
121
  string[0].downcase + string[1..-1]
120
122
  end
121
123
  end
@@ -81,8 +81,7 @@ module Weka
81
81
  java_import 'java.util.Random'
82
82
  include Checks
83
83
 
84
- attr_reader :training_instances
85
- attr_reader :instances_structure
84
+ attr_reader :training_instances, :instances_structure
86
85
 
87
86
  def train_with_instances(instances)
88
87
  ensure_class_attribute_assigned!(instances)
@@ -66,8 +66,7 @@ module Weka
66
66
  module Buildable
67
67
  include Checks
68
68
 
69
- attr_reader :training_instances
70
- attr_reader :instances_structure
69
+ attr_reader :training_instances, :instances_structure
71
70
 
72
71
  def train_with_instances(instances)
73
72
  @training_instances = instances
@@ -29,10 +29,10 @@ module Weka
29
29
 
30
30
  private
31
31
 
32
- def join_options(*single_options, **hash_options)
32
+ def join_options(single_options, hash_options)
33
33
  [
34
- join_single_options(*single_options),
35
- join_hash_options(**hash_options)
34
+ join_single_options(single_options),
35
+ join_hash_options(hash_options)
36
36
  ].reject(&:empty?).join(' ')
37
37
  end
38
38
 
@@ -18,17 +18,19 @@ module Weka
18
18
  enumerate_attributes.to_a
19
19
  end
20
20
 
21
- def each_attribute
21
+ def each_attribute(&block)
22
22
  if block_given?
23
- enumerate_attributes.each { |attribute| yield(attribute) }
23
+ enumerate_attributes.each(&block)
24
24
  else
25
25
  enumerate_attributes
26
26
  end
27
27
  end
28
28
 
29
- def each_attribute_with_index
30
- enumerate_attributes.each_with_index do |attribute, index|
31
- yield(attribute, index) if block_given?
29
+ def each_attribute_with_index(&block)
30
+ if block_given?
31
+ enumerate_attributes.each_with_index(&block)
32
+ else
33
+ enumerate_attributes
32
34
  end
33
35
  end
34
36
 
@@ -59,9 +59,8 @@ module Weka
59
59
  def attributes(include_class_attribute: false)
60
60
  attrs = enumerate_attributes.to_a
61
61
 
62
- if include_class_attribute && class_attribute_defined?
63
- attrs.insert(class_index, class_attribute)
64
- end
62
+ class_available = include_class_attribute && class_attribute_defined?
63
+ attrs.insert(class_index, class_attribute) if class_available
65
64
 
66
65
  attrs
67
66
  end
@@ -99,31 +98,35 @@ module Weka
99
98
  check_for_attribute_type(type)
100
99
  end
101
100
 
102
- def each
101
+ def each(&block)
103
102
  if block_given?
104
- enumerate_instances.each { |instance| yield(instance) }
103
+ enumerate_instances.each(&block)
105
104
  else
106
105
  enumerate_instances
107
106
  end
108
107
  end
109
108
 
110
- def each_with_index
111
- enumerate_instances.each_with_index do |instance, index|
112
- yield(instance, index) if block_given?
109
+ def each_with_index(&block)
110
+ if block_given?
111
+ enumerate_instances.each_with_index(&block)
112
+ else
113
+ enumerate_instances
113
114
  end
114
115
  end
115
116
 
116
- def each_attribute
117
+ def each_attribute(&block)
117
118
  if block_given?
118
- enumerate_attributes.each { |attribute| yield(attribute) }
119
+ enumerate_attributes.each(&block)
119
120
  else
120
121
  enumerate_attributes
121
122
  end
122
123
  end
123
124
 
124
- def each_attribute_with_index
125
- enumerate_attributes.each_with_index do |attribute, index|
126
- yield(attribute, index) if block_given?
125
+ def each_attribute_with_index(&block)
126
+ if block_given?
127
+ enumerate_attributes.each_with_index(&block)
128
+ else
129
+ enumerate_attributes
127
130
  end
128
131
  end
129
132
 
@@ -306,9 +309,7 @@ module Weka
306
309
  end
307
310
 
308
311
  def ensure_attribute_defined!(name)
309
- if attribute_names(include_class_attribute: true).include?(name.to_s)
310
- return
311
- end
312
+ return if attribute_names(include_class_attribute: true).include?(name.to_s)
312
313
 
313
314
  error = "\"#{name}\" is not defined."
314
315
  hint = 'Only defined attributes can be used as class attribute!'
@@ -325,6 +326,7 @@ module Weka
325
326
 
326
327
  def map_attribute_type(type)
327
328
  return -1 unless Attribute::TYPES.include?(type.downcase.to_sym)
329
+
328
330
  Attribute.const_get(type.upcase)
329
331
  end
330
332
 
data/lib/weka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Weka
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.7.4'.freeze
3
3
  end
data/weka.gemspec CHANGED
@@ -18,16 +18,15 @@ Gem::Specification.new do |spec|
18
18
  spec.platform = 'java'
19
19
  spec.required_ruby_version = '~> 2.0'
20
20
 
21
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.files = Dir['**/{.*,*}'].reject { |f| f.match(%r{^((spec|jars|pkg)/|.*\.lock|lib/.*_jars\.rb)}) || File.directory?(f) }
22
22
  spec.bindir = 'bin'
23
23
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 1.6'
27
- spec.add_development_dependency 'rake', '~> 12.0'
28
- spec.add_development_dependency 'rspec', '~> 3.0'
29
- spec.add_development_dependency 'shoulda-matchers', '~> 3.0'
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.11'
30
29
 
31
- spec.add_runtime_dependency 'jar-dependencies', '~> 0.4'
32
- spec.requirements << 'jar nz.ac.waikato.cms.weka, weka-dev, 3.9.3'
30
+ spec.add_runtime_dependency 'jar-dependencies', '~> 0.4.1'
31
+ spec.requirements << 'jar nz.ac.waikato.cms.weka, weka-dev, 3.9.6'
33
32
  end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.4
5
5
  platform: java
6
6
  authors:
7
7
  - Paul Götze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-08 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '1.6'
18
+ version: '2.0'
19
19
  name: bundler
20
20
  prerelease: false
21
21
  type: :development
@@ -23,13 +23,13 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '12.0'
32
+ version: '13.0'
33
33
  name: rake
34
34
  prerelease: false
35
35
  type: :development
@@ -37,13 +37,13 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '3.0'
46
+ version: '3.11'
47
47
  name: rspec
48
48
  prerelease: false
49
49
  type: :development
@@ -51,27 +51,13 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '3.11'
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '3.0'
61
- name: shoulda-matchers
62
- prerelease: false
63
- type: :development
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.4'
60
+ version: 0.4.1
75
61
  name: jar-dependencies
76
62
  prerelease: false
77
63
  type: :runtime
@@ -79,7 +65,7 @@ dependencies:
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '0.4'
68
+ version: 0.4.1
83
69
  description: A JRuby wrapper for the Weka library (http://www.cs.waikato.ac.nz/ml/weka/)
84
70
  email:
85
71
  - paul.christoph.goetze@gmail.com
@@ -92,7 +78,6 @@ files:
92
78
  - ".gitignore"
93
79
  - ".rspec"
94
80
  - ".rubocop.yml"
95
- - ".travis.yml"
96
81
  - CHANGELOG.md
97
82
  - CODE_OF_CONDUCT.md
98
83
  - Gemfile
@@ -162,9 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
147
  - !ruby/object:Gem::Version
163
148
  version: '0'
164
149
  requirements:
165
- - jar nz.ac.waikato.cms.weka, weka-dev, 3.9.3
166
- rubyforge_project:
167
- rubygems_version: 2.7.6
150
+ - jar nz.ac.waikato.cms.weka, weka-dev, 3.9.6
151
+ rubygems_version: 3.2.29
168
152
  signing_key:
169
153
  specification_version: 4
170
154
  summary: Machine Learning & Data Mining with JRuby.
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - jruby-9.0.1.0
5
- - jruby-9.1.0.0
6
- - jruby-9.2.0.0
7
- - jruby-head