.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_classifier_memory_bounded.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_classifier_memory_bounded.py: ============================= Memory bounded DL85Classifier ============================= .. GENERATED FROM PYTHON SOURCE LINES 7-34 .. rst-class:: sphx-glr-script-out .. code-block:: none ###################################################################### # DL8.5 memory bounded classifier # ###################################################################### Model building... Model built. Duration of building = 0.9935 Confusion Matrix below [[ 26 8] [ 9 120]] Accuracy DL8.5 on training set = 0.886 Accuracy DL8.5 on test set = 0.8957 | .. code-block:: default import numpy as np from sklearn.metrics import confusion_matrix from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from pydl85 import DL85Classifier, Cache_Type, Wipe_Type import time dataset = np.genfromtxt("../datasets/anneal.txt", delimiter=' ') X, y = dataset[:, 1:], dataset[:, 0] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) print("######################################################################\n" "# DL8.5 memory bounded classifier #\n" "######################################################################") clf = DL85Classifier(max_depth=4, cache_type=Cache_Type.Cache_TrieItemset, maxcachesize=5000, wipe_factor=0.4, wipe_type=Wipe_Type.Reuses) start = time.perf_counter() print("Model building...") clf.fit(X_train, y_train) duration = time.perf_counter() - start print("Model built. Duration of building =", round(duration, 4)) y_pred = clf.predict(X_test) print("Confusion Matrix below") print(confusion_matrix(y_test, y_pred)) print("Accuracy DL8.5 on training set =", round(clf.accuracy_, 4)) print("Accuracy DL8.5 on test set =", round(accuracy_score(y_test, y_pred), 4)) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.036 seconds) .. _sphx_glr_download_auto_examples_plot_classifier_memory_bounded.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_classifier_memory_bounded.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_classifier_memory_bounded.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_