rumale-clustering 0.29.0 → 2.0.0

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
  SHA256:
3
- metadata.gz: 7a1a28e891d678fae69907df14a70a74031f684a9a59249566b422eabf801f0b
4
- data.tar.gz: b7c47f9ee1d744c40a360998d1364e48f577d1b0a617fb239f205d98ddf05518
3
+ metadata.gz: '09c110ecd3bc505addbf299a70a577abcba22b5df349c1e8b9ccd41f372e6e1f'
4
+ data.tar.gz: 68e76c6e5a18c62b1ac3ae13d16c0014ae71171434dd54e3545abb0bae9066c3
5
5
  SHA512:
6
- metadata.gz: da987cb93867676ab10b70f91ba720079cfb3efc4f6669e5e11d4ecef72346aa689333fe4cc812df5a6b850ddebcb27c08ff65ab1030d8be6d4c180312aa714f
7
- data.tar.gz: 994d7dce1a6d7b4ace1effc4448915d55582b6ae5585c27c4f5e177c7c07119613a981ef9b60a5d70305a5ada4be494c62729ccff169ec20789959bac15ff4f5
6
+ metadata.gz: 6632b58767010a7aeac407215597c19be62d08e6c188b7d0709ef6898a096cbb4e66b545611667ad82850522a38071ae9488c9c8a03f841f07bd55ca87b5554b
7
+ data.tar.gz: e992ff5889c90843954df74bc19009705fc474acbeb13e18f6675a9313146451b1d9757aa57c450964a2e0a693d46868ed048a1abc79a559a6f51a5722d68d17
@@ -52,7 +52,7 @@ module Rumale
52
52
  # @return [DBSCAN] The learned cluster analyzer itself.
53
53
  def fit(x, _y = nil)
54
54
  x = ::Rumale::Validation.check_convert_sample_array(x)
55
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
55
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
56
56
 
57
57
  partial_fit(x)
58
58
  self
@@ -65,7 +65,7 @@ module Rumale
65
65
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
66
66
  def fit_predict(x)
67
67
  x = ::Rumale::Validation.check_convert_sample_array(x)
68
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
68
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
69
69
 
70
70
  partial_fit(x)
71
71
  labels
@@ -73,7 +73,7 @@ module Rumale
73
73
 
74
74
  private
75
75
 
76
- def check_invalid_array_shape(x)
76
+ def check_invalid_array_shape?(x)
77
77
  @params[:metric] == 'precomputed' && x.shape[0] != x.shape[1]
78
78
  end
79
79
 
@@ -86,7 +86,7 @@ module Rumale
86
86
  n_samples.times do |query_id|
87
87
  next if @labels[query_id] >= -1
88
88
 
89
- cluster_id += 1 if expand_cluster(metric_mat, query_id, cluster_id)
89
+ cluster_id += 1 if expand_cluster?(metric_mat, query_id, cluster_id)
90
90
  end
91
91
  @core_sample_ids = Numo::Int32[*@core_sample_ids.flatten]
92
92
  nil
@@ -96,7 +96,7 @@ module Rumale
96
96
  @params[:metric] == 'precomputed' ? x : ::Rumale::PairwiseMetric.euclidean_distance(x)
97
97
  end
98
98
 
99
- def expand_cluster(metric_mat, query_id, cluster_id)
99
+ def expand_cluster?(metric_mat, query_id, cluster_id)
100
100
  target_ids = region_query(metric_mat[query_id, true])
101
101
  if target_ids.size < @params[:min_samples]
102
102
  @labels[query_id] = -1
@@ -51,7 +51,7 @@ module Rumale
51
51
  # @return [HDBSCAN] The learned cluster analyzer itself.
52
52
  def fit(x, _y = nil)
53
53
  x = ::Rumale::Validation.check_convert_sample_array(x)
54
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
54
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
55
55
 
56
56
  fit_predict(x)
57
57
  self
@@ -64,7 +64,7 @@ module Rumale
64
64
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
65
65
  def fit_predict(x)
66
66
  x = ::Rumale::Validation.check_convert_sample_array(x)
67
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
67
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
68
68
 
69
69
  distance_mat = @params[:metric] == 'precomputed' ? x : ::Rumale::PairwiseMetric.euclidean_distance(x)
70
70
  @labels = partial_fit(distance_mat)
@@ -72,7 +72,7 @@ module Rumale
72
72
 
73
73
  private
74
74
 
75
- def check_invalid_array_shape(x)
75
+ def check_invalid_array_shape?(x)
76
76
  @params[:metric] == 'precomputed' && x.shape[0] != x.shape[1]
77
77
  end
78
78
 
@@ -58,7 +58,7 @@ module Rumale
58
58
  # @return [KMedoids] The learned cluster analyzer itself.
59
59
  def fit(x, _y = nil)
60
60
  x = ::Rumale::Validation.check_convert_sample_array(x)
61
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
61
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
62
62
 
63
63
  # initialize some varibales.
64
64
  distance_mat = @params[:metric] == 'precomputed' ? x : ::Rumale::PairwiseMetric.euclidean_distance(x)
@@ -102,7 +102,7 @@ module Rumale
102
102
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
103
103
  def fit_predict(x)
104
104
  x = ::Rumale::Validation.check_convert_sample_array(x)
105
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
105
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
106
106
 
107
107
  fit(x)
108
108
  if @params[:metric] == 'precomputed'
@@ -114,7 +114,7 @@ module Rumale
114
114
 
115
115
  private
116
116
 
117
- def check_invalid_array_shape(x)
117
+ def check_invalid_array_shape?(x)
118
118
  @params[:metric] == 'precomputed' && x.shape[0] != x.shape[1]
119
119
  end
120
120
 
@@ -67,7 +67,7 @@ module Rumale
67
67
  # @return [PowerIteration] The learned cluster analyzer itself.
68
68
  def fit(x, _y = nil)
69
69
  x = ::Rumale::Validation.check_convert_sample_array(x)
70
- raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape(x)
70
+ raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape?(x)
71
71
 
72
72
  fit_predict(x)
73
73
  self
@@ -80,7 +80,7 @@ module Rumale
80
80
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
81
81
  def fit_predict(x)
82
82
  x = ::Rumale::Validation.check_convert_sample_array(x)
83
- raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape(x)
83
+ raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape?(x)
84
84
 
85
85
  affinity_mat = @params[:affinity] == 'precomputed' ? x : ::Rumale::PairwiseMetric.rbf_kernel(x, nil, @params[:gamma])
86
86
  @embedding, @n_iter = embedded_space(affinity_mat, @params[:max_iter], @params[:tol].fdiv(affinity_mat.shape[0]))
@@ -89,7 +89,7 @@ module Rumale
89
89
 
90
90
  private
91
91
 
92
- def check_invalid_array_shape(x)
92
+ def check_invalid_array_shape?(x)
93
93
  @params[:affinity] == 'precomputed' && x.shape[0] != x.shape[1]
94
94
  end
95
95
 
@@ -51,7 +51,7 @@ module Rumale
51
51
  # @return [SingleLinkage] The learned cluster analyzer itself.
52
52
  def fit(x, _y = nil)
53
53
  x = ::Rumale::Validation.check_convert_sample_array(x)
54
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
54
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
55
55
 
56
56
  fit_predict(x)
57
57
  self
@@ -64,7 +64,7 @@ module Rumale
64
64
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
65
65
  def fit_predict(x)
66
66
  x = ::Rumale::Validation.check_convert_sample_array(x)
67
- raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape(x)
67
+ raise ArgumentError, 'the input distance matrix should be square' if check_invalid_array_shape?(x)
68
68
 
69
69
  distance_mat = @params[:metric] == 'precomputed' ? x : ::Rumale::PairwiseMetric.euclidean_distance(x)
70
70
  @labels = partial_fit(distance_mat)
@@ -72,7 +72,7 @@ module Rumale
72
72
 
73
73
  private
74
74
 
75
- def check_invalid_array_shape(x)
75
+ def check_invalid_array_shape?(x)
76
76
  @params[:metric] == 'precomputed' && x.shape[0] != x.shape[1]
77
77
  end
78
78
 
@@ -65,7 +65,7 @@ module Rumale
65
65
  # @return [SpectralClustering] The learned cluster analyzer itself.
66
66
  def fit(x, _y = nil)
67
67
  x = ::Rumale::Validation.check_convert_sample_array(x)
68
- raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape(x)
68
+ raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape?(x)
69
69
 
70
70
  raise 'SpectralClustering#fit requires Numo::Linalg but that is not loaded' unless enable_linalg?(warning: false)
71
71
 
@@ -81,7 +81,7 @@ module Rumale
81
81
  # @return [Numo::Int32] (shape: [n_samples]) Predicted cluster label per sample.
82
82
  def fit_predict(x)
83
83
  x = ::Rumale::Validation.check_convert_sample_array(x)
84
- raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape(x)
84
+ raise ArgumentError, 'the input affinity matrix should be square' if check_invalid_array_shape?(x)
85
85
 
86
86
  unless enable_linalg?(warning: false)
87
87
  raise 'SpectralClustering#fit_predict requires Numo::Linalg but that is not loaded'
@@ -95,7 +95,7 @@ module Rumale
95
95
 
96
96
  private
97
97
 
98
- def check_invalid_array_shape(x)
98
+ def check_invalid_array_shape?(x)
99
99
  @params[:affinity] == 'precomputed' && x.shape[0] != x.shape[1]
100
100
  end
101
101
 
@@ -5,6 +5,6 @@ module Rumale
5
5
  # This module consists of classes that implement cluster analysis methods.
6
6
  module Clustering
7
7
  # @!visibility private
8
- VERSION = '0.29.0'
8
+ VERSION = '2.0.0'
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,43 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumale-clustering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-03-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: numo-narray
13
+ name: numo-narray-alt
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 0.9.1
18
+ version: 0.9.4
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">="
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 0.9.1
25
+ version: 0.9.4
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rumale-core
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: 0.29.0
32
+ version: 2.0.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: 0.29.0
39
+ version: 2.0.0
41
40
  description: |
42
41
  Rumale::Clustering provides cluster analysis algorithms,
43
42
  such as K-Means, Gaussian Mixture Model, DBSCAN, and Spectral Clustering,
@@ -72,7 +71,6 @@ metadata:
72
71
  changelog_uri: https://github.com/yoshoku/rumale/blob/main/CHANGELOG.md
73
72
  documentation_uri: https://yoshoku.github.io/rumale/doc/
74
73
  rubygems_mfa_required: 'true'
75
- post_install_message:
76
74
  rdoc_options: []
77
75
  require_paths:
78
76
  - lib
@@ -87,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
85
  - !ruby/object:Gem::Version
88
86
  version: '0'
89
87
  requirements: []
90
- rubygems_version: 3.5.7
91
- signing_key:
88
+ rubygems_version: 3.6.9
92
89
  specification_version: 4
93
90
  summary: Rumale::Clustering provides cluster analysis algorithms with Rumale interface.
94
91
  test_files: []