<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 使用 Scikit-Learn 重新調整 Python 中的機器學習數據 > 原文: [https://machinelearningmastery.com/rescaling-data-for-machine-learning-in-python-with-scikit-learn/](https://machinelearningmastery.com/rescaling-data-for-machine-learning-in-python-with-scikit-learn/) 在構建模型之前,必須準備好數據。 [數據準備](http://machinelearningmastery.com/how-to-prepare-data-for-machine-learning/ "How to Prepare Data For Machine Learning")過程可以包括三個步驟:數據選擇,數據預處理和數據轉換。 在這篇文章中,您將發現兩種簡單的數據轉換方法,您可以使用 [scikit-learn](http://machinelearningmastery.com/a-gentle-introduction-to-scikit-learn-a-python-machine-learning-library/ "A Gentle Introduction to Scikit-Learn: A Python Machine Learning Library") 將這些方法應用于 Python 中的數據。 **更新**:[有關更新的示例集](http://machinelearningmastery.com/prepare-data-machine-learning-python-scikit-learn/),請參閱此帖子。 [![Data Rescaling](https://img.kancloud.cn/fe/27/fe2705704c94617941b5696e8a816dbe_640x427.jpg)](https://3qeqpr26caki16dnhd19sv6by6v-wpengine.netdna-ssl.com/wp-content/uploads/2014/07/Data-Rescaling.jpg) 數據重新調整 照片由 [Quinn Dombrowski](https://www.flickr.com/photos/quinnanya/4508825094) 拍攝,保留一些權利。 ## 數據重新縮放 您的預處理數據可能包含各種數量的比例混合的屬性,如美元,千克和銷售量。 如果數據屬性具有相同的比例,許多機器學習方法期望或更有效。兩種流行的[數據縮放](http://en.wikipedia.org/wiki/Feature_scaling)方法是[標準化](http://en.wikipedia.org/wiki/Normalization_(statistics))和標準化。 ## 數據規范化 規范化是指將實值數字屬性重新縮放到 0 和 1 范圍內。 縮放依賴于值的大小的模型的輸入屬性是有用的,例如 k-最近鄰居中使用的距離度量以及回歸中的系數的準備。 以下示例演示了 Iris 花數據集的數據標準化。 Normalize the data attributes for the Iris dataset Python ``` # Normalize the data attributes for the Iris dataset. from sklearn.datasets import load_iris from sklearn import preprocessing # load the iris dataset iris = load_iris() print(iris.data.shape) # separate the data from the target attributes X = iris.data y = iris.target # normalize the data attributes normalized_X = preprocessing.normalize(X) ``` 有關更多信息,請參閱 API 文檔中的[規范化函數](http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.normalize.html)。 ## 數據標準化 標準化是指將每個屬性的分布轉換為平均值為零,標準差為 1(單位方差)。 標準化依賴于諸如高斯過程之類的屬性分布的模型的屬性是有用的。 以下示例演示了 Iris 花數據集的數據標準化。 Standardize the data attributes for the Iris dataset Python ``` # Standardize the data attributes for the Iris dataset. from sklearn.datasets import load_iris from sklearn import preprocessing # load the Iris dataset iris = load_iris() print(iris.data.shape) # separate the data and target attributes X = iris.data y = iris.target # standardize the data attributes standardized_X = preprocessing.scale(X) ``` 有關更多信息,請參閱 API 文檔中的[比例功能](http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.scale.html#sklearn.preprocessing.scale)。 ## 提示:使用哪種方法 在應用數據之前,很難知道重新調整數據是否會提高算法的表現。如果經常可以,但并非總是如此。 一個很好的建議是創建數據集的重新縮放副本,并使用您的測試工具和一些您想要檢查的算法將它們相互競爭。這可以快速突出顯示使用給定模型重新縮放數據的好處(或缺少),以及哪種重新縮放方法可能值得進一步調查。 ## 摘要 在應用機器學習算法之前,數據重新縮放是數據準備的重要部分。 在這篇文章中,您發現數據重新縮放適用于應用機器學習的過程和兩種方法:規范化和標準化,您可以使用 scikit-learn 庫在 Python 中重新縮放數據。 **Update**: [See this post for a more up to date set of?examples](http://machinelearningmastery.com/prepare-data-machine-learning-python-scikit-learn/).
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看