• 大小: 35.37MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-14
  • 语言: Python
  • 标签:

资源简介

基于深度神经网络和蒙特卡罗树搜索的神经网络搜索

资源截图

代码片段和文件信息

import numpy as np
from keras.layers.convolutional import Conv2D
from keras.layers import MaxPooling2D AveragePooling2D
from keras.layers.normalization import BatchNormalization
from keras.layers import Activation
from collections import OrderedDict
from itertools import combinations
import copy as cp
import collections
import json
import copy
import random
from datetime import datetime



class arch_generator:
    #nasbench test
    operators     = [ ‘conv1x1-bn-relu‘ ‘conv3x3-bn-relu‘ ‘maxpool3x3‘ ]
    MAX_NODES     = 6 #inclusive
    MAX_EDGES     = 9 #inclusive
    
    #maximal depth to go
    explore_depth = 5
    
    #common factors
    stride_low    = 1
    stride_up     = 1
    stride_step   = 1

    #convolution params
    filters_low   = 32
    filters_up    = 64 # 64 [filters_low filters_up]
    filter_step   = 32

    kernel_low    = 2
    kernel_up     = 4
    kernel_step   = 2

    #pooling params
    pooling_oprs  = [‘max‘ ‘avg‘]

    pool_size_low = 1
    pool_size_up  = 2
    pool_step     = 1
    types = {‘conv‘:0 ‘pool‘:1 ‘norm‘:2 ‘act‘:3}
    #store ranges to generate actions
    params_range = { }
    
    layer_code_len = 4
    
    def __init__(self):
        self.params_range = {“filters“:[self.filters_low self.filters_up] “kernel_size“:[self.kernel_low  self.kernel_up] 
            “pool_size“:[self.pool_size_low self.pool_size_up]
            “stride“:[self.stride_low self.stride_up] }
        random.seed(datetime.now())


    def query_param_range(self name):
        return self.params_range[name][0] self.params_range[name][1]
    
    def query_filter_step(self):
        return self.filter_step
    
    def query_kernel_step(self):
        return self.kernel_step
    
    def query_stride_step(self):
        return self.stride_step

    def query_pool_step(self):
        return self.pool_step
    
    def query_step(self params):
        if params == ‘filters‘:
            return self.query_filter_step()
        elif params == ‘kernel_size‘:
            return self.query_kernel_step()
        elif params == ‘stride‘:
            return self.query_stride_step()
        elif params == ‘pool_size‘:
            return self.query_pool_step()
        return None
    
    def get_min_conv_layer(self id):
        layer           = collections.OrderedDict()
        layer[‘id‘]     = id
        layer[‘type‘]   = ‘conv‘
        params          = collections.OrderedDict()
        params[‘filters‘]     = self.filters_low
        params[‘kernel_size‘] = self.kernel_low
        params[‘stride‘]      = self.stride_low
        layer[‘params‘]       = params
        return collections.OrderedDict(sorted(layer.items()))
    
    def get_min_pool_layer(self id):
        layer               = collections.OrderedDict()
        layer[‘id‘]         = id
        layer[‘type‘]       = ‘pool‘
        params              = collections.OrderedDict()
        params[‘pool_size‘] = self.pool_size_low
        params[‘stride‘]   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-15 20:49  AlphaX-NASBench101-master\
     文件       22853  2019-04-15 20:49  AlphaX-NASBench101-master\MCTS.py
     文件       20588  2019-04-15 20:49  AlphaX-NASBench101-master\MCTS_metaDNN.py
     文件        4538  2019-04-15 20:49  AlphaX-NASBench101-master\README.md
     目录           0  2019-04-15 20:49  AlphaX-NASBench101-master\alphax-1-net\
     文件    37907972  2019-04-15 20:49  AlphaX-NASBench101-master\alphax-1-net\AlphaX_1.pt
     文件        4909  2019-04-15 20:49  AlphaX-NASBench101-master\alphax-1-net\model.py
     文件        1765  2019-04-15 20:49  AlphaX-NASBench101-master\alphax-1-net\model_test.py
     文件        3237  2019-04-15 20:49  AlphaX-NASBench101-master\alphax-1-net\operations.py
     文件       12902  2019-04-15 20:49  AlphaX-NASBench101-master\arch_generator.py
     文件     1389407  2019-04-15 20:49  AlphaX-NASBench101-master\mcts_speed_nasbench.pdf
     文件      313997  2019-04-15 20:49  AlphaX-NASBench101-master\mcts_speed_nasbench.png
     文件       20511  2019-04-15 20:49  AlphaX-NASBench101-master\mcts_speed_nasbench_boxplot.pdf
     文件      502103  2019-04-15 20:49  AlphaX-NASBench101-master\mcts_viz.png
     文件        5086  2019-04-15 20:49  AlphaX-NASBench101-master\net_predictor.py
     文件        8698  2019-04-15 20:49  AlphaX-NASBench101-master\net_training.py

评论

共有 条评论