newral 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9047684d474438632d4eab4774fbb7b9debecc5
4
- data.tar.gz: 0d83a2232560366d75af79b848fbbb8ba358169d
3
+ metadata.gz: bf672d40895fe65b38d8c889a7097d917e2cee5d
4
+ data.tar.gz: 48485e1ae8a01a21872faabfeb1ba37dc4bb9c60
5
5
  SHA512:
6
- metadata.gz: 27e1bca6445adcc1d518d898e2e0e027d0d573eaba8bae588a9350a6d676d285afa549a9bc2a1ac07019f44645dc6cf8516b389069f50bf03ff8c3b322a0b0ea
7
- data.tar.gz: 505f5faa6a843b4b5ab9e2c6654f6a8c32aa692bcf73d5058f95b3167a30c649979f250bbb17720d119e06a4aae5a4224a6d40ee53931607ca5caca3a061f9ed
6
+ metadata.gz: 959edca123d309747764650211098e93426f4b718fb87e4fa0c6060e47ec4e6332299c2c9cea7586e8901fd600cfef1bb5a17240d25ce1ff0100d51a4d01a7a8
7
+ data.tar.gz: 7af4b2733bf287fa4efb3ddd9ce7e7641cc7bbe076c8c30eaa563a166b6ced77e9a958028031fcfa22b5d52f2beaeb7a0c3c87ccd5dfa55a4af1153470131743
@@ -1,7 +1,8 @@
1
1
  module Newral
2
2
 
3
3
  module Classifier
4
-
4
+
5
+ # https://en.wikipedia.org/wiki/Dendrogram
5
6
  class Dendogram
6
7
  attr_reader :nodes, :max_distance, :distances
7
8
  def initialize( points, max_runs: 100, abort_at_distance: 0.5 )
@@ -46,7 +46,9 @@ module Newral
46
46
  end
47
47
  end.flatten
48
48
  end
49
-
49
+
50
+ # a dendogram can produce very nested node sets, so you can also
51
+ # flatten them by converting them to a cluster
50
52
  def to_cluster
51
53
  points = flatten_points
52
54
  Data::Cluster.new( points: points.collect{|p| p.to_a } )
@@ -8,6 +8,7 @@ module Newral
8
8
  end
9
9
 
10
10
  class Idx < Base
11
+ # reads the MNIST data set fornat
11
12
  # http://yann.lecun.com/exdb/mnist/
12
13
  # used for Handwritten Images
13
14
  def initialize( file_name: nil, label_file_name: nil )
@@ -5,6 +5,8 @@ module Newral
5
5
  class NotImplemented < ::StandardError; end
6
6
  end
7
7
 
8
+ # the idea of having function classes is to have a common interface
9
+ # when the functions are optimized in training algorithms
8
10
  class Base
9
11
  attr_accessor :center
10
12
 
@@ -5,6 +5,8 @@ module Newral
5
5
  end
6
6
  attr_reader :calculate_block
7
7
  # as its ruby we of course have to also offer the possibility for blocks
8
+ # the block is called in calculate, always passing the current @params values
9
+ # however for more complex examples you should rather derive from Base
8
10
  class Block < Base
9
11
 
10
12
  def initialize( directions:0, params:[], &block )
@@ -19,7 +21,7 @@ module Newral
19
21
  end
20
22
 
21
23
  def move( direction: 0, step:0.01, step_percentage: nil )
22
- raise Errors::InvalidDirection unless direction >0 && direction<@directions
24
+ raise Errors::InvalidDirection unless direction >=0 && direction<@directions
23
25
  @params[direction]=(step_percentage ? @params[direction]*(1+step_percentage.to_f/100) : @params[direction]+step )
24
26
  self
25
27
  end
@@ -1,7 +1,7 @@
1
1
  module Newral
2
2
  module Functions
3
-
4
-
3
+
4
+ # line is very simple, easiest to start getting familiar with gradient descent
5
5
  class Line < Base
6
6
  attr_accessor :center
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newral
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - stefan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler