Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Artificial Intelligence and Machine Learning Programs in Ruby

Reply
Thread Tools

Artificial Intelligence and Machine Learning Programs in Ruby

 
 
Ryosuke Kadoi
Guest
Posts: n/a
 
      11-28-2003
Hi All,

Does anyone know artificial intelligence and machine learning programs
implemented in Ruby? I'm trying to implement either a hidden markov or
artificial neural network in Ruby? But I would like to know anyone who has
done this before. These kinds of programs usually are implememented in C++
or Java though. If you know any information regarding this matter, please
let me know any examples or websites (English or Japanese websites).

Also, if you are interested in bioinformatics from machine learning
standpoint with Ruby, please let me know any information.

Thanks,

Ryosuke


 
Reply With Quote
 
 
 
 
Simon Strandgaard
Guest
Posts: n/a
 
      11-28-2003
On Sat, 29 Nov 2003 03:37:47 +0900, Ryosuke Kadoi wrote:

> Does anyone know artificial intelligence and machine learning programs
> implemented in Ruby?


There seems to be 8 AI-ruby projects:
http://raa.ruby-lang.org/cat.rhtml?c...egory_minor=AI


I don't know if this is useful?
http://raa.ruby-lang.org/cat.rhtml?c...gory_minor=Bio

--
Simon Strandgaard
 
Reply With Quote
 
 
 
 
Michael Neumann
Guest
Posts: n/a
 
      11-28-2003
On Sat, Nov 29, 2003 at 03:37:47AM +0900, Ryosuke Kadoi wrote:
> Hi All,
>
> Does anyone know artificial intelligence and machine learning programs
> implemented in Ruby? I'm trying to implement either a hidden markov or
> artificial neural network in Ruby? But I would like to know anyone who has
> done this before. These kinds of programs usually are implememented in C++
> or Java though. If you know any information regarding this matter, please
> let me know any examples or websites (English or Japanese websites).


There's libneural and rbsnns:

http://raa.ruby-lang.org/list.rhtml?name=libneural
http://raa.ruby-lang.org/list.rhtml?name=rbsnns

But they are interfaces to C libraries. Maybe that's not what you want.

Regards,

Michael


 
Reply With Quote
 
Akimichi Tatsukawa
Guest
Posts: n/a
 
      11-29-2003
Hi

kadoism> Does anyone know artificial intelligence and machine learning programs
kadoism> implemented in Ruby? I'm trying to implement either a hidden markov or
kadoism> artificial neural network in Ruby? But I would like to know anyone who has

How about LibNeural?
It is implemented in C++ and wrapped by swing, not a pure ruby script, though.

Regards,
Aki
--------------------------------------------------------
Name: 立川察理 Akimichi Tatsukawa
Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
Web: http://akimichi.homeunix.net/~emile/


 
Reply With Quote
 
Kenta MURATA
Guest
Posts: n/a
 
      11-30-2003
Hi, Ryosuke

In message <(E-Mail Removed)> at Sat, 29 Nov 2003 03:37:47 +0900,
"Ryosuke Kadoi" <(E-Mail Removed)> wrote:
> Also, if you are interested in bioinformatics from machine learning
> standpoint with Ruby, please let me know any information.


I try to write Sarsa in Ruby. Follwing code is implementation
''Example 6.5'' of Section 6.4 in [1].

----
#! /usr/bin/env ruby

WIND = [ 0, 0, 0, 1, 1, 1, 2, 2, 1, 0 ]
N = 1000
EPSILON = 0.1
ALPHA = 0.1
GAMMA = 1.0

# action-value function table
class Q
def [](state, a)
@table[[state, a]]
end

def []=(state, a, v)
@table[[state, a]] = v
end

def state_collect(state)
ary = @table.collect{|k, v| k[0] == state ? [k[1], v] : nil }
ary.compact!
ary
end

def initialize(v=0.0)
@table = {}
(0..6).each do |y|
(0..9).each do |x|
[ :up, :down, :right, :left ].each do |a|
@table[[[x, y], a]] = v
end
end
end
end
end

# epsilon-greedy policy function
def epsilon_greedy(q, state, epsilon=EPSILON)
ary = q.state_collect(state)
if epsilon >= rand then
## search
ary[rand(ary.length)][0]
else
## greedy
ary.max{|a, b| a[1] <=> b[1]}[0]
end
end

# environment
def do_action(state, action)
state = state.dup
case action
when :up
state[1] -= 1
when :down
state[1] += 1
when :left
state[0] -= 1
when :right
state[0] += 1
end
state[1] -= WIND[state[0]] if 0 <= state[0] and state[0] <= 9
state[0] = [[0, state[0]].max, 9].min
state[1] = [[0, state[1]].max, 6].min
return [state, -1]
end

q = Q.new
N.times do |n|
state = [0, 3]

step = 0
action = epsilon_greedy(q, state)
until state == [7, 3] do
next_state, reward = do_action(state, action)
next_action = epsilon_greedy(q, next_state)
q[state, action] += ALPHA*(reward + GAMMA*q[next_state, next_action] - q[state, action])
state = next_state
action = next_action
step += 1
end

puts "#{n} #{step}" # output the count of episode and time-step
STDOUT.flush
end

# greedy (for evaluate action-value function)
step = 0
state = [0, 3]
action = epsilon_greedy(q, state, 0.0)
until state == [7, 3] do
next_state, reward = do_action(state, action)
next_action = epsilon_greedy(q, next_state, 0.0)
state = next_state
action = next_action
step += 1
end
puts "# greedy policy #{step}"
STDOUT.flush
----

If very well, I would like to move to ruby-list because I'm
not good at English. Maybe I'm good for you if use Japanese.

[1] Richard S. Sutton and Andrew G. Barto, Reinforcement
Learning: An Introduction, MIT Press, Cambridge, MA, 1998,
http://www-anw.cs.umass.edu/~rich/book/the-book.html.

--
1024D/2A3FDBE6 2001-08-26 Kenta MURATA (muraken) <(E-Mail Removed)>
Key fingerprint = 622A 61D3 280F 4991 4833 5724 8E2D C5E1 2A3F DBE6

 
Reply With Quote
 
Tom Copeland
Guest
Posts: n/a
 
      12-01-2003
On Fri, 2003-11-28 at 13:37, Ryosuke Kadoi wrote:
> Hi All,
>
> Does anyone know artificial intelligence and machine learning programs
> implemented in Ruby? I'm trying to implement either a hidden markov or
> artificial neural network in Ruby? But I would like to know anyone who has
> done this before. These kinds of programs usually are implememented in C++
> or Java though. If you know any information regarding this matter, please
> let me know any examples or websites (English or Japanese websites).


You might find this interesting:

http://ai-app-prog.rubyforge.org/

It's a translation of the C examples in M. Tim Jones' "AI Application
Programming" to Ruby.

Yours,

tom


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby & Artificial Intelligence Pranjal Jain Ruby 11 04-28-2008 02:18 PM
"Next Generation Artificial Intelligence, Artificial Mind - Part One - Basic Architecture and Cognitive Structure" tommak Java 2 07-04-2006 06:03 PM
"Next Generation Artificial Intelligence, Artificial Mind - Part One - Basic Architecture and Cognitive Structure" tommak Python 1 07-04-2006 09:34 AM
"Next Generation Artificial Intelligence, Artificial Mind - Part One - Basic Architecture and Cognitive Structure" tommak C++ 0 07-04-2006 05:27 AM
CFP: Artificial Intelligence in Information Assurance and Security Ranadhir ghosh Computer Security 0 04-06-2006 12:43 PM



Advertisments