Files
redux-scraper/sorbet/rbi/gems/rumale-naive_bayes@1.0.0.rbi
2025-07-10 19:24:41 +00:00

379 lines
14 KiB
Ruby
Generated

# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `rumale-naive_bayes` gem.
# Please instead update this file by running `bin/tapioca gem rumale-naive_bayes`.
# Rumale is a machine learning library in Ruby.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#7
module Rumale; end
# This module consists of the classes that implement naive bayes models.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#8
module Rumale::NaiveBayes; end
# BaseNaiveBayes is a class that has methods for common processes of naive bayes classifier.
# This class is used internally.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#11
class Rumale::NaiveBayes::BaseNaiveBayes < ::Rumale::Base::Estimator
include ::Rumale::Base::Classifier
# @return [BaseNaiveBayes] a new instance of BaseNaiveBayes
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#14
def initialize; end
# Predict class labels for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the labels.
# @return [Numo::Int32] (shape: [n_samples]) Predicted class label per sample.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#22
def predict(x); end
# Predict log-probability for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the log-probailities.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Predicted log-probability of each class per sample.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#34
def predict_log_proba(x); end
# Predict probability for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the probailities.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Predicted probability of each class per sample.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/base_naive_bayes.rb#46
def predict_proba(x); end
end
# BernoulliNB is a class that implements Bernoulli Naive Bayes classifier.
#
# *Reference*
# - Manning, C D., Raghavan, P., and Schutze, H., "Introduction to Information Retrieval," Cambridge University Press., 2008.
#
# @example
# require 'rumale/naive_bayes/bernoulli_nb'
#
# estimator = Rumale::NaiveBayes::BernoulliNB.new(smoothing_param: 1.0, bin_threshold: 0.0)
# estimator.fit(training_samples, training_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#18
class Rumale::NaiveBayes::BernoulliNB < ::Rumale::NaiveBayes::BaseNaiveBayes
# Create a new classifier with Bernoulli Naive Bayes.
#
# @param smoothing_param [Float] The Laplace smoothing parameter.
# @param bin_threshold [Float] The threshold for binarizing of features.
# @return [BernoulliNB] a new instance of BernoulliNB
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#35
def initialize(smoothing_param: T.unsafe(nil), bin_threshold: T.unsafe(nil)); end
# Return the prior probabilities of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#25
def class_priors; end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#21
def classes; end
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence scores per sample for each class.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#71
def decision_function(x); end
# Return the conditional probabilities for features of each class.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#29
def feature_probs; end
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The categorical variables (e.g. labels)
# to be used for fitting the model.
# @return [BernoulliNB] The learned classifier itself.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/bernoulli_nb.rb#49
def fit(x, y); end
end
# ComplementNB is a class that implements Complement Naive Bayes classifier.
#
# *Reference*
# - Rennie, J. D. M., Shih, L., Teevan, J., and Karger, D. R., "Tackling the Poor Assumptions of Naive Bayes Text Classifiers," ICML' 03, pp. 616--623, 2013.
#
# @example
# require 'rumale/naive_bayes/complement_nb'
#
# estimator = Rumale::NaiveBayes::ComplementNB.new(smoothing_param: 1.0)
# estimator.fit(training_samples, training_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#18
class Rumale::NaiveBayes::ComplementNB < ::Rumale::NaiveBayes::BaseNaiveBayes
# Create a new classifier with Complement Naive Bayes.
#
# @param smoothing_param [Float] The smoothing parameter.
# @param norm [Boolean] The flag indicating whether to normlize the weight vectors.
# @return [ComplementNB] a new instance of ComplementNB
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#35
def initialize(smoothing_param: T.unsafe(nil), norm: T.unsafe(nil)); end
# Return the prior probabilities of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#25
def class_priors; end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#21
def classes; end
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence scores per sample for each class.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#75
def decision_function(x); end
# Return the conditional probabilities for features of each class.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#29
def feature_probs; end
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The categorical variables (e.g. labels)
# to be used for fitting the model.
# @return [ComplementNB] The learned classifier itself.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#49
def fit(x, y); end
private
# @return [Boolean]
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/complement_nb.rb#83
def normalize?; end
end
# GaussianNB is a class that implements Gaussian Naive Bayes classifier.
#
# @example
# require 'rumale/naive_bayes/gaussian_nb'
#
# estimator = Rumale::NaiveBayes::GaussianNB.new
# estimator.fit(training_samples, training_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#15
class Rumale::NaiveBayes::GaussianNB < ::Rumale::NaiveBayes::BaseNaiveBayes
# Create a new classifier with Gaussian Naive Bayes.
#
# @return [GaussianNB] a new instance of GaussianNB
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#33
def initialize; end
# Return the prior probabilities of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#22
def class_priors; end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#18
def classes; end
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence scores per sample for each class.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#61
def decision_function(x); end
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The categorical variables (e.g. labels)
# to be used for fitting the model.
# @return [GaussianNB] The learned classifier itself.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#44
def fit(x, y); end
# Return the mean vectors of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#26
def means; end
# Return the variance vectors of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/gaussian_nb.rb#30
def variances; end
end
# MultinomialNB is a class that implements Multinomial Naive Bayes classifier.
#
# *Reference*
# - Manning, C D., Raghavan, P., and Schutze, H., "Introduction to Information Retrieval," Cambridge University Press., 2008.
#
# @example
# require 'rumale/naive_bayes/multinomial_nb'
#
# estimator = Rumale::NaiveBayes::MultinomialNB.new(smoothing_param: 1.0)
# estimator.fit(training_samples, training_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#18
class Rumale::NaiveBayes::MultinomialNB < ::Rumale::NaiveBayes::BaseNaiveBayes
# Create a new classifier with Multinomial Naive Bayes.
#
# @param smoothing_param [Float] The Laplace smoothing parameter.
# @return [MultinomialNB] a new instance of MultinomialNB
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#34
def initialize(smoothing_param: T.unsafe(nil)); end
# Return the prior probabilities of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#25
def class_priors; end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#21
def classes; end
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence scores per sample for each class.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#64
def decision_function(x); end
# Return the conditional probabilities for features of each class.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#29
def feature_probs; end
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The categorical variables (e.g. labels)
# to be used for fitting the model.
# @return [MultinomialNB] The learned classifier itself.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/multinomial_nb.rb#45
def fit(x, y); end
end
# NegationNB is a class that implements Negation Naive Bayes classifier.
#
# *Reference*
# - Komiya, K., Sato, N., Fujimoto, K., and Kotani, Y., "Negation Naive Bayes for Categorization of Product Pages on the Web," RANLP' 11, pp. 586--592, 2011.
#
# @example
# require 'rumale/naive_bayes/negation_nb'
#
# estimator = Rumale::NaiveBayes::NegationNB.new(smoothing_param: 1.0)
# estimator.fit(training_samples, training_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#18
class Rumale::NaiveBayes::NegationNB < ::Rumale::NaiveBayes::BaseNaiveBayes
# Create a new classifier with Complement Naive Bayes.
#
# @param smoothing_param [Float] The smoothing parameter.
# @return [NegationNB] a new instance of NegationNB
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#34
def initialize(smoothing_param: T.unsafe(nil)); end
# Return the prior probabilities of the classes.
#
# @return [Numo::DFloat] (shape: [n_classes])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#25
def class_priors; end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#21
def classes; end
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence scores per sample for each class.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#66
def decision_function(x); end
# Return the conditional probabilities for features of each class.
#
# @return [Numo::DFloat] (shape: [n_classes, n_features])
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#29
def feature_probs; end
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The categorical variables (e.g. labels)
# to be used for fitting the model.
# @return [ComplementNB] The learned classifier itself.
#
# source://rumale-naive_bayes//lib/rumale/naive_bayes/negation_nb.rb#45
def fit(x, y); end
end
# source://rumale-naive_bayes//lib/rumale/naive_bayes/version.rb#8
Rumale::NaiveBayes::VERSION = T.let(T.unsafe(nil), String)