corels / pycorels

Public home of pycorels, the python binding to CORELS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can you add version parameter to main class

Sandy4321 opened this issue · comments

can you add version parameter to main class
dir(C)
['class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', 'estimator_type', 'ablation', 'c', 'fit', 'get_params', 'load', 'map_type', 'max_card', 'min_support', 'n_iter', 'policy', 'predict', 'rl', 'rl', 'save', 'score', 'set_params', 'verbosity']

from
from corels import CorelsClassifier

["loud", "samples"] is the most verbose setting possible

C = CorelsClassifier(max_card=2, c=0.8, verbosity=["loud", "samples"])

4 samples, 3 features

X = [[1, 0, 1], [0, 0, 0], [1, 1, 0], [0, 1, 0]]
y = [1, 0, 0, 1]

Feature names

features = ["Mac User", "Likes Pie", "Age < 20"]

Fit the model

C.fit(X, y, features=features, prediction_name="Has a dirty computer")

Print the resulting rulelist

print(C.rl())

Predict on the training set

print("Prediction: " + str(C.predict(X)))

You can get this directly using pkg_resources, as described in the code in bullet 5 here: https://packaging.python.org/guides/single-sourcing-package-version/