MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / mlp

Function mlp

tf2.0/mlp_trader.py:84–99  ·  view source on GitHub ↗

A multi-layer perceptron

(input_dim, n_action, n_hidden_layers=1, hidden_dim=32)

Source from the content-addressed store, hash-verified

82
83
84def mlp(input_dim, n_action, n_hidden_layers=1, hidden_dim=32):
85 """ A multi-layer perceptron """
86
87 model = MLPRegressor(
88 hidden_layer_sizes=n_hidden_layers * [hidden_dim],
89 )
90
91 # since we'll be first using this to make a prediction with random weights
92 # we need to know the output size
93
94 # so we'll just start by fitting on some dummy data
95 X = np.random.randn(100, input_dim)
96 Y = np.random.randn(100, n_action)
97 model.partial_fit(X, Y)
98
99 return model
100
101
102

Callers 1

__init__Method · 0.70

Calls 1

partial_fitMethod · 0.45

Tested by

no test coverage detected