diff --git a/CHAID/tree.py b/CHAID/tree.py
index 17e192a..86508e2 100644
--- a/CHAID/tree.py
+++ b/CHAID/tree.py
@@ -221,7 +221,7 @@ class Tree(object):
 
     def print_tree(self):
         """ prints the tree out """
-        self.to_tree().show()
+        self.to_tree().show(line_type='ascii')
 
     def node_predictions(self):
         """ Determines which rows fall into which node """
@@ -264,7 +264,7 @@ class Tree(object):
         """
         if isinstance(self.observed, ContinuousColumn):
             return ValueError("Cannot make model predictions on a continuous scale")
-        pred = np.zeros(self.data_size)
+        pred = np.zeros(self.data_size).astype('object')
         for node in self:
             if node.is_terminal:
                 pred[node.indices] = max(node.members, key=node.members.get)
@@ -275,4 +275,5 @@ class Tree(object):
         Calculates the fraction of risk associated
         with the model predictions
         """
-        return 1 - float((self.model_predictions() == self.observed.arr).sum()) / self.data_size
+        sub_observed = np.array([self.observed.metadata[i] for i in self.observed.arr])
+        return 1 - float((self.model_predictions() == sub_observed).sum()) / self.data_size

model_predictions fails with categorical dependant variables
If the dependent variable is categorical, where categories are strings, the method model_predictions fails. The problem is that the the pred array is initialized as:

    pred = np.zeros(self.data_size)

and that enforces predictions to be numerical. In order to solve that, the model_predictions could be rewritten to something like the following:

    pred = [None] * self.data_size
    for node in self:
        if node.is_terminal:
            max_val = max(node.members, key=node.members.get)
            for i in node.indices:
                pred[i] = max_val
    return pred

Best regards
diff --git a/tests/test_tree.py b/tests/test_tree.py
index fcb5b60..776ab6c 100644
--- a/tests/test_tree.py
+++ b/tests/test_tree.py
@@ -570,3 +570,41 @@ class TestContinuousDependentVariable(TestCase):
         tree = CHAID.Tree.from_numpy(self.ndarr, self.normal_arr, alpha_merge=0.999, max_depth=5, min_child_node_size=11, dep_variable_type='continuous', weights=self.wt)
         assert round(tree.tree_store[0].p, 4) == 0.3681
         assert len(tree.tree_store) == 5
+
+
+class TestStringCategoricalDependentVariableForModelPrediction(TestCase):
+    """ Test to make sure we can handle string categorical dependent varaibles """
+    def setUp(self):
+        """
+        Setup data for test case
+        """
+        self.region = np.array([
+            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 2, 3, 2, 2, 2,
+            3, 2, 4, 4, 2, 4, 4, 4, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 2, 2])
+        self.age = np.array([
+            3, 4, 4, 3, 2, 4, 2, 3, 3, 2, 2, 3, 4, 3, 4, 2, 2, 3, 2, 3,
+            2, 4, 4, 3, 2, 3, 1, 2, 4, 4, 3, 4, 4, 3, 2, 4, 2, 3, 3, 2,
+            2, 3, 4, 3, 4, 2, 2, 3, 2, 3, 2, 4, 4, 3, 2, 3, 1, 2, 4, 4])
+        self.gender = np.array([
+            1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2,
+            2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2,
+            2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2])
+        self.lover = np.array(['lover'] * 25 + ['non-lover'] * 35)
+        self.tree = CHAID.Tree.from_numpy(
+            np.vstack([self.region, self.age, self.gender]).transpose(),
+            self.lover,
+            alpha_merge=0.05
+        )
+
+    def test_string_dependent_categorical_variable_for_model_prediction(self):
+        assert (self.tree.model_predictions() ==  np.array(['lover'] * 30 + ['non-lover'] * 30)).all()
+
+    def test_risk_still_works(self):
+        int_lover = np.array([1] * 25 + [0] * 35)
+        other_tree = CHAID.Tree.from_numpy(
+            np.vstack([self.region, self.age, self.gender]).transpose(),
+            int_lover,
+            alpha_merge=0.05
+        )
+        assert self.tree.risk() == other_tree.risk()

pip install -e .[test]
parse_log_pytest
pytest
pytest pytest-cov tox tox-pyenv detox
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
-e git+https://github.com/Rambatino/CHAID.git@17a4cbaed359b644e7ef34a93b44c38a2e24874e#egg=CHAID
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
Cython==3.0.12
detox==0.19
distlib==0.3.9
dnspython==2.2.1
eventlet==0.33.3
filelock==3.4.1
greenlet==2.0.2
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
savReaderWriter==3.4.2
scipy==1.5.4
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
tox==3.6.1
tox-pyenv==1.1.0
treelib==1.7.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: CHAID
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - cython==3.0.12
      - detox==0.19
      - distlib==0.3.9
      - dnspython==2.2.1
      - eventlet==0.33.3
      - filelock==3.4.1
      - greenlet==2.0.2
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - numpy==1.19.5
      - pandas==1.1.5
      - platformdirs==2.4.0
      - pytest-cov==4.0.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.27.1
      - savreaderwriter==3.4.2
      - scipy==1.5.4
      - six==1.17.0
      - tomli==1.2.3
      - tox==3.6.1
      - tox-pyenv==1.1.0
      - treelib==1.7.1
      - urllib3==1.26.20
      - virtualenv==20.17.1
prefix: /opt/conda/envs/CHAID

tests/test_tree.py::TestStringCategoricalDependentVariableForModelPrediction::test_risk_still_works tests/test_tree.py::TestStringCategoricalDependentVariableForModelPrediction::test_string_dependent_categorical_variable_for_model_prediction
tests/test_tree.py::TestClassificationRules::test_all_paths tests/test_tree.py::TestClassificationRules::test_single_path tests/test_tree.py::test_best_split_unique_values tests/test_tree.py::test_spliting_identical_values tests/test_tree.py::test_best_split_with_combination tests/test_tree.py::test_best_split_with_combination_combining_if_too_small tests/test_tree.py::test_new_columns_constructor tests/test_tree.py::TestSurrogate::test_surrgate_detection tests/test_tree.py::TestSurrogate::test_surrogate_default_min_p tests/test_tree.py::test_p_and_chi_values tests/test_tree.py::test_p_and_chi_values_when_weighting_applied tests/test_tree.py::test_correct_dof tests/test_tree.py::test_zero_subbed_weighted_ndarry tests/test_tree.py::test_min_child_node_size_is_30 tests/test_tree.py::test_to_tree_returns_a_tree tests/test_tree.py::test_max_depth_returns_correct_invalid_message tests/test_tree.py::test_node_predictions tests/test_tree.py::TestTreeGenerated::test_deletion tests/test_tree.py::TestTreeGenerated::test_iter tests/test_tree.py::TestTreeGenerated::test_modification tests/test_tree.py::TestComplexStructures::test_p_and_chi_values_selectivity tests/test_tree.py::TestBugFixes::test_incorrect_weighted_counts tests/test_tree.py::TestBugFixes::test_splits_shouldnt_carry_on_splitting_below_min_child_node_size tests/test_tree.py::TestBugFixes::test_unicode_printing tests/test_tree.py::TestStoppingRules::test_min_child_node_size_does_not_stop_for_unweighted_case tests/test_tree.py::TestStoppingRules::test_min_child_node_size_does_not_stop_for_weighted_case tests/test_tree.py::TestStoppingRules::test_min_child_node_size_does_stop_for_unweighted_case tests/test_tree.py::TestStoppingRules::test_min_child_node_size_does_stop_for_weighted_case tests/test_tree.py::TestContinuousDependentVariable::test_bartlett_significance tests/test_tree.py::TestContinuousDependentVariable::test_continuous_dependent_variable tests/test_tree.py::TestContinuousDependentVariable::test_continuous_dependent_variable_with_weighting
CHAID/tree.py
CHAID/tree.py