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

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如何通过jamod读取控制器的输入状态?   java Back bean方法在使用两个h的单一表单时未调用:selectonemenus和command button   mockitojava中的单元测试Mock继承方法   java在不传递到构造函数的情况下,将一个类的实例使用到另一个类中的最佳方法是什么   java Spring MVC:如何通过API在Dozer的toplevel字段中允许空值?   java hibernate到MSSQL服务器的连接被拒绝:连接   java动态调用现有变量   在java中扩展多个类的泛型   java使用JNA Ptrace获取linux中外部进程的信息?   eclipse获取Java项目中所有构建错误的最快方法是什么?   java将动态数组拆分为多个数组   java安卓:将json保存到sqlite   java获取最近时间Android   java如何为多对多关联编写HQL查询?   java Docker compose for mysql和spring应用程序拒绝访问   java查找数组(如果它是另一个数组的子集)   java如何在另一个具有相同数据类型参数的泛型类(或接口)中使用泛型类(或接口),而无需强制转换   Apache POI java。lang.NoClassDefFoundError:org/apache/commons/compress/utils/InputStreamStatistics   java使用Jackson将JSON反序列化为异构元素列表   使用MapReduce实现java规范化