svm_toolkit 1.1.7-java → 1.1.8-java

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: 573f621dd03d73aa37c8ac0f65ef5bedd70fe3831f538ab5977685578979688e
4
- data.tar.gz: 1ddbc97a37507768149f19cb7097a1277287726f4436ab04a45c70227f977895
3
+ metadata.gz: af7505fa58e29043cb54b75ead159862ff156a6ab7cb2c4f96c9b10ede718ce5
4
+ data.tar.gz: c5cae68444d0fd9d8427853935486370099c352c3e8162deaf457b7d1071ce94
5
5
  SHA512:
6
- metadata.gz: 9a5e17905c86237e6586df1df7d06ff2f5bfcdcabf38e03f4a53bb647030a32f4e16fc03616ca9f98dff6cebe16d2df25d687477003e544f06d8712b016a1c00
7
- data.tar.gz: 8b9798b3d37eba4e24f080a807a2b44c5cba885e4b1aad97956d9fbd5eede6866dbc5b990467da327d2a5cd28a58392e7a5d36788958799a9063634e80a9f57c
6
+ metadata.gz: 89e2cc63ad0840b73e70b8918f2692314698dbd2ec192ac824d7596f98d1c3f81d50b0c0f460bf01cae4ca52191029cd6d5d5440c110004727222ed3a713ef8d
7
+ data.tar.gz: 942e0aff5614cdbd7eaa19af61491d3c9dff87edcb08ab356460d352d1e12ea7b545444617a588ea1d7ced2c920b1c11202460bc95e70ea91e6b38f8dfa0c385
data/LICENSE.rdoc CHANGED
@@ -1,59 +1,59 @@
1
- = MIT License
2
-
3
- Copyright (c) 2011-20, Peter Lane
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
-
24
- = For libsvm:
25
-
26
- Copyright (c) 2000-2012 Chih-Chung Chang and Chih-Jen Lin
27
- All rights reserved.
28
-
29
- Redistribution and use in source and binary forms, with or without
30
- modification, are permitted provided that the following conditions
31
- are met:
32
-
33
- 1. Redistributions of source code must retain the above copyright
34
- notice, this list of conditions and the following disclaimer.
35
-
36
- 2. Redistributions in binary form must reproduce the above copyright
37
- notice, this list of conditions and the following disclaimer in the
38
- documentation and/or other materials provided with the distribution.
39
-
40
- 3. Neither name of copyright holders nor the names of its contributors
41
- may be used to endorse or promote products derived from this software
42
- without specific prior written permission.
43
-
44
-
45
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
49
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
50
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
52
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
53
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
54
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
55
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
-
57
- = For PlotPackage:
58
-
59
- Library General Public License (http://www.gnu.org/copyleft/lgpl.html)
1
+ = MIT License
2
+
3
+ Copyright (c) 2011-20, Peter Lane
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+ = For libsvm:
25
+
26
+ Copyright (c) 2000-2012 Chih-Chung Chang and Chih-Jen Lin
27
+ All rights reserved.
28
+
29
+ Redistribution and use in source and binary forms, with or without
30
+ modification, are permitted provided that the following conditions
31
+ are met:
32
+
33
+ 1. Redistributions of source code must retain the above copyright
34
+ notice, this list of conditions and the following disclaimer.
35
+
36
+ 2. Redistributions in binary form must reproduce the above copyright
37
+ notice, this list of conditions and the following disclaimer in the
38
+ documentation and/or other materials provided with the distribution.
39
+
40
+ 3. Neither name of copyright holders nor the names of its contributors
41
+ may be used to endorse or promote products derived from this software
42
+ without specific prior written permission.
43
+
44
+
45
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
49
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
50
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
52
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
53
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
54
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
55
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
+
57
+ = For PlotPackage:
58
+
59
+ Library General Public License (http://www.gnu.org/copyleft/lgpl.html)
data/README.rdoc CHANGED
@@ -1,103 +1,99 @@
1
- = SVM Toolkit
2
-
3
- source:: https://notabug.org/peterlane/svm_toolkit/
4
-
5
- == Description
6
-
7
- Support-vector machines are a popular tool in data mining. This package
8
- includes an amended version of the Java implementation of the libsvm library
9
- (version 3.11). Additional methods and examples are provided to support
10
- standard training techniques, such as cross-validation, and simple
11
- visualisations. Training/testing of models can use a variety of built-in or
12
- user-defined evaluation methods, including overall accuracy, geometric mean,
13
- precision and recall.
14
-
15
- == Features
16
-
17
- - All features of LibSVM 3.11 are supported, and many are augmented with Ruby wrappers.
18
- - Loading Problem definitions from file in Svmlight, Csv or Arff (simple subset) format.
19
- - Creating Problem definitions from values supplied programmatically in arrays.
20
- - Rescaling of feature values.
21
- - Integrated cost/gamma search for model with RBF kernel, taking advantage of multiple cores.
22
- - Contour plot visualisation of cost/gamma search results.
23
- - Model provides value of w-squared for hyperplane.
24
- - svm-demo application, a version of the svm_toy applet which comes with libsvm.
25
- - Model stores indices of training instances used as support vectors.
26
- - User-selected evaluation techniques supported in Model#evaluate_dataset and
27
- Svm.cross_validation_search.
28
- - Library provides evaluation classes for Cohen's Kappa statistics, F-measure,
29
- geometric-mean, Matthews Correlation Coefficient, overall-accuracy,
30
- precision, and recall.
31
-
32
- == Example
33
-
34
- The following example illustrates how a dataset can be constructed in code, and
35
- an SVM model created and tested against the different kernels.
36
-
37
- require "svm_toolkit"
38
- include SvmToolkit
39
-
40
- puts "Classification with LIBSVM"
41
- puts "--------------------------"
42
-
43
- # Sample dataset: the 'Play Tennis' dataset
44
- # from T. Mitchell, Machine Learning (1997)
45
- # --------------------------------------------
46
- # Labels for each instance in the training set
47
- # 1 = Play, 0 = Not
48
- Labels = [0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0]
49
-
50
- # Recoding the attribute values into range [0, 1]
51
- Instances = [
52
- [0.0,1.0,1.0,0.0],
53
- [0.0,1.0,1.0,1.0],
54
- [0.5,1.0,1.0,0.0],
55
- [1.0,0.5,1.0,0.0],
56
- [1.0,0.0,0.0,0.0],
57
- [1.0,0.0,0.0,1.0],
58
- [0.5,0.0,0.0,1.0],
59
- [0.0,0.5,1.0,0.0],
60
- [0.0,0.0,0.0,0.0],
61
- [1.0,0.5,0.0,0.0],
62
- [0.0,0.5,0.0,1.0],
63
- [0.5,0.5,1.0,1.0],
64
- [0.5,1.0,0.0,0.0],
65
- [1.0,0.5,1.0,1.0]
66
- ]
67
-
68
- # create some arbitrary train/test split
69
- TrainingSet = Problem.from_array(Instances.slice(0, 10), Labels.slice(0, 10))
70
- TestSet = Problem.from_array(Instances.slice(10, 4), Labels.slice(10, 4))
71
-
72
- # Iterate over each kernel type
73
- Parameter.kernels.each do |kernel|
74
-
75
- # -- train model for this kernel type
76
- params = Parameter.new(
77
- :svm_type => Parameter::C_SVC,
78
- :kernel_type => kernel,
79
- :cost => 10,
80
- :degree => 1,
81
- :gamma => 100
82
- )
83
- model = Svm.svm_train(TrainingSet, params)
84
-
85
- # -- test kernel performance on the training set
86
- errors = model.evaluate_dataset(TrainingSet, :print_results => true)
87
- puts "Kernel #{Parameter.kernel_name(kernel)} has #{errors} on the training set"
88
-
89
- # -- test kernel performance on the test set
90
- errors = model.evaluate_dataset(TestSet, :print_results => true)
91
- puts "Kernel #{Parameter.kernel_name(kernel)} has #{errors} on the test set"
92
- end
93
-
94
- More examples can be found in the source code, linked above.
95
-
96
- == Acknowledgements
97
-
98
- The svm_toolkit is based on LibSVM, which is available from:
99
- http://www.csie.ntu.edu.tw/~cjlin/libsvm/
100
-
101
- The contour plot uses the PlotPackage library, available from:
102
- http://thehuwaldtfamily.org/java/Packages/Plot/PlotPackage.html
103
-
1
+ = SVM Toolkit
2
+
3
+ Support-vector machines are a popular tool in data mining. This package
4
+ includes an amended version of the Java implementation of the libsvm library
5
+ (version 3.11). Additional methods and examples are provided to support
6
+ standard training techniques, such as cross-validation, and simple
7
+ visualisations. Training/testing of models can use a variety of built-in or
8
+ user-defined evaluation methods, including overall accuracy, geometric mean,
9
+ precision and recall.
10
+
11
+ == Features
12
+
13
+ - All features of LibSVM 3.11 are supported, and many are augmented with Ruby wrappers.
14
+ - Loading Problem definitions from file in Svmlight, Csv or Arff (simple subset) format.
15
+ - Creating Problem definitions from values supplied programmatically in arrays.
16
+ - Rescaling of feature values.
17
+ - Integrated cost/gamma search for model with RBF kernel, taking advantage of multiple cores.
18
+ - Contour plot visualisation of cost/gamma search results.
19
+ - Model provides value of w-squared for hyperplane.
20
+ - svm-demo application, a version of the svm_toy applet which comes with libsvm.
21
+ - Model stores indices of training instances used as support vectors.
22
+ - User-selected evaluation techniques supported in Model#evaluate_dataset and
23
+ Svm.cross_validation_search.
24
+ - Library provides evaluation classes for Cohen's Kappa statistics, F-measure,
25
+ geometric-mean, Matthews Correlation Coefficient, overall-accuracy,
26
+ precision, and recall.
27
+
28
+ == Example
29
+
30
+ The following example illustrates how a dataset can be constructed in code, and
31
+ an SVM model created and tested against the different kernels.
32
+
33
+ require "svm_toolkit"
34
+ include SvmToolkit
35
+
36
+ puts "Classification with LIBSVM"
37
+ puts "--------------------------"
38
+
39
+ # Sample dataset: the 'Play Tennis' dataset
40
+ # from T. Mitchell, Machine Learning (1997)
41
+ # --------------------------------------------
42
+ # Labels for each instance in the training set
43
+ # 1 = Play, 0 = Not
44
+ Labels = [0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0]
45
+
46
+ # Recoding the attribute values into range [0, 1]
47
+ Instances = [
48
+ [0.0,1.0,1.0,0.0],
49
+ [0.0,1.0,1.0,1.0],
50
+ [0.5,1.0,1.0,0.0],
51
+ [1.0,0.5,1.0,0.0],
52
+ [1.0,0.0,0.0,0.0],
53
+ [1.0,0.0,0.0,1.0],
54
+ [0.5,0.0,0.0,1.0],
55
+ [0.0,0.5,1.0,0.0],
56
+ [0.0,0.0,0.0,0.0],
57
+ [1.0,0.5,0.0,0.0],
58
+ [0.0,0.5,0.0,1.0],
59
+ [0.5,0.5,1.0,1.0],
60
+ [0.5,1.0,0.0,0.0],
61
+ [1.0,0.5,1.0,1.0]
62
+ ]
63
+
64
+ # create some arbitrary train/test split
65
+ TrainingSet = Problem.from_array(Instances.slice(0, 10), Labels.slice(0, 10))
66
+ TestSet = Problem.from_array(Instances.slice(10, 4), Labels.slice(10, 4))
67
+
68
+ # Iterate over each kernel type
69
+ Parameter.kernels.each do |kernel|
70
+
71
+ # -- train model for this kernel type
72
+ params = Parameter.new(
73
+ :svm_type => Parameter::C_SVC,
74
+ :kernel_type => kernel,
75
+ :cost => 10,
76
+ :degree => 1,
77
+ :gamma => 100
78
+ )
79
+ model = Svm.svm_train(TrainingSet, params)
80
+
81
+ # -- test kernel performance on the training set
82
+ errors = model.evaluate_dataset(TrainingSet, :print_results => true)
83
+ puts "Kernel #{Parameter.kernel_name(kernel)} has #{errors} on the training set"
84
+
85
+ # -- test kernel performance on the test set
86
+ errors = model.evaluate_dataset(TestSet, :print_results => true)
87
+ puts "Kernel #{Parameter.kernel_name(kernel)} has #{errors} on the test set"
88
+ end
89
+
90
+ More examples can be found in the source: https://codeberg.org/peterlane/svm_toolkit
91
+
92
+ == Acknowledgements
93
+
94
+ The svm_toolkit is based on LibSVM, which is available from:
95
+ http://www.csie.ntu.edu.tw/~cjlin/libsvm/
96
+
97
+ The contour plot uses the PlotPackage library, available from:
98
+ http://thehuwaldtfamily.org/java/Packages/Plot/PlotPackage.html
99
+