Skip to content

Commit

Permalink
ht/spacing update
Browse files Browse the repository at this point in the history
  • Loading branch information
hannah-tillman committed Jan 18, 2024
1 parent 9ac6105 commit 74556cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions h2o-bindings/bin/custom/python/gen_rulefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def predict_rules(self, frame, rule_ids):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, algorithm="auto", seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... algorithm="auto",
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand All @@ -79,7 +82,10 @@ def predict_rules(self, frame, rule_ids):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, max_categorical_levels=10, seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... max_categorical_levels=10,
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand All @@ -93,7 +99,10 @@ def predict_rules(self, frame, rule_ids):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, max_num_rules=-1, seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... max_num_rules=-1,
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand Down
15 changes: 12 additions & 3 deletions h2o-py/h2o/estimators/rulefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ def algorithm(self):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, algorithm="auto", seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... algorithm="auto",
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand Down Expand Up @@ -275,7 +278,10 @@ def max_num_rules(self):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, max_num_rules=-1, seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... max_num_rules=-1,
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand Down Expand Up @@ -411,7 +417,10 @@ def max_categorical_levels(self):
>>> train, test = df.split_frame(ratios=[0.8], seed=1)
>>> x = ["age", "sibsp", "parch", "fare", "sex", "pclass"]
>>> y = "survived"
>>> rfit = H2ORuleFitEstimator(max_rule_length=10, max_num_rules=100, max_categorical_levels=10, seed=1)
>>> rfit = H2ORuleFitEstimator(max_rule_length=10,
... max_num_rules=100,
... max_categorical_levels=10,
... seed=1)
>>> rfit.train(training_frame=train, x=x, y=y)
>>> print(rfit.rule_importance())
>>> rfit.predict(test)
Expand Down

0 comments on commit 74556cd

Please sign in to comment.