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

862 lines
32 KiB
Ruby
Generated

# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `rumale-tree` gem.
# Please instead update this file by running `bin/tapioca gem rumale-tree`.
# Rumale is a machine learning library in Ruby.
#
# source://rumale-tree//lib/rumale/tree/node.rb#3
module Rumale; end
# This module consists of the classes that implement tree models.
#
# source://rumale-tree//lib/rumale/tree/node.rb#4
module Rumale::Tree; end
# BaseDecisionTree is an abstract class for implementation of decision tree-based estimator.
# This class is used internally.
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#12
class Rumale::Tree::BaseDecisionTree < ::Rumale::Base::Estimator
# Initialize a decision tree-based estimator.
#
# @param criterion [String] The function to evalue spliting point.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, decision tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on decision tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [BaseDecisionTree] a new instance of BaseDecisionTree
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#25
def initialize(criterion: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the index of the leaf that each sample reached.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the labels.
# @return [Numo::Int32] (shape: [n_samples]) Leaf index for sample.
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#43
def apply(x); end
private
# @raise [NotImplementedError]
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#120
def best_split(_features, _y, _impurity); end
# @raise [NotImplementedError]
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#65
def build_tree(x, y); end
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#128
def eval_importance(n_samples, n_features); end
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#137
def eval_importance_at_node(node); end
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#69
def grow_node(depth, x, y, impurity); end
# @raise [NotImplementedError]
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#124
def impurity(_y); end
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#51
def partial_apply(tree, sample); end
# @raise [NotImplementedError]
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#112
def put_leaf(_node, _y); end
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#116
def rand_ids; end
# @raise [NotImplementedError]
# @return [Boolean]
#
# source://rumale-tree//lib/rumale/tree/base_decision_tree.rb#108
def stop_growing?(_y); end
end
# DecisionTreeClassifier is a class that implements decision tree for classification.
#
# @example
# require 'rumale/tree/decision_tree_classifier'
#
# estimator =
# Rumale::Tree::DecisionTreeClassifier.new(
# criterion: 'gini', max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#19
class Rumale::Tree::DecisionTreeClassifier < ::Rumale::Tree::BaseDecisionTree
include ::Rumale::Base::Classifier
include ::Rumale::Tree::ExtDecisionTreeClassifier
# Create a new classifier with decision tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'gini' and 'entropy'.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, decision tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on decision tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [DecisionTreeClassifier] a new instance of DecisionTreeClassifier
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#55
def initialize(criterion: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#25
def classes; end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#29
def feature_importances; 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 labels to be used for fitting the model.
# @return [DecisionTreeClassifier] The learned classifier itself.
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#65
def fit(x, y); end
# Return the labels assigned each leaf.
#
# @return [Numo::Int32] (size: n_leafs)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#41
def leaf_labels; 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-tree//lib/rumale/tree/decision_tree_classifier.rb#90
def predict(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-tree//lib/rumale/tree/decision_tree_classifier.rb#100
def predict_proba(x); end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#37
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#33
def tree; end
private
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#136
def best_split(features, y, whole_impurity); end
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#122
def build_tree(x, y); end
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#142
def impurity(y); end
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#108
def partial_predict_proba(tree, sample); end
# source://rumale-tree//lib/rumale/tree/decision_tree_classifier.rb#127
def put_leaf(node, y); end
end
# DecisionTreeRegressor is a class that implements decision tree for regression.
#
# @example
# require 'rumale/tree/decision_tree_regressor'
#
# estimator =
# Rumale::Tree::DecisionTreeRegressor.new(
# max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_values)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#19
class Rumale::Tree::DecisionTreeRegressor < ::Rumale::Tree::BaseDecisionTree
include ::Rumale::Base::Regressor
include ::Rumale::Tree::ExtDecisionTreeRegressor
# Create a new regressor with decision tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'mae' and 'mse'.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, decision tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on decision tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [DecisionTreeRegressor] a new instance of DecisionTreeRegressor
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#51
def initialize(criterion: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#25
def feature_importances; 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::DFloat] (shape: [n_samples, n_outputs]) The taget values to be used for fitting the model.
# @return [DecisionTreeRegressor] The learned regressor itself.
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#61
def fit(x, y); end
# Return the values assigned each leaf.
#
# @return [Numo::DFloat] (shape: [n_leafs, n_outputs])
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#37
def leaf_values; end
# Predict values for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the values.
# @return [Numo::DFloat] (shape: [n_samples, n_outputs]) Predicted values per sample.
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#84
def predict(x); end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#33
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#29
def tree; end
private
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#107
def best_split(f, y, impurity); end
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#92
def build_tree(x, y); end
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#111
def impurity(y); end
# source://rumale-tree//lib/rumale/tree/decision_tree_regressor.rb#98
def put_leaf(node, y); end
end
module Rumale::Tree::ExtDecisionTreeClassifier
private
def find_split_params(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
def node_impurity(_arg0, _arg1, _arg2); end
def stop_growing?(_arg0); end
end
module Rumale::Tree::ExtDecisionTreeRegressor
private
def find_split_params(_arg0, _arg1, _arg2, _arg3, _arg4); end
def node_impurity(_arg0, _arg1); end
def stop_growing?(_arg0); end
end
module Rumale::Tree::ExtGradientTreeRegressor
private
def find_split_params(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6); end
end
# ExtraTreeClassifier is a class that implements extra randomized tree for classification.
#
# *Reference*
# - Geurts, P., Ernst, D., and Wehenkel, L., "Extremely randomized trees," Machine Learning, vol. 63 (1), pp. 3--42, 2006.
#
# @example
# require 'rumale/tree/extra_tree_classifier'
#
# estimator =
# Rumale::Tree::ExtraTreeClassifier.new(
# criterion: 'gini', max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#20
class Rumale::Tree::ExtraTreeClassifier < ::Rumale::Tree::DecisionTreeClassifier
# Create a new classifier with extra randomized tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'gini' and 'entropy'.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, extra tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on extra tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [ExtraTreeClassifier] a new instance of ExtraTreeClassifier
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#53
def initialize(criterion: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#23
def classes; end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#27
def feature_importances; end
# Return the labels assigned each leaf.
#
# @return [Numo::Int32] (size: n_leafs)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#39
def leaf_labels; end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#35
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#31
def tree; end
private
# source://rumale-tree//lib/rumale/tree/extra_tree_classifier.rb#76
def best_split(features, y, whole_impurity); end
end
# ExtraTreeRegressor is a class that implements extra randomized tree for regression.
#
# *Reference*
# - Geurts, P., Ernst, D., and Wehenkel, L., "Extremely randomized trees," Machine Learning, vol. 63 (1), pp. 3--42, 2006.
#
# @example
# require 'rumale/tree/extra_tree_regressor'
#
# estimator =
# Rumale::Tree::ExtraTreeRegressor.new(
# max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_values)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#20
class Rumale::Tree::ExtraTreeRegressor < ::Rumale::Tree::DecisionTreeRegressor
# Create a new regressor with extra randomized tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'mae' and 'mse'.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, extra tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on extra tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [ExtraTreeRegressor] a new instance of ExtraTreeRegressor
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#49
def initialize(criterion: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#23
def feature_importances; end
# Return the values assigned each leaf.
#
# @return [Numo::DFloat] (shape: [n_leafs, n_outputs])
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#35
def leaf_values; end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#31
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#27
def tree; end
private
# source://rumale-tree//lib/rumale/tree/extra_tree_regressor.rb#67
def best_split(features, y, whole_impurity); end
end
# GradientTreeRegressor is a class that implements decision tree for regression with exact gredy algorithm.
# This class is used internally for estimators with gradient tree boosting.
#
# *Reference*
# - Friedman, J H., "Greedy Function Approximation: A Gradient Boosting Machine," Annals of Statistics, 29 (5), pp. 1189--1232, 2001.
# - Friedman, J H., "Stochastic Gradient Boosting," Computational Statistics and Data Analysis, 38 (4), pp. 367--378, 2002.
# - Chen, T., and Guestrin, C., "XGBoost: A Scalable Tree Boosting System," Proc. KDD'16, pp. 785--794, 2016.
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#18
class Rumale::Tree::GradientTreeRegressor < ::Rumale::Base::Estimator
include ::Rumale::Base::Regressor
include ::Rumale::Tree::ExtGradientTreeRegressor
# Initialize a gradient tree regressor
#
# @param reg_lambda [Float] The L2 regularization term on weight.
# @param shrinkage_rate [Float] The shrinkage rate for weight.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, decision tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on decision tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [GradientTreeRegressor] a new instance of GradientTreeRegressor
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#52
def initialize(reg_lambda: T.unsafe(nil), shrinkage_rate: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the index of the leaf that each sample reached.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the labels.
# @return [Numo::Int32] (shape: [n_samples]) Leaf index for sample.
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#106
def apply(x); end
# Return the importance for each feature.
# The feature importances are calculated based on the numbers of times the feature is used for splitting.
#
# @return [Numo::DFloat] (shape: [n_features])
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#25
def feature_importances; 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::DFloat] (shape: [n_samples]) The taget values to be used for fitting the model.
# @param g [Numo::DFloat] (shape: [n_samples]) The gradient of loss function.
# @param h [Numo::DFloat] (shape: [n_samples]) The hessian of loss function.
# @return [GradientTreeRegressor] The learned regressor itself.
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#74
def fit(x, y, g, h); end
# Return the values assigned each leaf.
#
# @return [Numo::DFloat] (shape: [n_leaves])
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#37
def leaf_weights; end
# Predict values for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to predict the values.
# @return [Numo::DFloat] (size: n_samples) Predicted values per sample.
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#96
def predict(x); end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#33
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#29
def tree; end
private
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#183
def best_split(f, g, h, sum_g, sum_h); end
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#128
def build_tree(x, y, g, h); end
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#135
def grow_node(depth, x, y, g, h); end
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#114
def partial_apply(tree, sample); end
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#173
def put_leaf(node, sum_g, sum_h); end
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#187
def rand_ids; end
# @return [Boolean]
#
# source://rumale-tree//lib/rumale/tree/gradient_tree_regressor.rb#169
def stop_growing?(y); end
end
# Node is a class that implements node used for construction of decision tree.
# This class is used for internal data structures.
#
# source://rumale-tree//lib/rumale/tree/node.rb#7
class Rumale::Tree::Node
# Create a new node for decision tree.
#
# @param depth [Integer] The depth of the node in tree.
# @param impurity [Float] The impurity of the node.
# @param n_samples [Integer] The number of the samples in the node.
# @param probs [Float] The probability of the node.
# @param leaf [Boolean] The flag indicating whether the node is a leaf.
# @param leaf_id [Integer] The leaf index of the node.
# @param left [Node] The left node.
# @param right [Node] The right node.
# @param feature_id [Integer] The feature index used for evaluation.
# @param threshold [Float] The threshold value of the feature for splitting the node.
# @return [Node] a new instance of Node
#
# source://rumale-tree//lib/rumale/tree/node.rb#23
def initialize(depth: T.unsafe(nil), impurity: T.unsafe(nil), n_samples: T.unsafe(nil), probs: T.unsafe(nil), leaf: T.unsafe(nil), leaf_id: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), feature_id: T.unsafe(nil), threshold: T.unsafe(nil)); end
# Returns the value of attribute depth.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def depth; end
# Sets the attribute depth
#
# @param value the value to set the attribute depth to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def depth=(_arg0); end
# Returns the value of attribute feature_id.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def feature_id; end
# Sets the attribute feature_id
#
# @param value the value to set the attribute feature_id to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def feature_id=(_arg0); end
# Returns the value of attribute impurity.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def impurity; end
# Sets the attribute impurity
#
# @param value the value to set the attribute impurity to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def impurity=(_arg0); end
# Returns the value of attribute leaf.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def leaf; end
# Sets the attribute leaf
#
# @param value the value to set the attribute leaf to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def leaf=(_arg0); end
# Returns the value of attribute leaf_id.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def leaf_id; end
# Sets the attribute leaf_id
#
# @param value the value to set the attribute leaf_id to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def leaf_id=(_arg0); end
# Returns the value of attribute left.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def left; end
# Sets the attribute left
#
# @param value the value to set the attribute left to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def left=(_arg0); end
# Returns the value of attribute n_samples.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def n_samples; end
# Sets the attribute n_samples
#
# @param value the value to set the attribute n_samples to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def n_samples=(_arg0); end
# Returns the value of attribute probs.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def probs; end
# Sets the attribute probs
#
# @param value the value to set the attribute probs to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def probs=(_arg0); end
# Returns the value of attribute right.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def right; end
# Sets the attribute right
#
# @param value the value to set the attribute right to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def right=(_arg0); end
# Returns the value of attribute threshold.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def threshold; end
# Sets the attribute threshold
#
# @param value the value to set the attribute threshold to.
#
# source://rumale-tree//lib/rumale/tree/node.rb#9
def threshold=(_arg0); end
end
# source://rumale-tree//lib/rumale/tree/version.rb#8
Rumale::Tree::VERSION = T.let(T.unsafe(nil), String)
# VRTreeClassifier is a class that implements Variable-Random (VR) tree for classification.
#
# *Reference*
# - Liu, F. T., Ting, K. M., Yu, Y., and Zhou, Z. H., "Spectrum of Variable-Random Trees," Journal of Artificial Intelligence Research, vol. 32, pp. 355--384, 2008.
#
# @example
# require 'rumale/tree/vr_tree_classifier'
#
# estimator =
# Rumale::Tree::VRTreeClassifier.new(
# criterion: 'gini', max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_labels)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#20
class Rumale::Tree::VRTreeClassifier < ::Rumale::Tree::DecisionTreeClassifier
# Create a new classifier with variable-random tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'gini' and 'entropy'.
# @param alpha [Float] The probability of choosing a deterministic or random spliting point.
# If 1.0 is given, the tree is the same as the normal decision tree.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, variable-random tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on variable-random tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [VRTreeClassifier] a new instance of VRTreeClassifier
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#55
def initialize(criterion: T.unsafe(nil), alpha: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the class labels.
#
# @return [Numo::Int32] (size: n_classes)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#23
def classes; end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#27
def feature_importances; end
# Return the labels assigned each leaf.
#
# @return [Numo::Int32] (size: n_leafs)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#39
def leaf_labels; end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#35
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#31
def tree; end
private
# source://rumale-tree//lib/rumale/tree/vr_tree_classifier.rb#80
def best_split(features, y, whole_impurity); end
end
# VRTreeRegressor is a class that implements Variable-Random (VR) tree for regression.
#
# *Reference*
# - Liu, F. T., Ting, K. M., Yu, Y., and Zhou, Z. H., "Spectrum of Variable-Random Trees," Journal of Artificial Intelligence Research, vol. 32, pp. 355--384, 2008.
#
# @example
# require 'rumale/tree/vr_tree_regressor'
#
# estimator =
# Rumale::Tree::VRTreeRegressor.new(
# max_depth: 3, max_leaf_nodes: 10, min_samples_leaf: 5, random_seed: 1)
# estimator.fit(training_samples, traininig_values)
# results = estimator.predict(testing_samples)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#20
class Rumale::Tree::VRTreeRegressor < ::Rumale::Tree::DecisionTreeRegressor
# Create a new regressor with variable-random tree algorithm.
#
# @param criterion [String] The function to evaluate spliting point. Supported criteria are 'mae' and 'mse'.
# @param alpha [Float] The probability of choosing a deterministic or random spliting point.
# If 1.0 is given, the tree is the same as the normal decision tree.
# @param max_depth [Integer] The maximum depth of the tree.
# If nil is given, variable-random tree grows without concern for depth.
# @param max_leaf_nodes [Integer] The maximum number of leaves on variable-random tree.
# If nil is given, number of leaves is not limited.
# @param min_samples_leaf [Integer] The minimum number of samples at a leaf node.
# @param max_features [Integer] The number of features to consider when searching optimal split point.
# If nil is given, split process considers all features.
# @param random_seed [Integer] The seed value using to initialize the random generator.
# It is used to randomly determine the order of features when deciding spliting point.
# @return [VRTreeRegressor] a new instance of VRTreeRegressor
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#51
def initialize(criterion: T.unsafe(nil), alpha: T.unsafe(nil), max_depth: T.unsafe(nil), max_leaf_nodes: T.unsafe(nil), min_samples_leaf: T.unsafe(nil), max_features: T.unsafe(nil), random_seed: T.unsafe(nil)); end
# Return the importance for each feature.
#
# @return [Numo::DFloat] (size: n_features)
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#23
def feature_importances; end
# Return the values assigned each leaf.
#
# @return [Numo::DFloat] (shape: [n_leafs, n_outputs])
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#35
def leaf_values; end
# Return the random generator for random selection of feature index.
#
# @return [Random]
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#31
def rng; end
# Return the learned tree.
#
# @return [Node]
#
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#27
def tree; end
private
# source://rumale-tree//lib/rumale/tree/vr_tree_regressor.rb#71
def best_split(features, y, whole_impurity); end
end