コード例 #1
0
    def __init__(self, learning_rate):
        n_features = eval('*'.join(str(e) for e in DB.feature_shape))
        n_classes = DB.n_classes
        self.lr = nn.parameter(learning_rate)
        # Step 3.1: set up learnable parameters/weights
        #######################################################################
        "*** YOUR CODE HERE ***"
        #######################################################################

        self.param = {
            "w1": nn.parameter(np.random.uniform(-0.01, 0.01, size=[n_features,neurons])),
            "w2": nn.parameter(np.random.uniform(-0.01, 0.01, size=[neurons, n_classes])),
            "b1": nn.parameter(np.random.uniform(-0.01, 0.01, size=[neurons])),
            "b2": nn.parameter(np.random.uniform(-0.01, 0.01, size=[n_classes])),

        }
コード例 #2
0
 def __init__(self, learning_rate):
     n_features = eval('*'.join(str(e) for e in DB.feature_shape))
     n_classes = DB.n_classes
     self.lr = nn.parameter(learning_rate)
     # Step 3.1: set up learnable parameters/weights. w's should be drawn
     # from a zero-mean normal distribution. b's should be set to 0
     #######################################################################
     "*** YOUR CODE HERE ***"
     #######################################################################
     self.param = {
         'w1':
         nn.parameter.from_numpy(
             numpy.random.normal(0, 0.01, [n_features, 256])),
         'w2':
         nn.parameter.from_numpy(numpy.random.normal(0, 0.01, [256, 256])),
         'w3':
         nn.parameter.from_numpy(numpy.random.normal(0, 0.01, [256, 256])),
         'w4':
         nn.parameter.from_numpy(numpy.random.normal(0, 0.01, [256, 256])),
         'w5':
         nn.parameter.from_numpy(
             numpy.random.normal(0, 0.01, [256, n_classes])),
         'b1':
         nn.parameter.zeros(256),
         'b2':
         nn.parameter.zeros(256),
         'b3':
         nn.parameter.zeros(256),
         'b4':
         nn.parameter.zeros(256),
         'b5':
         nn.parameter.zeros(n_classes)
     }
コード例 #3
0
 def __init__(self, learning_rate):
     n_features = eval('*'.join(str(e) for e in DB.feature_shape))
     n_classes = DB.n_classes
     self.lr = nn.parameter(learning_rate)
     # Step 3.1: set up learnable parameters/weights. w's should be drawn
     # from a zero-mean normal distribution. b's should be set to 0
     #######################################################################
     "*** YOUR CODE HERE ***"
     #######################################################################
     self.param = {
         # "name": nn.parameter(blah, blah)
         "w": nn.parameter(np.random.uniform(-0.1, 0.1, [n_features, 512])),
         "b": nn.parameter.zeros([512]),
         "w1": nn.parameter(np.random.uniform(-0.05, 0.05, [512, 256])),
         "b1": nn.parameter.zeros([256]),
         "w2": nn.parameter(np.random.uniform(-0.01, 0.01,
                                              [256, n_classes])),
         "b2": nn.parameter.zeros([n_classes]),
     }
コード例 #4
0
    def __init__(self, learning_rate):
        n_features = eval('*'.join(str(e) for e in DB.feature_shape))
        n_classes = DB.n_classes
        self.lr = nn.parameter(learning_rate)
        # Step 3.1: set up learnable parameters/weights
        #######################################################################
        "*** YOUR CODE HERE ***"
        #######################################################################

        self.param = {
            "w1":
            nn.parameter(
                np.add(np.zeros((n_features, intermediate_val_1)),
                       np.random.rand(n_features, intermediate_val_1) - 0.5)),
            "w2":
            nn.parameter(
                np.add(
                    np.zeros((intermediate_val_1, intermediate_val_2)),
                    np.random.rand(intermediate_val_1, intermediate_val_2) -
                    0.5)),
            "w3":
            nn.parameter(
                np.add(
                    np.zeros((intermediate_val_2, intermediate_val_3)),
                    np.random.rand(intermediate_val_2, intermediate_val_3) -
                    0.5)),
            "w4":
            nn.parameter(
                np.add(np.zeros((intermediate_val_3, n_classes)),
                       np.random.rand(intermediate_val_3, n_classes) - 0.5)),
            "b1":
            nn.parameter.zeros(intermediate_val_1),
            "b2":
            nn.parameter.zeros(intermediate_val_2),
            "b3":
            nn.parameter.zeros(intermediate_val_3),
            "b4":
            nn.parameter.zeros(n_classes),
        }
コード例 #5
0
    def __init__(self, learning_rate):
        n_features = eval('*'.join(str(e) for e in DB.feature_shape))
        n_classes = DB.n_classes
        self.lr = nn.parameter(learning_rate)
        # Step 3.1: set up learnable parameters/weights
        #######################################################################
        "*** YOUR CODE HERE ***"
        #######################################################################

        self.param = {

            #Weight1
            "w1":
            nn.parameter(
                np.asmatrix(
                    np.random.rand(n_features, hidden_layer_level_1_size) -
                    0.50)),
            #Weight2
            "w2":
            nn.parameter(
                np.asmatrix(
                    np.random.rand(hidden_layer_level_1_size,
                                   hidden_layer_level_2_size) - 0.5)),
            #Weight3
            "w3":
            nn.parameter(
                np.asmatrix(
                    np.random.rand(hidden_layer_level_2_size, n_classes) -
                    0.50)),
            #Bias1
            "b1":
            nn.parameter.zeros(hidden_layer_level_1_size),
            #Bias2
            "b2":
            nn.parameter.zeros(hidden_layer_level_2_size),
            #Bias3
            "b3":
            nn.parameter.zeros(n_classes),
        }