Closed
Description
Problem description:
The error occurs in v1.7.3 when fitting/predicting using any of the operators on the pandas DataFrame containing boolean columns.
Minimal example to reproduce error:
import numpy as np
from rulekit import classification
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
clf = classification.RuleClassifier()
X = pd.DataFrame(X, columns=['sepal_length', 'sepal_width', 'petal_length', 'petal_width'])
X['boolean_column'] = np.random.randint(low=0, high=2, size=X.shape[0]).astype(bool)
clf.fit(X, y)
Stack trace:
Traceback (most recent call last):
File "ExampleSetFactory.java", line 207, in com.rapidminer.example.ExampleSetFactory.createExampleSet
Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\cezar\OneDrive\Pulpit\EMAG\GIT\PythonRulekit\tests\test_classifier.py", line 183, in test_fit_and_predict_on_boolean_columns
clf.fit(X, y)
File "c:\Users\cezar\OneDrive\Pulpit\EMAG\GIT\PythonRulekit\rulekit\classification.py", line 512, in fit
return ExpertKnowledgeOperator.fit(
File "c:\Users\cezar\OneDrive\Pulpit\EMAG\GIT\PythonRulekit\rulekit\_operator.py", line 194, in fit
example_set = create_example_set(
File "c:\Users\cezar\OneDrive\Pulpit\EMAG\GIT\PythonRulekit\rulekit\_helpers.py", line 214, in create_example_set
example_set = ExampleSetFactory.createExampleSet(values, labels)
java.lang.java.lang.RuntimeException: java.lang.RuntimeException: ExampleSetFactory.createExampleSet(Object[][], Object[]): only objects of type String or Number (Double, Integer) are allowed for the object data matrix.