Rewrite linear regression (0/1)
This commit is contained in:
parent
8d2a814d44
commit
f5b038ce64
@ -2,7 +2,7 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="jdk" jdkName="Python 3.8 (untitled)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -3,5 +3,5 @@
|
|||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (untitled)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
@ -46,8 +46,8 @@ def read_words(input_path):
|
|||||||
return vocabulary
|
return vocabulary
|
||||||
|
|
||||||
def train(vocabulary,input_train,expected_train):
|
def train(vocabulary,input_train,expected_train):
|
||||||
learning_rate=0.0001
|
learning_rate=0.01
|
||||||
learning_precision=0.00000001
|
learning_precision=0.000001
|
||||||
words_vocabulary={}
|
words_vocabulary={}
|
||||||
with open(input_train,encoding='utf-8') as input_file, open(expected_train,encoding='utf-8') as expected_file:
|
with open(input_train,encoding='utf-8') as input_file, open(expected_train,encoding='utf-8') as expected_file:
|
||||||
for line, exp in zip(input_file,expected_file):
|
for line, exp in zip(input_file,expected_file):
|
||||||
@ -104,7 +104,7 @@ def main():
|
|||||||
vocabulary=define_vocabulary('train/in.tsv');
|
vocabulary=define_vocabulary('train/in.tsv');
|
||||||
weights, words = train(vocabulary,'train/in.tsv','train/expected.tsv')
|
weights, words = train(vocabulary,'train/in.tsv','train/expected.tsv')
|
||||||
prediction('dev-0/in.tsv','dev-0/out.tsv',weights,words)
|
prediction('dev-0/in.tsv','dev-0/out.tsv',weights,words)
|
||||||
prediction('test-A/in.tsv/in.tsv','test-A/out.tsv',weights,words)
|
prediction('test-A/in.tsv','test-A/out.tsv',weights,words)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
5272
dev-0/in.tsv
Normal file
5272
dev-0/in.tsv
Normal file
File diff suppressed because one or more lines are too long
2910
dev-0/out.tsv
2910
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
5152
test-A/in.tsv
Normal file
5152
test-A/in.tsv
Normal file
File diff suppressed because one or more lines are too long
3028
test-A/out.tsv
3028
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user