Skip to content

Commit

Permalink
scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Asmuth committed Jan 29, 2012
1 parent 2f68d08 commit 3d876a3
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source :rubygems

group :development do
gem "rake"
gem "rspec"
gem "yard"
end
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
rake (0.9.2.2)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
yard (0.7.4)

PLATFORMS
ruby

DEPENDENCIES
rake
rspec
yard
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "rubygems"
require "rspec"
require 'rspec/core/rake_task'
require "yard"

desc "Run all examples"
task RSpec::Core::RakeTask.new('spec')

task :default => "spec"

desc "Generate documentation"
task YARD::Rake::YardocTask.new
4 changes: 4 additions & 0 deletions lib/recommendify.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Recommendify; end

require "recommendify/similarity_matrix"
require "recommendify/jaccard_processor"
7 changes: 7 additions & 0 deletions lib/recommendify/jaccard_processor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Recommendify::JaccardProcessor

def initialize(opts={})

end

end
7 changes: 7 additions & 0 deletions lib/recommendify/similarity_matrix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Recommendify::SimilarityMatrix

def self.method_missing(method, *args)
puts method
end

end
6 changes: 6 additions & 0 deletions spec/similarity_matrix_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require ::File.expand_path('../spec_helper', __FILE__)

describe Recommendify::SimilarityMatrix do


end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "rspec"
require ::File.expand_path('../../lib/recommendify', __FILE__)
17 changes: 12 additions & 5 deletions test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
$: << ::File.expand_path("../lib", __FILE__)
require "recommendify"

class RecommendedProfiles < Recommendify::Base
class UserRecommender < Recommendify::SimilarityMatrix

max_neighbors 50

processor :visits,
:similarity_func => :jaccard
end

RecommendedProfiles.reset_matrix!

buckets = Hash.new{ |h,k| h[k]=[] }

Expand All @@ -12,8 +18,9 @@ class RecommendedProfiles < Recommendify::Base
end

buckets.each do |user_id, items|
puts "#{user_id} -> #{items.join(",")}"
RecommendedProfiles.add_interactions(items)
next if user_id.length == 0
puts "#{user_id} -> #{items.join(",")}"
UserRecommender.visits.add_set(user_id, items)
end

RecommededProfiles.process!
UserRecommender.process!

0 comments on commit 3d876a3

Please sign in to comment.