1
0
mirror of https://github.com/newnius/YAO-optimizer.git synced 2025-06-07 07:01:56 +00:00
This commit is contained in:
Newnius 2020-05-02 10:29:32 +08:00
parent e7652959af
commit 294ec8d853
2 changed files with 13 additions and 15 deletions

View File

@ -3,7 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="0aedafd8-e57e-462a-beda-65af0b91f3df" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/train.py" beforeDir="false" afterPath="$PROJECT_DIR$/train.py" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -48,7 +47,7 @@
<counts>
<entry key="Dockerfile" value="81" />
<entry key="md" value="104" />
<entry key="py" value="2631" />
<entry key="py" value="2638" />
<entry key="sh" value="5" />
</counts>
</usages-collector>
@ -57,7 +56,7 @@
<entry key="Bash" value="5" />
<entry key="Dockerfile" value="81" />
<entry key="Markdown" value="104" />
<entry key="Python" value="2631" />
<entry key="Python" value="2638" />
</counts>
</usages-collector>
</session>
@ -92,8 +91,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/train.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="310">
<caret line="105" column="24" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
<state relative-caret-position="277">
<caret line="73" column="55" selection-start-line="73" selection-start-column="45" selection-end-line="73" selection-end-column="55" />
<folding>
<element signature="e#0#28#0" expanded="true" />
</folding>
@ -225,7 +224,7 @@
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1588386307951" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1588386514130" />
<property name="go.gopath.indexing.explicitly.defined" value="true" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
@ -266,15 +265,16 @@
<option name="presentableId" value="Default" />
<updated>1588152877746</updated>
<workItem from="1588152880522" duration="16973000" />
<workItem from="1588319878551" duration="21139000" />
<workItem from="1588319878551" duration="21391000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="38112000" />
<option name="totallyTimeSpent" value="38364000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1280" height="800" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Designer" order="0" />
<window_info id="UI Designer" order="1" />
@ -396,8 +396,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/train.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="310">
<caret line="105" column="24" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
<state relative-caret-position="277">
<caret line="73" column="55" selection-start-line="73" selection-start-column="45" selection-end-line="73" selection-end-column="55" />
<folding>
<element signature="e#0#28#0" expanded="true" />
</folding>

View File

@ -59,19 +59,17 @@ def invert_scale(scaler, X, yhat):
# fit an LSTM network to training data
def fit_lstm(train, batch_size, nb_epoch, neurons):
t = train.shape[0] % batch_size
train = train[train.shape[0] - t * batch_size:]
def fit_lstm(train, batch_size2, nb_epoch, neurons):
X, y = train[:, 0:-1], train[:, -1]
X = X.reshape(X.shape[0], 1, X.shape[1])
model = Sequential()
model.add(LSTM(neurons, batch_input_shape=(batch_size, X.shape[1], X.shape[2]), stateful=True))
model.add(LSTM(neurons, batch_input_shape=(batch_size2, X.shape[1], X.shape[2]), stateful=True))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
for i in range(nb_epoch):
print("Epoch {}/{}".format(i, nb_epoch))
model.fit(X, y, epochs=1, batch_size=batch_size, verbose=0, shuffle=False)
model.fit(X, y, epochs=1, batch_size=batch_size2, verbose=0, shuffle=False)
model.reset_states()
return model