lib/svmkit/linear_model/svc.rb in svmkit-0.2.9 vs lib/svmkit/linear_model/svc.rb in svmkit-0.3.0
- old
+ new
@@ -1,9 +1,11 @@
# frozen_string_literal: true
+require 'svmkit/validation'
require 'svmkit/base/base_estimator'
require 'svmkit/base/classifier'
+require 'svmkit/probabilistic_output'
module SVMKit
# This module consists of the classes that implement generalized linear models.
module LinearModel
# SVC is a class that implements Support Vector Classifier
@@ -101,10 +103,10 @@
else
Numo::DFloat[1, 0]
end
end
else
- negative_label = y.to_a.uniq.sort.first
+ negative_label = y.to_a.uniq.min
bin_y = Numo::Int32.cast(y.ne(negative_label)) * 2 - 1
@weight_vec, @bias_term = binary_fit(x, bin_y)
@prob_param = if @params[:probability]
SVMKit::ProbabilisticOutput.fit_sigmoid(x.dot(@weight_vec.transpose) + @bias_term, bin_y)
else