associative_memory 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +55 -53
- data/lib/associative_memory.rb +2 -2
- metadata +14 -21
data/README.rdoc
CHANGED
@@ -1,109 +1,111 @@
|
|
1
|
-
|
1
|
+
= Associative Memory
|
2
2
|
|
3
3
|
http://dann.stayskal.com/software/associative_memory
|
4
4
|
|
5
|
-
|
5
|
+
== Description
|
6
6
|
|
7
7
|
This is a ruby gem that lets you implement categorization systems with ease.
|
8
8
|
|
9
|
-
|
9
|
+
Associative memory neural networks make it easy to identify probable patterns between sets of named data points. It can be cumbersome to interface with the neural network directly, however, as a typical implementation has a fixed size and training period, which limits how useful they can be to an integrated system.
|
10
10
|
|
11
|
-
associative_memory simplifies these kind of machine learning models by offering
|
11
|
+
associative_memory simplifies these kind of machine learning models by offering dynamic input and output sets. This allows your code to concentrate on extrapolating meaningful patterns rather than juggling bitmasks and transposition matrices.
|
12
12
|
|
13
|
-
|
13
|
+
== Synopsis
|
14
14
|
|
15
|
-
|
15
|
+
First, you'll want to tell associative_memory what you know about the set of things you're dealing with:
|
16
16
|
|
17
|
-
|
17
|
+
require 'associative_memory'
|
18
|
+
@animals = AssociativeMemory.new
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@animals.associate([:arms, :legs], [:humans])
|
26
|
-
@animals.associate([:swimming], [:humans, :rats, :turtles])
|
27
|
-
@animals.associate([:running], [:humans, :rats, :cats])
|
20
|
+
@animals.associate( [:tail, :fur, :legs, :paws], [:cats, :rats])
|
21
|
+
@animals.associate( [:fins, :swimming], [:fish])
|
22
|
+
@animals.associate( [:tail, :shell], [:turtles])
|
23
|
+
@animals.associate( [:arms, :legs], [:humans])
|
24
|
+
@animals.associate( [:swimming], [:humans, :rats, :turtles])
|
25
|
+
@animals.associate( [:running], [:humans, :rats, :cats])
|
28
26
|
|
29
27
|
Once you've done that, you can start asking it questions about patterns you've told it about:
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@animals.describe([:tail]).should == [:cats, :rats, :fish, :turtles]
|
29
|
+
running_things = @animals.describe([:running])
|
30
|
+
[:cats, :rats, :humans].each do |thing|
|
31
|
+
running_things.should include(thing)
|
32
|
+
end
|
33
|
+
@animals.describe([:humans]).should == [:arms, :legs, :running, :swimming]
|
34
|
+
@animals.describe([:swimming]).should == [:rats, :fish, :humans, :turtles]
|
38
35
|
|
39
36
|
Furthermore, it will be able to extrapolate patterns from data not explicitly taught:
|
40
37
|
|
41
|
-
|
38
|
+
@animals.describe([:fish]).should include(:tail)
|
42
39
|
|
43
40
|
If you have more patterns to input, you can do it at any time:
|
44
41
|
|
45
|
-
|
46
|
-
|
42
|
+
@animals.associate([:jumping], [:humans, :rats, :cats])
|
43
|
+
@animals.describe([:humans]).should include(:jumping)
|
47
44
|
|
48
|
-
|
45
|
+
== Installation
|
49
46
|
|
50
47
|
When using RVM:
|
51
48
|
|
52
|
-
|
49
|
+
$ gem install associative_memory
|
53
50
|
|
54
51
|
When using Bundler:
|
55
52
|
|
56
|
-
|
57
|
-
|
53
|
+
# Add to your Gemfile
|
54
|
+
gem "associative_memory"
|
58
55
|
|
59
|
-
|
60
|
-
|
56
|
+
# Then install through Bundler
|
57
|
+
$ bundle install
|
61
58
|
|
62
59
|
Otherwise:
|
63
60
|
|
64
|
-
|
61
|
+
$ sudo gem install associative_memory
|
62
|
+
|
63
|
+
== TODO
|
65
64
|
|
66
|
-
|
65
|
+
* Implement detailed descriptions (likelihood of set membership based on non-bitmasked transpose products with the convergence matrix) (v.0.3)
|
66
|
+
* Streamline network class with Matrix rather than Array (v.0.4)
|
67
|
+
* Implement auto-associative neural network model (v.0.5)
|
67
68
|
|
68
|
-
|
69
|
-
* Streamline network class with Matrix rather than Array
|
69
|
+
== Maintenance
|
70
70
|
|
71
|
-
|
71
|
+
Under the hood, associative_memory implements a hetero-associative recurrent neural network designed according to Kosko's landmark paper (http://sipi.usc.edu/~kosko/BAM.pdf) establishing the model. The module then dynamically rebuilds and adapts this network to accomodate new inputs as they're presented.
|
72
72
|
|
73
73
|
If you would like to help maintain or improve this gem, I welcome your patches. The build environment of this gem is streamlined for test-driven development using bundler, rvm, rspec, and guard. To get it setup, you'll need to have Ruby Version Manager (http://beginrescueend.com/) installed, then do the following:
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
75
|
+
$ git clone git@github.com:danndalf/associative_memory
|
76
|
+
$ cd associative_memory
|
77
|
+
# ...and accept the .rvmrc
|
78
|
+
# have RVM build ruby 1.9 if necessary
|
79
|
+
$ gem install bundler
|
80
|
+
$ bundle install
|
81
|
+
$ bundle exec guard start
|
82
82
|
|
83
|
-
Once guard starts, it will run through the full test suite. After any changes are made to the libraries or specs, guard will re-run the relevant tests. To re-run the full test suite, press enter at
|
83
|
+
Once guard starts, it will run through the full test suite. After any changes are made to the libraries or specs, guard will re-run the relevant tests. To re-run the full test suite, press enter at the guard prompt.
|
84
84
|
|
85
|
-
After each test run,
|
85
|
+
After each test run, simplecov will generate a test coverage report in <code>coverage/index.html</code>. This should show 100% coverage across all files when running the full test suite.
|
86
86
|
|
87
87
|
If you would like to patch this gem:
|
88
88
|
|
89
89
|
* Fork this repository
|
90
|
-
* Write your tests
|
90
|
+
* Write your tests (regression or unit tests)
|
91
91
|
* Make your changes
|
92
|
-
* Once all tests are passing and
|
92
|
+
* Once all tests are passing and all files have full test coverage, commit and push your changes
|
93
93
|
* Send me a pull request
|
94
94
|
* Wait for me to respond
|
95
95
|
|
96
96
|
This will help me integrate your patch as quickly and reliably as possible.
|
97
97
|
|
98
|
-
If you'd rather report a bug, please
|
98
|
+
If you'd rather report a bug, please open an issue on github.
|
99
99
|
|
100
|
-
|
100
|
+
== Resources
|
101
101
|
|
102
102
|
* Support: http://dann.stayskal.com/software/associative_memory
|
103
103
|
|
104
|
-
* Source
|
104
|
+
* Source: http://github.com/danndalf/associative_memory
|
105
|
+
|
106
|
+
* Bug Tracker: https://github.com/danndalf/associative_memory/issues
|
105
107
|
|
106
|
-
|
108
|
+
== License
|
107
109
|
|
108
110
|
This module is available under The MIT License.
|
109
111
|
|
@@ -115,7 +117,7 @@ a copy of this software and associated documentation files (the
|
|
115
117
|
without limitation the rights to use, copy, modify, merge, publish,
|
116
118
|
distribute, sublicense, and/or sell copies of the Software, and to
|
117
119
|
permit persons to whom the Software is furnished to do so, subject to
|
118
|
-
|
120
|
+
rthe following conditions:
|
119
121
|
|
120
122
|
The above copyright notice and this permission notice shall be
|
121
123
|
included in all copies or substantial portions of the Software.
|
data/lib/associative_memory.rb
CHANGED
@@ -2,7 +2,7 @@ require 'associative_memory/network'
|
|
2
2
|
|
3
3
|
module AssociativeMemory
|
4
4
|
|
5
|
-
VERSION = '0.2.
|
5
|
+
VERSION = '0.2.1'
|
6
6
|
class << self
|
7
7
|
|
8
8
|
attr_accessor :associated_pairs, :network, :input_keyspace, :output_keyspace
|
@@ -88,4 +88,4 @@ module AssociativeMemory
|
|
88
88
|
self.network.matrix.map{|a| a.inspect}.join("\n") + "\n\n"
|
89
89
|
end
|
90
90
|
end
|
91
|
-
end
|
91
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: associative_memory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-26 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &27518280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *27518280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: newgem
|
27
|
-
requirement: &
|
27
|
+
requirement: &27517820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.5.3
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *27517820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hoe
|
38
|
-
requirement: &
|
38
|
+
requirement: &27517380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,27 +43,20 @@ dependencies:
|
|
43
43
|
version: '3.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *27517380
|
47
47
|
description: ! 'This is a ruby gem that lets you implement categorization systems
|
48
48
|
with ease.
|
49
49
|
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
Associative memory neural networks make it easy to identify probable patterns between
|
52
|
+
sets of named data points. It can be cumbersome to interface with the neural network
|
53
|
+
directly, however, as a typical implementation has a fixed size and training period,
|
54
|
+
which limits how useful they can be to an integrated system.
|
55
55
|
|
56
56
|
|
57
57
|
associative_memory simplifies these kind of machine learning models by offering
|
58
|
-
|
59
|
-
|
60
|
-
meaningful patterns rather than juggling bitmasks and transposition matrices.
|
61
|
-
|
62
|
-
|
63
|
-
Under the hood, associative_memory implements a hetero-associative recurrent neural
|
64
|
-
network designed according to Kosko''s landmark paper (http://sipi.usc.edu/~kosko/BAM.pdf)
|
65
|
-
establishing the model. The model then dynamically rebuilds and adapts this network
|
66
|
-
to accomodate new inputs as necessary.'
|
58
|
+
dynamic input and output sets. This allows your code to concentrate on extrapolating
|
59
|
+
meaningful patterns rather than juggling bitmasks and transposition matrices.'
|
67
60
|
email:
|
68
61
|
- dann@stayskal.com
|
69
62
|
executables: []
|