moved create_data_dict to data file;

deleted datadict file
This commit is contained in:
shaaqu 2020-05-18 19:43:25 +02:00
parent bfd63cb1dc
commit 0630d99a48
4 changed files with 31 additions and 32 deletions

View File

@ -200,7 +200,7 @@
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589754127142" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589754127142" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/AL_2020$feature_hashing.coverage" NAME="feature_hashing Coverage Results" MODIFIED="1589822405133" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Assiging" /> <SUITE FILE_PATH="coverage/AL_2020$feature_hashing.coverage" NAME="feature_hashing Coverage Results" MODIFIED="1589823737949" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Assiging" />
<SUITE FILE_PATH="coverage/wozek$main.coverage" NAME="main Coverage Results" MODIFIED="1589556038208" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/wozek$main.coverage" NAME="main Coverage Results" MODIFIED="1589556038208" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/wozek$board.coverage" NAME="board Coverage Results" MODIFIED="1589210811600" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/wozek$board.coverage" NAME="board Coverage Results" MODIFIED="1589210811600" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component> </component>

View File

@ -1,28 +0,0 @@
from sweets import Sweets
def create_data_dict():
products_as_dict = []
sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49)
products_as_dict.append(vars(sweet))
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26)
products_as_dict.append(vars(sweet))
sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49)
products_as_dict.append(vars(sweet))
sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25)
products_as_dict.append(vars(sweet))
return products_as_dict

View File

@ -1,5 +1,5 @@
from sklearn.feature_extraction import FeatureHasher from sklearn.feature_extraction import FeatureHasher
from data import create_data_dict
data = create_data_dict()
print(data)
print(f.toarray())

27
data.py
View File

@ -26,3 +26,30 @@ def create_data_sweets():
allProducts.append(sweet) allProducts.append(sweet)
return allProducts return allProducts
def create_data_dict():
products_as_dict = []
sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49)
products_as_dict.append(vars(sweet))
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26)
products_as_dict.append(vars(sweet))
sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39)
products_as_dict.append(vars(sweet))
sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49)
products_as_dict.append(vars(sweet))
sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99)
products_as_dict.append(vars(sweet))
sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25)
products_as_dict.append(vars(sweet))
return products_as_dict