music_detector 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ba71bbdd7681ddbf73efa730ca882654a97e172
4
- data.tar.gz: 688ab862011e79aee2fd7198aa5aa49ade15b8b0
3
+ metadata.gz: 9d4347bc2aa7368840aeacbfea0d5f8988198d96
4
+ data.tar.gz: b91ba65982e25f962fe90da3714ce9a55f145c0b
5
5
  SHA512:
6
- metadata.gz: 664016744f6a149723cc517f93d9371dbda81ba6f7d4e0923d5f45a43282482a11444ee51f69586fa7552c840515a0521cb4bc759e4200ca79ba1f6bd5277dc9
7
- data.tar.gz: af52b72b02ed0dd5244a632b8bf4978b972b32b7194281aab937e010840f225621c783bbe61da874f264ab550f6a39bce28e7e6b65eb2795de0c290c4bfee932
6
+ metadata.gz: 62fa904711056d3c7a10d395f93ace2012f63cc4ad84cd4e527c01fab1b9e092b53160d39d0f9cedd834cc079a2fbd24c6ce9cb21babb708fd7a093edd0b32f3
7
+ data.tar.gz: ada725ee7a06c66c9946101aa46ff02a28c105fd6c8ebaab7d822819d84a5a657dc8d23e1dfba529997f474024b6d64678695a2616ccea3ad07f664f01681edc
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ *.gem
@@ -62,14 +62,21 @@ module MusicDetector
62
62
  model
63
63
  end
64
64
 
65
- # @param [NArray]
66
- def estimate(input)
67
- raise RuntimeError('the form of the input is differ from trained model') if @b.total - 1 != input.shape[0]
68
-
69
- x = NMatrix.float(input.shape[0] + 1, input.shape[1])
70
- (input.shape[1]).times do |i|
71
- x[0, i] = 1.0
72
- x[1..(input.shape[0]), i] = input[true, i].flatten
65
+ # @param [NArray] fvs array of input feature vector(s)
66
+ def estimate(fvs)
67
+ raise ArgumentError('the form of the input is differ from trained model') if @b.total - 1 != fvs.shape[0]
68
+
69
+ x = nil
70
+ if fvs.shape.length == 1
71
+ x = NMatrix.float(fvs.shape[0] + 1, 1)
72
+ x[0, 0] = 1.0
73
+ x[1..(fvs.shape[0]), 0] = fvs
74
+ else
75
+ x = NMatrix.float(fvs.shape[0] + 1, fvs.shape[1])
76
+ (fvs.shape[1]).times do |i|
77
+ x[0, i] = 1.0
78
+ x[1..(fvs.shape[0]), i] = fvs[true, i].flatten
79
+ end
73
80
  end
74
81
  x * @b
75
82
  end
@@ -1,3 +1,3 @@
1
1
  module MusicDetector
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{music detector}
13
13
  spec.description = %q{detects music on wave (.wav) file}
14
- spec.homepage = "https://github.com/sobataro/ruby-music-detector"
14
+ spec.homepage = "https://github.com/sobataro/ruby-music_detector"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: music_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sobataro
@@ -123,7 +123,7 @@ files:
123
123
  - lib/music_detector/multiple_linear_regression.rb
124
124
  - lib/music_detector/version.rb
125
125
  - music_detector.gemspec
126
- homepage: https://github.com/sobataro/ruby-music-detector
126
+ homepage: https://github.com/sobataro/ruby-music_detector
127
127
  licenses:
128
128
  - MIT
129
129
  metadata: {}