以鹰蛾嗅觉系统为模型的神经网络。

mothnet的Python项目详细描述


毒蛾

Build StatusDocumentation StatusMIT licensePython 3.6

此包包含python版本的MothNet

神经网络模仿鹰蛾的嗅觉系统,manduca sexta(如上图所示)。

This repository contains a Python version of the code used in:


Docs (via Sphinx)

安装

用于Mac/Linux系统-未在Windows中测试。

  • 需要python 3.6+

通过pip

pip install mothnet

来源

首先,克隆这个repo并cd到其中。然后运行:

# Install dependencies:  
pip install -r pymoth/docs/requirements.txt# Run sample experiment:
python pymoth/examples.py

依赖项(另请参见^{}


示例实验(另见^{}

importosimportpymothdefexperiment():# instantiate the MothNet objectmothra=pymoth.MothNet({'screen_size':(1920,1080),# screen size (width, height)'num_runs':1,# how many runs you wish to do with this moth'goal':15,# defines the moth's learning rates'tr_per_class':1,# (try 3) the number of training samples per class'num_sniffs':1,# (try 2) number of exposures each training sample'num_neighbors':1,# optimization param for nearest neighbors'box_constraint':1e1,# optimization parameter for svm'n_thumbnails':1,# show N experiment inputs from each class'show_acc_plots':True,# True to plot, False to ignore'show_time_plots':True,# True to plot, False to ignore'show_roc_plots':True,# True to plot, False to ignore'results_folder':'results',# string'results_filename':'results',# will get the run number appended to it'data_folder':'MNIST_all',# string'data_filename':'MNIST_all',# string})# loop through the number of simulations specified:forruninrange(mothra.NUM_RUNS):# generate datasetfeature_array=mothra.load_mnist()train_X,test_X,train_y,test_y=mothra.train_test_split(feature_array)# load parametersmothra.load_moth()# define moth model parametersmothra.load_exp()# define parameters of a time-evolution experiment# run simulation (SDE time-step evolution)sim_results=mothra.simulate(feature_array)# future: mothra.fit(X_train, y_train)# collect response statistics:# process the sim results to group EN responses by class and timeEN_resp_trained=mothra.collect_stats(sim_results,mothra.experiment_params,mothra._class_labels,mothra.SHOW_TIME_PLOTS,mothra.SHOW_ACC_PLOTS,images_filename=mothra.RESULTS_FILENAME,images_folder=mothra.RESULTS_FOLDER,screen_size=mothra.SCREEN_SIZE)# reveal scores# score MothNetmothra.score_moth_on_MNIST(EN_resp_trained)# score KNNmothra.score_knn(train_X,train_y,test_X,test_y)# score SVMmothra.score_svm(train_X,train_y,test_X,test_y)# plot each model in a subplot of a single figureifmothra.SHOW_ROC_PLOTS:mothra.show_multi_roc(['MothNet','SVM','KNN'],mothra._class_labels,images_filename=mothra.RESULTS_FOLDER+os.sep+mothra.RESULTS_FILENAME+'_ROC_multi')

样本结果

数据集

MNIST Data

模块


问题,评论,批评?请随便给我们一个e-mail

也欢迎错误报告、建议或请求!请随意create an issue

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用外部java程序在minecraft中移动minecraft角色的相机   java输出文本文件中的变量   java LazyLoadingException在我尝试从多通关系获取对象时出现   java json rest API的错误:ClassCastException:org。json。无法将JSONObject强制转换为组织。json。杰索纳雷   java BigInteger。C中的intValue()等价物#   java大写所有字符,但不包括带引号字符串中的字符   java获取特殊字符   javascript为什么Selenium中的所有getX()调用都需要这么长时间?   rabbitmq rabbitmq java客户端并行消费   如何使用selenium Java在popover窗口中提取文本   对象在java中构造一类对象   java Room数据库未实现   json JSONObject可以使用java保存大的格式化双值吗?   有时限的旅行推销员   java HttpsURLConnection openConnection查询   java无法使用Spring@Entity注释创建MySQL表   lambda Java 8仅映射到值类型集合   java提供OSGi服务而不实现接口   java单个对象重写对象数组,不确定原因