Giter Site home page Giter Site logo

ruby-mining's Introduction

ruby-mining

Data mining and machine learning algorithms for Ruby

Installation instructions

Install ‘bundle’ for JRuby before trying to install the ‘ruby-mining’ gem. Maven is also required for .jars automatic download and installation. On Ubuntu/Debian Maven should already be installed and on OSX system you can get it from Brew

If you want to use ‘ruby-mining’ APIs without installing the gem you need to run command ‘rake -T’ once before requiring the gem in your script (this is necessary for jbundler to download the ‘.jar’ files and subsequently set the Java classpath)

Contributing to ruby-mining

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 arrigonialberto86. See LICENSE.txt for further details.

ruby-mining's People

Contributors

arrigonialberto86 avatar wstrinz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

wstrinz

ruby-mining's Issues

Use require_relative and generate a module variable to store base path of your gem

Since ruby 1.9.3, the preferred way to require interval files is use require_relative.
On ruby_mining.rb you should use something like

  require_relative "ruby_mining/core"
  require_relative "ruby_mining/weka"
  require_relative "ruby_mining/apache"

When I run cucumber, jruby can't load the resources without a full filename. In weka_classifiers.rb, I have to use something like

  @arff = File.expand_path(File.dirname(__FILE__)+"/../../"+File.join('resources',arg1))

to make it works. You could create a module RubyMining on ruby_mining.rb and define a method which retrieves the base directory of your library, with something like

def base_dir
  File.expand_path(File.dirname(__FILE__)+"/../")
end

Minor indentation and ruby practice issues

There seems to be some misalignment in your code indentation. eg: this and this file(here, only module Clusterer seems out of place).

I commented a thing or two here: 5d0ee96
Maybe you should your definition below by using Ruby's #map ability:

def list_options
    options = ''
    listOptions.each {|key| options="#{options}\n#{key.synopsis} #{key.description}"}
    options
end

by this:

def list_options
  listOptions.map {|key| "#{key.synopsis} #{key.description}"}.join("\n")}
end

Also mentioned about using :alias, which may be useful.

Everything else seems great! 👍

Maybe using spaces consistently instead of mixing with tabs?

Although I'm not quite familiar with Weka or JRuby, the structures of the two files bayes.rb and bayes_utils.rb look quite clear to me.

Just one thing, the indentations used in these files seem to be inconsistent with each other, as well as other files (such as those in core/). This imposed slight difficulty when reading the code in the first place.

Abstract initialization of your code

On many classes, the initialize method is always the same

          def initialize
            super
            set_options(self.class.options) if self.class.options 
            self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
            buildClassifier(self.class.data)
          end

You should create a base module, like RubyMining, with a method that run this procedure
Example:

        module RubyMining
        def init_classifier
            super
            set_options(self.class.options) if self.class.options 
            self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
            buildClassifier(self.class.data)
         end
         end
         class Base < NaiveBayes
         include ::RubyMining
         def initialize
         super
          init_classifier
         end
         end

Ignore pkg directory

there is no need to keep track of pkg directory and gem with github.
Add .gitignore file excluding pkg directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.