Open Sandy4321 opened 4 years ago
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', 'niter', 'policy', 'predict', 'rl', 'rl', 'save', 'score', 'set_params', 'verbosity']
from from corels import CorelsClassifier
C = CorelsClassifier(max_card=2, c=0.8, verbosity=["loud", "samples"])
X = [[1, 0, 1], [0, 0, 0], [1, 1, 0], [0, 1, 0]] y = [1, 0, 0, 1]
features = ["Mac User", "Likes Pie", "Age < 20"]
C.fit(X, y, features=features, prediction_name="Has a dirty computer")
print(C.rl())
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/
pkg_resources
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', 'niter', '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)))