Added test for y

This commit is contained in:
lkrsnik 2017-07-06 09:11:31 +02:00
parent ca53eedece
commit e4e111f029
2 changed files with 28 additions and 28 deletions

View File

@ -4,7 +4,7 @@
<list default="true" id="8a8ba9af-e1a4-433a-9968-475192610776" name="Default" comment=""> <list default="true" id="8a8ba9af-e1a4-433a-9968-475192610776" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" afterPath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" afterPath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v1/character_based_ffnn_keras.ipynb" afterPath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v1/character_based_ffnn_keras.ipynb" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/prepare_data.py" afterPath="$PROJECT_DIR$/prepare_data.py" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -31,11 +31,11 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="prepare_data.py" pinned="false" current-in-tab="false"> <file leaf-file-name="prepare_data.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/prepare_data.py"> <entry file="file://$PROJECT_DIR$/prepare_data.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5616"> <state relative-caret-position="234">
<caret line="318" column="23" lean-forward="false" selection-start-line="318" selection-start-column="23" selection-end-line="318" selection-end-column="23" /> <caret line="93" column="32" lean-forward="true" selection-start-line="93" selection-start-column="32" selection-end-line="93" selection-end-column="32" />
<folding> <folding>
<element signature="e#24#63#0" expanded="true" /> <element signature="e#24#63#0" expanded="true" />
</folding> </folding>
@ -46,7 +46,7 @@
<file leaf-file-name="workbench.py" pinned="false" current-in-tab="false"> <file leaf-file-name="workbench.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/workbench.py"> <entry file="file://$PROJECT_DIR$/workbench.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="666"> <state relative-caret-position="396">
<caret line="37" column="68" lean-forward="false" selection-start-line="37" selection-start-column="68" selection-end-line="37" selection-end-column="68" /> <caret line="37" column="68" lean-forward="false" selection-start-line="37" selection-start-column="68" selection-end-line="37" selection-end-column="68" />
<folding> <folding>
<element signature="e#53#92#0" expanded="true" /> <element signature="e#53#92#0" expanded="true" />
@ -55,7 +55,7 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="character_based_ffnn_keras.ipynb" pinned="false" current-in-tab="true"> <file leaf-file-name="character_based_ffnn_keras.ipynb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb"> <entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb">
<provider selected="true" editor-type-id="ipnb-editor"> <provider selected="true" editor-type-id="ipnb-editor">
<state> <state>
@ -161,10 +161,10 @@
<option value="$PROJECT_DIR$/theano_tutorial/logistic_regression.py" /> <option value="$PROJECT_DIR$/theano_tutorial/logistic_regression.py" />
<option value="$PROJECT_DIR$/theano_tutorial/logistic_regression_loop.py" /> <option value="$PROJECT_DIR$/theano_tutorial/logistic_regression_loop.py" />
<option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/cnn_test_on_other_attributes.ipynb" /> <option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/cnn_test_on_other_attributes.ipynb" />
<option value="$PROJECT_DIR$/prepare_data.py" />
<option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.py" /> <option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.py" />
<option value="$PROJECT_DIR$/workbench.py" /> <option value="$PROJECT_DIR$/workbench.py" />
<option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" /> <option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.ipynb" />
<option value="$PROJECT_DIR$/prepare_data.py" />
</list> </list>
</option> </option>
</component> </component>
@ -871,8 +871,8 @@
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/cnn_test_on_other_attributes.ipynb" /> <entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/cnn_test_on_other_attributes.ipynb" />
<entry file="file://$PROJECT_DIR$/prepare_data.py"> <entry file="file://$PROJECT_DIR$/prepare_data.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5616"> <state relative-caret-position="234">
<caret line="318" column="23" lean-forward="false" selection-start-line="318" selection-start-column="23" selection-end-line="318" selection-end-column="23" /> <caret line="93" column="32" lean-forward="true" selection-start-line="93" selection-start-column="32" selection-end-line="93" selection-end-column="32" />
<folding> <folding>
<element signature="e#24#63#0" expanded="true" /> <element signature="e#24#63#0" expanded="true" />
</folding> </folding>
@ -931,7 +931,7 @@
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.py" /> <entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/character_based_ffnn_keras.py" />
<entry file="file://$PROJECT_DIR$/workbench.py"> <entry file="file://$PROJECT_DIR$/workbench.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="666"> <state relative-caret-position="396">
<caret line="37" column="68" lean-forward="false" selection-start-line="37" selection-start-column="68" selection-end-line="37" selection-end-column="68" /> <caret line="37" column="68" lean-forward="false" selection-start-line="37" selection-start-column="68" selection-end-line="37" selection-end-column="68" />
<folding> <folding>
<element signature="e#53#92#0" expanded="true" /> <element signature="e#53#92#0" expanded="true" />

View File

@ -79,24 +79,24 @@ def load_shuffle_vector(file_name):
# functions for saving and loading model - ONLY WHERE KERAS IS NOT NEEDED # functions for saving and loading model - ONLY WHERE KERAS IS NOT NEEDED
def save_model(model, file_name): # def save_model(model, file_name):
h5f = h5py.File(file_name, 'w') # h5f = h5py.File(file_name, 'w')
adict = dict(W1=model['W1'], b1=model['b1'], W2=model['W2'], b2=model['b2']) # adict = dict(W1=model['W1'], b1=model['b1'], W2=model['W2'], b2=model['b2'])
for k,v in adict.items(): # for k,v in adict.items():
h5f.create_dataset(k,data=v) # h5f.create_dataset(k,data=v)
#
h5f.close() # h5f.close()
#
#
def load_model(file_name): # def load_model(file_name):
h5f = h5py.File(file_name,'r') # h5f = h5py.File(file_name,'r')
model = {} # model = {}
W1.set_value(h5f['W1'][:]) # W1.set_value(h5f['W1'][:])
b1.set_value(h5f['b1'][:]) # b1.set_value(h5f['b1'][:])
W2.set_value(h5f['W2'][:]) # W2.set_value(h5f['W2'][:])
b2.set_value(h5f['b2'][:]) # b2.set_value(h5f['b2'][:])
h5f.close() # h5f.close()
return model # return model
# functions for creating X and y from content # functions for creating X and y from content
def read_content(): def read_content():