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 +4 -4
- data/.gitignore +1 -0
- data/lib/music_detector/multiple_linear_regression.rb +15 -8
- data/lib/music_detector/version.rb +1 -1
- data/music_detector.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d4347bc2aa7368840aeacbfea0d5f8988198d96
|
4
|
+
data.tar.gz: b91ba65982e25f962fe90da3714ce9a55f145c0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62fa904711056d3c7a10d395f93ace2012f63cc4ad84cd4e527c01fab1b9e092b53160d39d0f9cedd834cc079a2fbd24c6ce9cb21babb708fd7a093edd0b32f3
|
7
|
+
data.tar.gz: ada725ee7a06c66c9946101aa46ff02a28c105fd6c8ebaab7d822819d84a5a657dc8d23e1dfba529997f474024b6d64678695a2616ccea3ad07f664f01681edc
|
data/.gitignore
CHANGED
@@ -62,14 +62,21 @@ module MusicDetector
|
|
62
62
|
model
|
63
63
|
end
|
64
64
|
|
65
|
-
# @param [NArray]
|
66
|
-
def estimate(
|
67
|
-
raise
|
68
|
-
|
69
|
-
x =
|
70
|
-
|
71
|
-
x[0
|
72
|
-
x[
|
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
|
data/music_detector.gemspec
CHANGED
@@ -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-
|
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.
|
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-
|
126
|
+
homepage: https://github.com/sobataro/ruby-music_detector
|
127
127
|
licenses:
|
128
128
|
- MIT
|
129
129
|
metadata: {}
|