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.5.tar.gz (17.6 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.5-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nyto-0.0.5.tar.gz
  • Upload date:
  • Size: 17.6 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.5.tar.gz
Algorithm Hash digest
SHA256 165bfeb1103ec59e0784f837b8a80c1ff7359c2fb8df7ef9d8d581631550d91a
MD5 3426c73f5f8694486ff8e71ccf67e664
BLAKE2b-256 e2e5ffa1b4eefd40208325fdcf00e77c8a4d291952898ad0d63c04df21c1656e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nyto-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eabcf173fdc3aec7fee4eedb7530d0bfbe48d14721ffa5a96bc3e2b270ed1d8d
MD5 6036c9d39ee90362d0d3fa34b3530f86
BLAKE2b-256 27f997e31bb9f70ae54cb40fb2e84b88c761567ca861bdfcfa73fc377de61a78

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