.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/feature_selection/plot_rfe_digits.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. or to run this example in your browser via JupyterLite or Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_feature_selection_plot_rfe_digits.py: ======================== إزالة الميزة المتكررة ======================== يوضح هذا المثال كيفية استخدام حذف الميزات التكراري (:class:`~sklearn.feature_selection.RFE`) لتحديد أهمية وحدات البكسل الفردية لتصنيف الأرقام المكتوبة بخط اليد. :class:`~sklearn.feature_selection.RFE` يزيل بشكل تكراري الميزات الأقل أهمية، ويخصص الرتب بناءً على أهميتها، حيث تشير قيم `ranking_` الأعلى إلى أهمية أقل. يتم تصور الترتيب باستخدام كل من درجات اللون الأزرق وشروح البكسل من أجل الوضوح. كما هو متوقع، تميل وحدات البكسل الموجودة في وسط الصورة إلى أن تكون أكثر قدرة على التنبؤ من تلك القريبة من الحواف. .. note:: See also :ref:`sphx_glr_auto_examples_feature_selection_plot_rfe_with_cross_validation.py` .. GENERATED FROM PYTHON SOURCE LINES 20-60 .. image-sg:: /auto_examples/feature_selection/images/sphx_glr_plot_rfe_digits_001.png :alt: ترتيب البكسل باستخدام RFE (الانحدار اللوجستي) :srcset: /auto_examples/feature_selection/images/sphx_glr_plot_rfe_digits_001.png :class: sphx-glr-single-img .. code-block:: Python # Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause import matplotlib.pyplot as plt from sklearn.datasets import load_digits from sklearn.feature_selection import RFE from sklearn.linear_model import LogisticRegression from sklearn.pipeline import Pipeline from sklearn.preprocessing import MinMaxScaler # تحميل مجموعة بيانات الأرقام digits = load_digits() X = digits.images.reshape((len(digits.images), -1)) y = digits.target pipe = Pipeline( [ ("scaler", MinMaxScaler()), ("rfe", RFE(estimator=LogisticRegression(), n_features_to_select=1, step=1)), ] ) pipe.fit(X, y) ranking = pipe.named_steps["rfe"].ranking_.reshape(digits.images[0].shape) # رسم ترتيب البكسل plt.matshow(ranking, cmap=plt.cm.Blues) # إضافة شروح لأرقام البكسل for i in range(ranking.shape[0]): for j in range(ranking.shape[1]): plt.text(j, i, str(ranking[i, j]), ha="center", va="center", color="black") plt.colorbar() plt.title("ترتيب البكسل باستخدام RFE\n(الانحدار اللوجستي)") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.327 seconds) .. _sphx_glr_download_auto_examples_feature_selection_plot_rfe_digits.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/scikit-learn/scikit-learn/main?urlpath=lab/tree/notebooks/auto_examples/feature_selection/plot_rfe_digits.ipynb :alt: Launch binder :width: 150 px .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../lite/lab/index.html?path=auto_examples/feature_selection/plot_rfe_digits.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_rfe_digits.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_rfe_digits.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_rfe_digits.zip ` .. include:: plot_rfe_digits.recommendations .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_