2017年7月29日のブックマーク (8件)

  • GithubにPythonのライブラリをあげてpipでインストールする | junion blog

    概要 Githubで独自のPythonライブラリを管理して,pipでインストールができるようにする方法です. ディレクトリ構成 まずは,pipでインストールできる構成にするために,ディレクトリを以下のように構成します. pip_github概要 Githubで独自のPythonライブラリを管理して,pipでインストールができるようにする方法です. ディレクトリ構成 まずは,pipでインストールできる構成にするために,ディレクトリを以下のように構成します. pip_github_test |--pip_github_test | |--__init__.py | |--test.py |--README.md |--setup.py 各要素の説明 __init__.py pip_github_testがPythonライブラリであることを示すためのファイルです.中身は空でも良いのですが,ライブ

    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “自信のあるライブラリができたら,PyPIへ登録して公開しましょう.そうすることで,$ sudo pip install LIBRARY_NAMEでインストールできるようになります.PyPIへ登録するためには,PyPIアカウントが必要です. https://pypi.python.org/p
  • The lxml.etree Tutorial

    This is a tutorial on XML processing with lxml.etree. It briefly overviews the main concepts of the ElementTree API, and some simple enhancements that make your life as a programmer easier. For a complete reference of the API, see the generated API documentation.

    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “Tree iteration For problems like the above, where you want to recursively traverse the tree and do something with its elements, tree iteration is a very convenient solution. Elements provide a tree iterator for this purpose. It yields elements in document order, i.e. in the order their tags would
  • ライブラリ: lxml.etree

    lxml.etree は XML 形式のデータを Python で手軽に扱えるようにするライブラリです。 XML 形式のデータがカンタンに扱えるさまざまな機能を備えています。 私は jQuery と同等の機能を提供する PyQuery というライブラリを使うのに必要だったので入れました。 以下 lxml.etree の基礎的な使い方を見ていきます。 01 インスタンスの作成 lxml.etree において主役となるのは Element と呼ばれるクラスです。 from lxml import etree root = etree.Element("root") print type(root).__name__ # _Elementと表示 print root.tag child1 = etree.SubElement(root, "child1") root.append(etree.E

    ライブラリ: lxml.etree
    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “from lxml import etree root = etree.Element("root") print type(root).__name__ # _Elementと表示 print root.tag”
  • PythonとBeautiful Soupでスクレイピング - Qiita

    Pythonスクレイピングというネタはすでに世の中にもQiitaにもたくさん溢れていますが、なんとなくpyqueryが使いやすいという情報が多い気がします。個人的にはBeautiful Soupの良さも知ってもらいたいと思うのでここではBeautiful Soupを使っていきたいと思います。 ちなみにこのエントリーはほとんどの部分がBeautiful Soup4のドキュメントの要約です。もっと詳しい情報が知りたい場合はドキュメントをご覧ください。 英語 http://www.crummy.com/software/BeautifulSoup/bs4/doc/ 日語 http://kondou.com/BS4/ よくある勘違い pyqueryはjQueryのようにcssセレクタを使ってHTMLを扱うことができる点がBeautiful Soupよりも使い易いという意見がありますが、それBe

    PythonとBeautiful Soupでスクレイピング - Qiita
    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “HTMLパーサーについて HTMLパーサーは通常Python標準のhtml.parserが使用されますが、lxmlやhtml5libがインストールされている場合はそちらが優先されて使われます。明示的に指定する場合は下のように指定します。 soup = BeautifulSo
  • Python の zip( ) は、3つ以上のシーケンス・オブジェクトでも、同時にループできる ~4つまでテストして、成功した件 - Qiita

    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “引数を3つとる3変数関数、4つとる4変数関数・・・を渡して、3つ以上のシーケンス・オブジェクトの同じ番地の要素同士の演算を行うことができます。 ”
  • torch.nn — PyTorch 2.3 documentation

    Learn Get Started Run PyTorch locally or get started quickly with one of the supported cloud platforms Tutorials Whats new in PyTorch tutorials Learn the Basics Familiarize yourself with PyTorch concepts and modules PyTorch Recipes Bite-size, ready-to-deploy PyTorch code examples Intro to PyTorch - YouTube Series Master PyTorch basics with our engaging YouTube tutorial series

    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    “Base class for all neural network modules. Your models should also subclass this class. Modules can also contain other Modules, allowing to nest them in a tree structure. You can assign the submodules as regular attributes: import torch.nn as nn import torch.nn.functional as F class Model(nn.Modu
  • 実践Pytorch - Qiita

    Pytorchのバージョンが0.4になり大きな変更があったため記事の書き直しを行いました。 初めに この記事は深層学習フレームワークの一つであるPytorchによるモデルの定義の方法、学習の方法、自作関数の作り方について備忘録です。 インストール Pytorchはcondaやpipで簡単にインストールすることができます。こちらからosやpython,cudaのバージョンを選択すると適したスクリプトが表示されるのでコピペすればインストールが可能です。(cudaやcudnnは別途セットアップが必要) 現状はlinuxosxのみでwindowsには対応してないようです。(0.4よりwindowsも公式でサポートされました。) 公式チュートリアル これからPytorchを使ってみようという人はこの記事よりも公式のチュートリアルが非常にわかりやすいのでそちらを参考にしたほうがいいです。またexa

    実践Pytorch - Qiita
    kent-where-the-light-is
    kent-where-the-light-is 2017/07/29
    Pytorchではtorchvision.modelsを使うことでAlexNet、VGGNet、ResNet、DenseNet、SqueezeNet、GoogleNetが簡単に定義可能で、またこれらの学習済みモデルを簡単に使用することができます。
  • GitHub - ikegami-yukino/jaconv: Pure-Python Japanese character interconverter for Hiragana, Katakana, Hankaku, and Zenkaku

    import jaconv # Hiragana to Katakana jaconv.hira2kata('ともえまみ') # => 'トモエマミ' # Hiragana to half-width Katakana jaconv.hira2hkata('ともえまみ') # => 'トモエマミ' # Katakana to Hiragana jaconv.kata2hira('巴マミ') # => '巴まみ' # half-width character to full-width character # default parameters are followings: kana=True, ascii=False, digit=False jaconv.h2z('ティロ・フィナーレ') # => 'ティロ・フィナーレ' # half-width character to full-

    GitHub - ikegami-yukino/jaconv: Pure-Python Japanese character interconverter for Hiragana, Katakana, Hankaku, and Zenkaku