.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/release_highlights/plot_release_highlights_1_2_0.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_release_highlights_plot_release_highlights_1_2_0.py: ======================================= أبرز ميزات الإصدار 1.2 من scikit-learn ======================================= .. currentmodule:: sklearn يسعدنا الإعلان عن إصدار scikit-learn 1.2! تم إجراء العديد من الإصلاحات والتحسينات، بالإضافة إلى بعض الميزات الرئيسية الجديدة. نستعرض أدناه بعض الميزات الرئيسية لهذا الإصدار. **للاطلاع على قائمة شاملة بجميع التغييرات**، يرجى الرجوع إلى :ref:`ملاحظات الإصدار `. لتثبيت أحدث إصدار (باستخدام pip):: pip install --upgrade scikit-learn أو باستخدام conda:: conda install -c conda-forge scikit-learn .. GENERATED FROM PYTHON SOURCE LINES 22-29 إخراج Pandas مع واجهة برمجة التطبيقات set_output ----------------------------------- تدعم محولات scikit-learn الآن إخراج Pandas مع واجهة برمجة التطبيقات set_output. لمزيد من المعلومات حول واجهة برمجة التطبيقات set_output، راجع المثال: :ref:`sphx_glr_auto_examples_miscellaneous_plot_set_output.py` و # هذا الفيديو، إخراج DataFrame لـ Pandas لمحولات scikit-learn (بعض الأمثلة) `__. .. GENERATED FROM PYTHON SOURCE LINES 29-50 .. code-block:: Python import numpy as np from sklearn.datasets import load_iris from sklearn.preprocessing import StandardScaler, KBinsDiscretizer from sklearn.compose import ColumnTransformer X, y = load_iris(as_frame=True, return_X_y=True) sepal_cols = ["sepal length (cm)", "sepal width (cm)"] petal_cols = ["petal length (cm)", "petal width (cm)"] preprocessor = ColumnTransformer( [ ("scaler", StandardScaler(), sepal_cols), ("kbin", KBinsDiscretizer(encode="ordinal"), petal_cols), ], verbose_feature_names_out=False, ).set_output(transform="pandas") X_out = preprocessor.fit_transform(X) X_out.sample(n=5, random_state=0) .. raw:: html
sepal length (cm) sepal width (cm) petal length (cm) petal width (cm)
114 -0.052506 -0.592373 3.0 4.0
62 0.189830 -1.973554 2.0 1.0
33 -0.416010 2.630382 0.0 1.0
107 1.765012 -0.362176 4.0 3.0
7 -1.021849 0.788808 1.0 1.0


.. GENERATED FROM PYTHON SOURCE LINES 51-57 قيود التفاعل في أشجار التدرج التدريجي القائمة على التوزيع التكراري ------------------------------------------------------------------ :class:`~ensemble.HistGradientBoostingRegressor` و :class:`~ensemble.HistGradientBoostingClassifier` يدعمان الآن قيود التفاعل مع معلمة `interaction_cst`. لمزيد من التفاصيل، راجع :ref:`دليل المستخدم `. في المثال التالي، لا يُسمح للميزات بالتفاعل. .. GENERATED FROM PYTHON SOURCE LINES 57-67 .. code-block:: Python from sklearn.datasets import load_diabetes from sklearn.ensemble import HistGradientBoostingRegressor X, y = load_diabetes(return_X_y=True, as_frame=True) hist_no_interact = HistGradientBoostingRegressor( interaction_cst=[[i] for i in range(X.shape[1])], random_state=0 ) hist_no_interact.fit(X, y) .. raw:: html
HistGradientBoostingRegressor(interaction_cst=[[0], [1], [2], [3], [4], [5],
                                                   [6], [7], [8], [9]],
                                  random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.


.. GENERATED FROM PYTHON SOURCE LINES 68-72 شاشات العرض الجديدة والمحسنة ------------------------- :class:`~metrics.PredictionErrorDisplay` توفر طريقة لتحليل نماذج الانحدار بطريقة نوعية. .. GENERATED FROM PYTHON SOURCE LINES 72-83 .. code-block:: Python import matplotlib.pyplot as plt from sklearn.metrics import PredictionErrorDisplay fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) _ = PredictionErrorDisplay.from_estimator( hist_no_interact, X, y, kind="actual_vs_predicted", ax=axs[0] ) _ = PredictionErrorDisplay.from_estimator( hist_no_interact, X, y, kind="residual_vs_predicted", ax=axs[1] ) .. image-sg:: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_001.png :alt: plot release highlights 1 2 0 :srcset: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 84-86 :class:`~model_selection.LearningCurveDisplay` متاح الآن لعرض النتائج من :func:`~model_selection.learning_curve`. .. GENERATED FROM PYTHON SOURCE LINES 86-92 .. code-block:: Python from sklearn.model_selection import LearningCurveDisplay _ = LearningCurveDisplay.from_estimator( hist_no_interact, X, y, cv=5, n_jobs=2, train_sizes=np.linspace(0.1, 1, 5) ) .. image-sg:: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_002.png :alt: plot release highlights 1 2 0 :srcset: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 93-96 :class:`~inspection.PartialDependenceDisplay` تعرض معلمة جديدة `categorical_features` لعرض الاعتماد الجزئي للميزات التصنيفية باستخدام مخططات الأعمدة والخرائط الحرارية. .. GENERATED FROM PYTHON SOURCE LINES 96-103 .. code-block:: Python from sklearn.datasets import fetch_openml X, y = fetch_openml( "titanic", version=1, as_frame=True, return_X_y=True, parser="pandas" ) X = X.select_dtypes(["number", "category"]).drop(columns=["body"]) .. GENERATED FROM PYTHON SOURCE LINES 104-116 .. code-block:: Python from sklearn.preprocessing import OrdinalEncoder from sklearn.pipeline import make_pipeline categorical_features = ["pclass", "sex", "embarked"] model = make_pipeline( ColumnTransformer( transformers=[("cat", OrdinalEncoder(), categorical_features)], remainder="passthrough", ), HistGradientBoostingRegressor(random_state=0), ).fit(X, y) .. GENERATED FROM PYTHON SOURCE LINES 117-128 .. code-block:: Python from sklearn.inspection import PartialDependenceDisplay fig, ax = plt.subplots(figsize=(14, 4), constrained_layout=True) _ = PartialDependenceDisplay.from_estimator( model, X, features=["age", "sex", ("pclass", "sex")], categorical_features=categorical_features, ax=ax, ) .. image-sg:: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_003.png :alt: plot release highlights 1 2 0 :srcset: /auto_examples/release_highlights/images/sphx_glr_plot_release_highlights_1_2_0_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 129-135 معالج أسرع في :func:`~datasets.fetch_openml` ----------------------------------------------- :func:`~datasets.fetch_openml` يدعم الآن معالج جديد "pandas" وهو أكثر كفاءة في الذاكرة والمعالجة. في الإصدار 1.4، سيتم تغيير المعالج الافتراضي إلى `parser="auto"` والذي سيستخدم تلقائيًا معالج "pandas" للبيانات الكثيفة و"liac-arff" للبيانات المتناثرة. .. GENERATED FROM PYTHON SOURCE LINES 135-140 .. code-block:: Python X, y = fetch_openml( "titanic", version=1, as_frame=True, return_X_y=True, parser="pandas" ) X.head() .. raw:: html
pclass name sex age sibsp parch ticket fare cabin embarked boat body home.dest
0 1 Allen, Miss. Elisabeth Walton female 29.0000 0 0 24160 211.3375 B5 S 2 NaN St Louis, MO
1 1 Allison, Master. Hudson Trevor male 0.9167 1 2 113781 151.5500 C22 C26 S 11 NaN Montreal, PQ / Chesterville, ON
2 1 Allison, Miss. Helen Loraine female 2.0000 1 2 113781 151.5500 C22 C26 S NaN NaN Montreal, PQ / Chesterville, ON
3 1 Allison, Mr. Hudson Joshua Creighton male 30.0000 1 2 113781 151.5500 C22 C26 S NaN 135.0 Montreal, PQ / Chesterville, ON
4 1 Allison, Mrs. Hudson J C (Bessie Waldo Daniels) female 25.0000 1 2 113781 151.5500 C22 C26 S NaN NaN Montreal, PQ / Chesterville, ON


.. GENERATED FROM PYTHON SOURCE LINES 141-147 دعم تجريبي لواجهة برمجة التطبيقات Array في :class:`~discriminant_analysis.LinearDiscriminantAnalysis` -------------------------------------------------------------------------------------------- تمت إضافة دعم تجريبي لمواصفات `Array API `_ إلى :class:`~discriminant_analysis.LinearDiscriminantAnalysis`. يمكن للمقدر الآن العمل على أي مكتبات متوافقة مع واجهة برمجة التطبيقات Array مثل `CuPy `__، وهي مكتبة صفائف معجلة بواسطة GPU. لمزيد من التفاصيل، راجع :ref:`دليل المستخدم `. .. GENERATED FROM PYTHON SOURCE LINES 149-161 تحسين كفاءة العديد من المقدرات -------------------------------------- في الإصدار 1.1، تم تحسين كفاءة العديد من المقدرات التي تعتمد على حساب المسافات الزوجية (بشكل أساسي المقدرات المتعلقة بالتجمع، وتعلم المانيفولد، وخوارزميات البحث عن الجيران) بشكل كبير للمدخلات float64 الكثيفة. شملت تحسينات الكفاءة بشكل خاص تقليل استهلاك الذاكرة وتحسين قابلية التوسع على أجهزة متعددة النواة. في الإصدار 1.2، تم تحسين كفاءة هذه المقدرات بشكل أكبر لجميع مجموعات المدخلات الكثيفة والمبعثرة على مجموعات البيانات float32 وfloat64، باستثناء مجموعات البيانات المبعثرة-الكثيفة والكثيفة-المبعثرة لمقاييس المسافة Euclidean وSquared Euclidean. يمكن العثور على قائمة مفصلة بالمقدرات المتأثرة في :ref:`سجل التغييرات `. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.811 seconds) .. _sphx_glr_download_auto_examples_release_highlights_plot_release_highlights_1_2_0.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/release_highlights/plot_release_highlights_1_2_0.ipynb :alt: Launch binder :width: 150 px .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../lite/lab/index.html?path=auto_examples/release_highlights/plot_release_highlights_1_2_0.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_release_highlights_1_2_0.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_release_highlights_1_2_0.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_release_highlights_1_2_0.zip ` .. include:: plot_release_highlights_1_2_0.recommendations .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_