Skip to main content

Metaheuristic tools for deep learning models

Project description

nyto

nyto是一款輕量化的python庫,方便使用者快速開發元啟發算法(metaheuristic)訓練內建的深度學習模型。

說明

基於梯度下降的深度學習工具可以幫助我們快速建立並訓練深度學習模型,然而在有些情況下基於梯度下降的訓練方式可能會遇到問題,這時後我們可以借助其他優化方式來達成目的。

本庫提供了一個界面,方便使用者編寫自己的元啟發算法來優化網路。而倘若你對編寫算法沒有興趣,本庫也已經內建了一個基於粒子群算法(Particle swarm optimization)的算法可供使用。

詳細介紹可以查看Introduction_of_nyto,該頁面提供了使用介紹和範例程式。

快速入門

安裝

安裝nyto需要預先安裝python3.6或更高的版本,以及pip和numpy。而通常pip會與python一起安裝。

從PyPI安裝:

$ pip install nyto

快速建立網路

在nyto中建立網路分成兩步驟:

  1. 導入模型: 可以想成是建立網路所需的零件
  2. 連接節點: 可以想成是將零件組成網路
from nyto import net_tool as to
from nyto import layer
from nyto import unit_function as uf

# 導入模型
my_net, node = to.new_net()
node.layer1 = layer.new_nn_layer((4,12))
node.layer2 = layer.new_nn_layer((12,3))

# 連接節點
node.layer1_output = node.layer1_input >> node.layer1 >> uf.tanh()
node.layer2_output = node.layer1_output >> node.layer2 >> uf.softmax()

粒子運算

在nyto中,網路都是視為粒子群演算法中的粒子,當對網路做+1的操作時,網路中的所有參數都會+1。而當我們將多個網路進行粒子運算時,則可以實現元啟發算法中所有優化所需的一切功能。

網路與數值運算

當對網路本身進行運算時,可以視為對粒子的移動:

new_net = my_net + 1

網路間運算

當網路對網路進行運算時,可以視為對粒子進行組合:

new_net = my_net + other_net

取得某些節點的輸出值

當想要查看特定網路中節點的輸出結果時可以使用net_tool.get來查看:

from nyto.net_tool import get

layer1_return,layer2_return = get(node.layer1_output, node.layer2_output)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nyto-0.0.8.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nyto-0.0.8-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file nyto-0.0.8.tar.gz.

File metadata

  • Download URL: nyto-0.0.8.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for nyto-0.0.8.tar.gz
Algorithm Hash digest
SHA256 32e81d199c772bdcf0f2b3cd76210f4f026c9368e76062bd92dad5daba6ae155
MD5 ff767e4c57d02d0705f20ba2234c3818
BLAKE2b-256 f94fc16e56eb049eba98817bff0f52edfa73709e9489fed61a217bfb91c92cf7

See more details on using hashes here.

File details

Details for the file nyto-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: nyto-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for nyto-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7b2c1803314d8a68bd910e03841e67b398eb0fcec8b4c0422fccee5afa11cc
MD5 05f64556a7468aa667a8eb3d50f45a24
BLAKE2b-256 660d0e76133754782486c0d9a7257577b6af34009e0b3388cd27ad18cee854b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page