Skip to Content
PythonによるAIプログラミング入門 ―ディープラーニングを始める前に身につけておくべき15の基礎技術
book

PythonによるAIプログラミング入門 ―ディープラーニングを始める前に身につけておくべき15の基礎技術

by Prateek Joshi, 相川 愛三
March 2019
Intermediate to advanced
424 pages
5h 18m
Japanese
O'Reilly Japan, Inc.
Content preview from PythonによるAIプログラミング入門 ―ディープラーニングを始める前に身につけておくべき15の基礎技術

5章推薦エンジンを作る

本章では次の事柄について学びます。

  • 訓練パイプライン
  • 最近傍点の抽出
  • k-最近傍(NN)分類器
  • 類似度の計算
  • 協調フィルタを用いた類似ユーザーの検索
  • 映画の推薦システムの作成

5.1 訓練パイプライン

機械学習システムは、さまざまなモジュールを組み合わせて作られることが多いです。ある順番でモジュールを組み合わせて目標を達成します。scikit-learnライブラリには、さまざまなモジュールを連結してパイプラインを形成できる関数があります。モジュールと対応するパラメータを指定するだけで済むのです。パイプラインを作れば、データを処理してシステムを訓練してくれます。

パイプラインは、特徴選択、前処理、ランダムフォレスト、クラスタリングなど、さまざまな機能を実行するモジュールを含むことができます。本節では、入力データ点から上位k個の特徴量を選択し、ERT分類器を使って分類するパイプラインの作り方を説明します。

Jupyter Notebookで、Python 3のタブを作り、最初のセルに次のように入力してください。

from sklearn.datasets import samples_generator
from sklearn.feature_selection import SelectKBest, f_regression
from sklearn.pipeline import Pipeline
from sklearn.ensemble import ExtraTreesClassifier

訓練用と検証用に、適当なラベル付きデータを生成します。scikit-learnパッケージには、データ生成関数が備わっています。次に示すように、25次元の特徴ベクトルで表されるデータを150個生成します。各データには6つの情報特徴量があり、重複する特徴量はありません。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

行動を変えるデザイン ―心理学と行動経済学をプロダクトデザインに活用する

行動を変えるデザイン ―心理学と行動経済学をプロダクトデザインに活用する

Stephen Wendel, 武山 政直, 相島 雅樹, 反中 望, 松村 草也
詳説 イーサネット 第2版

詳説 イーサネット 第2版

Charles E. Spurgeon, Joann Zimmerman, 三浦 史光, 豊沢 聡

Publisher Resources

ISBN: 9784873118727Other