Skip to content

Commit

Permalink
Cleanup, add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanstout committed Apr 23, 2012
1 parent d822419 commit 084aac2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.rdoc
@@ -1,3 +1,6 @@
# Run WEKA gui (loads with liblinear and libsvm and more Java heap)
./lib/weka.sh

# Train model
jruby -J-server -J-Xmx2000m -S lib/sentiment/train.rb

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/sentiments_controller.rb
Expand Up @@ -24,6 +24,7 @@ class SentimentsController < ApplicationController
def index
end

# Loads in the arff, model, and dataset
def setup_classifier
unless @classifier
arff_path = Rails.root.join("data/sentiment.arff").to_s
Expand All @@ -42,6 +43,7 @@ def setup_classifier
end
end

# Prints out the form and the estimated pos/neg value
def create
setup_classifier

Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Expand Up @@ -30,7 +30,7 @@
config.action_mailer.delivery_method = :test

# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# config.active_record.mass_assignment_sanitizer = :strict

# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
Expand Down
2 changes: 2 additions & 0 deletions lib/sentiment/example_query.rb
@@ -1,3 +1,5 @@
# Example of how to query a model that is already built

arff_path = Rails.root.join("data/sentiment.arff").to_s
arff = FileReader.new(arff_path)

Expand Down
6 changes: 3 additions & 3 deletions lib/sentiment/train.rb
@@ -1,6 +1,9 @@
# jruby -J-server -J-Xmx4000m -S train.rb
# Build status info cache model averages after


# http://weka.wikispaces.com/Use+WEKA+in+your+Java+code

# Load java libs
require 'java'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'weka-3-7-5', 'weka.jar'))
Expand All @@ -10,9 +13,6 @@
require File.expand_path(File.join(File.dirname(__FILE__), '/../weka-3-7-5/packages/packages/LibSVM/lib/libsvm.jar'))
require File.expand_path(File.join(File.dirname(__FILE__), '/../weka-3-7-5/packages/packages/LibLINEAR/lib/liblinear-1.8.jar'))


# http://weka.wikispaces.com/Use+WEKA+in+your+Java+code

# Include classes
include_class "weka.core.Instances"
include_class "weka.core.Instance"
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -7,7 +7,7 @@ class ActiveSupport::TestCase
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# fixtures :all

# Add more helper methods to be used by all tests here...
end

0 comments on commit 084aac2

Please sign in to comment.