srlearn.base.BaseBoostedRelationalModel¶

class srlearn.base.BaseBoostedRelationalModel(*, background=None, target='None', n_estimators=10, node_size=2, max_tree_depth=3, neg_pos_ratio=2, solver=None)[source]¶

Base class for deriving boosted relational models

This class extends sklearn.base.BaseEstimator and sklearn.base.ClassifierMixin while providing several utilities for instantiating a model and performing learning/inference with the BoostSRL jar files.

Note

This is not a complete treatment of how to derive estimators. Contributions would be appreciated.

Examples

The actual srlearn.rdn.BoostedRDNClassifier is derived from this class, so this example is similar to the implementation (but the actual implementation passes model parameters instead of leaving them with the defaults). This example derives a new class BoostedRDNClassifier, which inherits the default values of the superclass while also setting a ‘special_parameter’ which may be unique to this model.

All that remains is to implement the specific cases of fit(), predict(), and predict_proba().

__init__(*, background=None, target='None', n_estimators=10, node_size=2, max_tree_depth=3, neg_pos_ratio=2, solver=None)[source]¶

Initialize a BaseEstimator

feature_importances_¶

Return the features contained in a tree.

Parameters:
tree_number: int

Index of the tree to read.

from_json(file_name)[source]¶

Load a learned model from json.

Parameters:
file_name : str (or pathlike)

Path to a saved json file.

to_json(file_name) → None[source]¶

Serialize a learned model to json.

Parameters:
file_name : str (or pathlike)

Path to a saved json file.

Examples using srlearn.base.BaseBoostedRelationalModel¶