<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 如何使用 Scikit-Learn 在 Python 中加載數據 > 原文: [https://machinelearningmastery.com/how-to-load-data-in-python-with-scikit-learn/](https://machinelearningmastery.com/how-to-load-data-in-python-with-scikit-learn/) 在構建機器學習模型之前,需要將數據加載到內存中。 在這篇文章中,您將了解如何使用 [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 中加載機器學習數據。 * **更新 March / 2018** :添加了備用鏈接以下載數據集,因為原始圖像已被刪除。 [![load csv data](https://img.kancloud.cn/9b/74/9b74f0cc173b6aa04298b369c36ec161_640x440.jpg)](https://3qeqpr26caki16dnhd19sv6by6v-wpengine.netdna-ssl.com/wp-content/uploads/2014/07/load-csv-data.jpg) 加載 CSV 數據 照片由 [Jim Makos](https://www.flickr.com/photos/jim-makos/13775073055) 拍攝,保留一些權利 ## 打包數據集 scikit-learn 庫[與數據集](http://scikit-learn.org/stable/datasets/)打包在一起。在您自己的工作中使用它們之前,這些數據集對于獲取給定的機器學習算法或庫功能非常有用。 該秘籍演示了如何加載著名的[鳶尾花數據集](http://en.wikipedia.org/wiki/Iris_flower_data_set)。 Load the packaged iris flowers dataset Python ``` # Load the packaged iris flowers dataset # Iris flower dataset (4x150, reals, multi-label classification) iris = load_iris() print(iris) ``` ## 從 CSV 加載 在本地工作站或遠程服務器上將數據集作為 CSV 文件非常常見。 此秘籍向您展示如何從 URL 加載 CSV 文件,在這種情況下來自 [UCI 機器學習庫](https://archive.ics.uci.edu/ml/index.html)的 [Pima 印第安人糖尿病](https://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes)分類數據集(更新:[從此處下載](https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.data.csv))。 從準備好的 X 和 y 變量,您可以訓練機器學習模型。 Load the Pima Indians diabetes dataset from CSV URL Python ``` # Load the Pima Indians diabetes dataset from CSV URL import numpy as np import urllib # URL for the Pima Indians Diabetes dataset (UCI Machine Learning Repository) url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.data.csv" # download the file raw_data = urllib.urlopen(url) # load the CSV file as a numpy matrix dataset = np.loadtxt(raw_data, delimiter=",") print(dataset.shape) # separate the data from the target attributes X = dataset[:,0:7] y = dataset[:,8] ``` ## 摘要 在這篇文章中,您發現 scikit-learn 方法附帶打包數據集,包括虹膜花數據集。這些數據集可以輕松加載并用于探索和試驗不同的機器學習模型。 您還了解了如何使用 scikit-learn 加載 CSV 數據。您學習了一種使用 [urllib 庫](https://docs.python.org/2/library/urllib.html)從 Web 打開 CSV 文件的方法,以及如何將該數據作為 NumPy 矩陣讀取以用于 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>

                              哎呀哎呀视频在线观看