srlearn.rdn.BoostedRDNClassifier

class srlearn.rdn.BoostedRDNClassifier(background=None, target='None', n_estimators=10, node_size=2, max_tree_depth=3, neg_pos_ratio=2, solver=None)[source]

Relational Dependency Networks Estimator

Wrappers around BoostSRL for learning and inference with Relational Dependency Networks written with a scikit-learn-style interface derived from sklearn.base.BaseEstimator

Similar to sklearn.ensemble.GradientBoostingClassifier, this builds a model by fitting a series of regression trees.

Examples

>>> from srlearn.rdn import BoostedRDNClassifier
>>> from srlearn import Background
>>> from srlearn.datasets import load_toy_cancer
>>> train, test = load_toy_cancer()
>>> bk = Background(modes=train.modes)
>>> dn = BoostedRDNClassifier(background=bk, target="cancer")
>>> dn.fit(train)
BoostedRDNClassifier(background=setParam: numOfClauses=100.
setParam: numOfCycles=100.
usePrologVariables: true.
setParam: nodeSize=2.
setParam: maxTreeDepth=3.
mode: friends(+Person,-Person).
mode: friends(-Person,+Person).
mode: smokes(+Person).
mode: cancer(+Person).
, n_estimators=10, neg_pos_ratio=2, solver='BoostSRL', target='cancer')
>>> dn.predict(test)
array([ True,  True,  True, False, False])
__init__(background=None, target='None', n_estimators=10, node_size=2, max_tree_depth=3, neg_pos_ratio=2, solver=None)[source]

Initialize a BoostedRDN

Parameters
backgroundsrlearn.background.Background (default: None)

Background knowledge with respect to the database

targetstr (default: “None”)

Target predicate to learn

n_estimatorsint, optional (default: 10)

Number of trees to fit

node_sizeint, optional (default: 2)

Maximum number of literals in each node.

max_tree_depthint, optional (default: 3)

Maximum number of nodes from root to leaf (height) in the tree.

neg_pos_ratioint or float, optional (default: 2)

Ratio of negative to positive examples used during learning.

Attributes
estimators_array, shape (n_estimators)

Return the boosted regression trees

feature_importances_array, shape (n_features)

Return the feature importances (based on how often each feature appears)

Examples using srlearn.rdn.BoostedRDNClassifier

Estimating Feature Importance

Estimating Feature Importance

Estimating Feature Importance
Smokes-Friends-Cancer

Smokes-Friends-Cancer

Smokes-Friends-Cancer
Family Relationships Domain

Family Relationships Domain

Family Relationships Domain