change of dic
This commit is contained in:
parent
c489223077
commit
8c8f903b11
1212
dev-0/.ipynb_checkpoints/run-checkpoint.ipynb
Normal file
1212
dev-0/.ipynb_checkpoints/run-checkpoint.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1059
dev-0/run.ipynb
1059
dev-0/run.ipynb
File diff suppressed because it is too large
Load Diff
40
dev-0/run.py
40
dev-0/run.py
@ -17,21 +17,17 @@ tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0
|
||||
# In[139]:
|
||||
|
||||
|
||||
expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
#expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
|
||||
|
||||
# In[94]:
|
||||
|
||||
|
||||
print(len(expected))
|
||||
print(len(tsv_data))
|
||||
|
||||
|
||||
# In[158]:
|
||||
|
||||
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta'}
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer', 'piłka', 'metal'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta', 'narzeczony', 'ślub'}
|
||||
male = {x[:6].lower() for x in male}
|
||||
female = {x[:6].lower() for x in female}
|
||||
|
||||
@ -51,41 +47,41 @@ for document in tsv_data:
|
||||
|
||||
|
||||
male_or_female=[]
|
||||
|
||||
for doc in trimmed_docs:
|
||||
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
|
||||
|
||||
|
||||
doc_mean = sum(map(len, trimmed_docs))/float(len(trimmed_docs))
|
||||
# In[161]:
|
||||
|
||||
|
||||
print(doc_mean)
|
||||
answers=[]
|
||||
for i in male_or_female:
|
||||
if i[0]>i[1]:
|
||||
for i in range(len(male_or_female)):
|
||||
if male_or_female[i][0]>male_or_female[i][1]:
|
||||
answers.append(1)
|
||||
else:
|
||||
elif male_or_female[i][0]<male_or_female[i][1]:
|
||||
answers.append(0)
|
||||
else:
|
||||
if len(trimmed_docs[i]) < doc_mean:
|
||||
answers.append(0)
|
||||
else:
|
||||
answers.append(1)
|
||||
|
||||
|
||||
|
||||
# In[162]:
|
||||
|
||||
|
||||
"""
|
||||
result=[]
|
||||
for i in range(len(answers)):
|
||||
if answers[i]==expected[i]:
|
||||
result.append(1)
|
||||
else:
|
||||
result.append(0)
|
||||
"""
|
||||
|
||||
|
||||
# In[163]:
|
||||
|
||||
|
||||
print(f'Predykcja modelu wynosi {sum(result)/len(result)*100:.6f}%')
|
||||
|
||||
|
||||
# In[167]:
|
||||
|
||||
|
||||
df = pd.DataFrame(result)
|
||||
df = pd.DataFrame(answers)
|
||||
df.to_csv('out.tsv', sep = '\t')
|
||||
|
||||
|
156607
dev-1/out.tsv
Normal file
156607
dev-1/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
87
dev-1/run.py
Normal file
87
dev-1/run.py
Normal file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# In[90]:
|
||||
|
||||
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
|
||||
# In[91]:
|
||||
|
||||
|
||||
tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0]
|
||||
|
||||
|
||||
# In[139]:
|
||||
|
||||
|
||||
#expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# In[158]:
|
||||
|
||||
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer', 'piłka', 'metal'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta', 'narzeczony', 'ślub'}
|
||||
male = {x[:6].lower() for x in male}
|
||||
female = {x[:6].lower() for x in female}
|
||||
|
||||
|
||||
# In[159]:
|
||||
|
||||
|
||||
trimmed_docs=[]
|
||||
for document in tsv_data:
|
||||
new_doc=[]
|
||||
for word in str(document).lower().split():
|
||||
new_doc.append(word[:6])
|
||||
trimmed_docs.append(new_doc)
|
||||
|
||||
|
||||
# In[160]:
|
||||
|
||||
|
||||
male_or_female=[]
|
||||
|
||||
for doc in trimmed_docs:
|
||||
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
|
||||
|
||||
doc_mean = sum(map(len, trimmed_docs))/float(len(trimmed_docs))
|
||||
# In[161]:
|
||||
|
||||
print(doc_mean)
|
||||
answers=[]
|
||||
for i in range(len(male_or_female)):
|
||||
if male_or_female[i][0]>male_or_female[i][1]:
|
||||
answers.append(1)
|
||||
elif male_or_female[i][0]<male_or_female[i][1]:
|
||||
answers.append(0)
|
||||
else:
|
||||
if len(trimmed_docs[i]) < doc_mean:
|
||||
answers.append(0)
|
||||
else:
|
||||
answers.append(1)
|
||||
|
||||
|
||||
|
||||
# In[162]:
|
||||
|
||||
"""
|
||||
result=[]
|
||||
for i in range(len(answers)):
|
||||
if answers[i]==expected[i]:
|
||||
result.append(1)
|
||||
else:
|
||||
result.append(0)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
df = pd.DataFrame(answers)
|
||||
df.to_csv('out.tsv', sep = '\t')
|
||||
|
87
run.py
Normal file
87
run.py
Normal file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# In[90]:
|
||||
|
||||
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
|
||||
# In[91]:
|
||||
|
||||
|
||||
tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0]
|
||||
|
||||
|
||||
# In[139]:
|
||||
|
||||
|
||||
#expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# In[158]:
|
||||
|
||||
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer', 'piłka', 'metal'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta', 'narzeczony', 'ślub'}
|
||||
male = {x[:6].lower() for x in male}
|
||||
female = {x[:6].lower() for x in female}
|
||||
|
||||
|
||||
# In[159]:
|
||||
|
||||
|
||||
trimmed_docs=[]
|
||||
for document in tsv_data:
|
||||
new_doc=[]
|
||||
for word in str(document).lower().split():
|
||||
new_doc.append(word[:6])
|
||||
trimmed_docs.append(new_doc)
|
||||
|
||||
|
||||
# In[160]:
|
||||
|
||||
|
||||
male_or_female=[]
|
||||
|
||||
for doc in trimmed_docs:
|
||||
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
|
||||
|
||||
doc_mean = sum(map(len, trimmed_docs))/float(len(trimmed_docs))
|
||||
# In[161]:
|
||||
|
||||
print(doc_mean)
|
||||
answers=[]
|
||||
for i in range(len(male_or_female)):
|
||||
if male_or_female[i][0]>male_or_female[i][1]:
|
||||
answers.append(1)
|
||||
elif male_or_female[i][0]<male_or_female[i][1]:
|
||||
answers.append(0)
|
||||
else:
|
||||
if len(trimmed_docs[i]) < doc_mean:
|
||||
answers.append(0)
|
||||
else:
|
||||
answers.append(1)
|
||||
|
||||
|
||||
|
||||
# In[162]:
|
||||
|
||||
"""
|
||||
result=[]
|
||||
for i in range(len(answers)):
|
||||
if answers[i]==expected[i]:
|
||||
result.append(1)
|
||||
else:
|
||||
result.append(0)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
df = pd.DataFrame(answers)
|
||||
df.to_csv('out.tsv', sep = '\t')
|
||||
|
134619
test-A/out.tsv
Normal file
134619
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
87
test-A/run.py
Normal file
87
test-A/run.py
Normal file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# In[90]:
|
||||
|
||||
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
|
||||
# In[91]:
|
||||
|
||||
|
||||
tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0]
|
||||
|
||||
|
||||
# In[139]:
|
||||
|
||||
|
||||
#expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# In[158]:
|
||||
|
||||
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer', 'piłka', 'metal'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta', 'narzeczony', 'ślub'}
|
||||
male = {x[:6].lower() for x in male}
|
||||
female = {x[:6].lower() for x in female}
|
||||
|
||||
|
||||
# In[159]:
|
||||
|
||||
|
||||
trimmed_docs=[]
|
||||
for document in tsv_data:
|
||||
new_doc=[]
|
||||
for word in str(document).lower().split():
|
||||
new_doc.append(word[:6])
|
||||
trimmed_docs.append(new_doc)
|
||||
|
||||
|
||||
# In[160]:
|
||||
|
||||
|
||||
male_or_female=[]
|
||||
|
||||
for doc in trimmed_docs:
|
||||
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
|
||||
|
||||
doc_mean = sum(map(len, trimmed_docs))/float(len(trimmed_docs))
|
||||
# In[161]:
|
||||
|
||||
print(doc_mean)
|
||||
answers=[]
|
||||
for i in range(len(male_or_female)):
|
||||
if male_or_female[i][0]>male_or_female[i][1]:
|
||||
answers.append(1)
|
||||
elif male_or_female[i][0]<male_or_female[i][1]:
|
||||
answers.append(0)
|
||||
else:
|
||||
if len(trimmed_docs[i]) < doc_mean:
|
||||
answers.append(0)
|
||||
else:
|
||||
answers.append(1)
|
||||
|
||||
|
||||
|
||||
# In[162]:
|
||||
|
||||
"""
|
||||
result=[]
|
||||
for i in range(len(answers)):
|
||||
if answers[i]==expected[i]:
|
||||
result.append(1)
|
||||
else:
|
||||
result.append(0)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
df = pd.DataFrame(answers)
|
||||
df.to_csv('out.tsv', sep = '\t')
|
||||
|
87
train/run.py
Normal file
87
train/run.py
Normal file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# In[90]:
|
||||
|
||||
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
|
||||
# In[91]:
|
||||
|
||||
|
||||
tsv_data = pd.read_csv('in.tsv', sep='\t',header=None, quoting=csv.QUOTE_NONE)[0]
|
||||
|
||||
|
||||
# In[139]:
|
||||
|
||||
|
||||
#expected = pd.read_csv('expected.tsv', sep='\t',header=None)[0]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# In[158]:
|
||||
|
||||
|
||||
male={'silnik', 'windows', 'gb', 'mb', 'mecz', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd', 'ubuntu', 'system', 'serwer', 'piłka', 'metal'}
|
||||
female={'ciąża', 'miesiączki', 'ciasto', 'ciąże', 'zadowolona', 'antykoncepcyjne', 'ginekologia', 'tabletki', 'porodzie', 'mąż', 'krwawienie', 'ciasta', 'narzeczony', 'ślub'}
|
||||
male = {x[:6].lower() for x in male}
|
||||
female = {x[:6].lower() for x in female}
|
||||
|
||||
|
||||
# In[159]:
|
||||
|
||||
|
||||
trimmed_docs=[]
|
||||
for document in tsv_data:
|
||||
new_doc=[]
|
||||
for word in str(document).lower().split():
|
||||
new_doc.append(word[:6])
|
||||
trimmed_docs.append(new_doc)
|
||||
|
||||
|
||||
# In[160]:
|
||||
|
||||
|
||||
male_or_female=[]
|
||||
|
||||
for doc in trimmed_docs:
|
||||
male_or_female.append((len(male&set(doc)), len(female&set(doc))))
|
||||
|
||||
doc_mean = sum(map(len, trimmed_docs))/float(len(trimmed_docs))
|
||||
# In[161]:
|
||||
|
||||
print(doc_mean)
|
||||
answers=[]
|
||||
for i in range(len(male_or_female)):
|
||||
if male_or_female[i][0]>male_or_female[i][1]:
|
||||
answers.append(1)
|
||||
elif male_or_female[i][0]<male_or_female[i][1]:
|
||||
answers.append(0)
|
||||
else:
|
||||
if len(trimmed_docs[i]) < doc_mean:
|
||||
answers.append(0)
|
||||
else:
|
||||
answers.append(1)
|
||||
|
||||
|
||||
|
||||
# In[162]:
|
||||
|
||||
"""
|
||||
result=[]
|
||||
for i in range(len(answers)):
|
||||
if answers[i]==expected[i]:
|
||||
result.append(1)
|
||||
else:
|
||||
result.append(0)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
df = pd.DataFrame(answers)
|
||||
df.to_csv('out.tsv', sep = '\t')
|
||||
|
Loading…
Reference in New Issue
Block a user