Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/misc.xml
#	.idea/workspace.xml
#	.idea/wozek.iml
This commit is contained in:
shaaqu 2020-06-08 13:36:16 +02:00
commit 9b083201e8
39 changed files with 1686 additions and 928 deletions

View File

@ -3,5 +3,5 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (AL-2020)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (AL-2020)" project-jdk-type="Python SDK" />
</project>

View File

@ -1,34 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:origin/assigning" type="e8cecc67:BranchNodeDescriptor" />
</path>
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="828778c9-9d97-422f-a727-18ddbd059b85" name="Default Changelist" comment="coder merged">
<list default="true" id="828778c9-9d97-422f-a727-18ddbd059b85" name="Default Changelist" comment="">
<<<<<<< HEAD
<change afterPath="$PROJECT_DIR$/decision_tree.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Archiwum/frontend/js/main.js" beforeDir="false" afterPath="$PROJECT_DIR$/Archiwum/frontend/js/main.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/field.py" beforeDir="false" afterPath="$PROJECT_DIR$/field.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
=======
<change afterPath="$PROJECT_DIR$/Assiging/datadict.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assiging/feature_hashing.py" beforeDir="false" afterPath="$PROJECT_DIR$/Assiging/feature_hashing.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/data.py" afterDir="false" />
>>>>>>> upstream/master
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -42,22 +30,9 @@
</option>
</component>
<component name="Git.Settings">
<favorite-branches>
<branch-storage>
<map>
<entry type="REMOTE">
<value>
<list>
<branch-info repo="$PROJECT_DIR$" source="origin/assigning" />
</list>
</value>
</entry>
</map>
</branch-storage>
</favorite-branches>
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="codeReco" />
<entry key="$PROJECT_DIR$" value="master" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -66,49 +41,31 @@
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/coder" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/decision_tree.py" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Pawel Lukaszewicz\PycharmProjects\AL-2020\coder" />
<recent name="C:\Users\Pawel Lukaszewicz\PycharmProjects\AL-2020\coder\dataset" />
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\Studia\Projects\AL-2020" />
</key>
</component>
<component name="RunManager" selected="Python.main">
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Python.feature_hashing">
<configuration name="board" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -131,6 +88,9 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<<<<<<< HEAD
<configuration name="main" type="PythonConfigurationType" factoryName="Python">
=======
<configuration name="feature_hashing" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -154,6 +114,7 @@
<method v="2" />
</configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
>>>>>>> upstream/master
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -175,64 +136,24 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="rocognizer" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/coder" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/coder/rocognizer.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="tescik" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/coder" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/coder/tescik.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.board" />
<item itemvalue="Python.feature_hashing" />
<<<<<<< HEAD
<item itemvalue="Python.main" />
<item itemvalue="Python.rocognizer" />
<item itemvalue="Python.tescik" />
<item itemvalue="Python.board" />
</list>
<recent_temporary>
<list>
=======
<item itemvalue="Python.board" />
<item itemvalue="Python.main" />
<item itemvalue="Python.feature_hashing" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.feature_hashing" />
<item itemvalue="Python.main" />
>>>>>>> upstream/master
<item itemvalue="Python.board" />
<item itemvalue="Python.rocognizer" />
<item itemvalue="Python.tescik" />
</list>
</recent_temporary>
</component>
@ -250,41 +171,17 @@
<workItem from="1589233530634" duration="769000" />
<workItem from="1589543001064" duration="78000" />
<workItem from="1589543305930" duration="10474000" />
<<<<<<< HEAD
<workItem from="1589561555146" duration="3518000" />
<workItem from="1589727068958" duration="5729000" />
<workItem from="1589796372999" duration="4340000" />
=======
<workItem from="1589561555146" duration="3374000" />
<workItem from="1589745328635" duration="27000" />
<workItem from="1589745409339" duration="739000" />
<workItem from="1589752301424" duration="1007000" />
<workItem from="1589753322316" duration="835000" />
<workItem from="1589814601057" duration="4208000" />
<workItem from="1589844260514" duration="777000" />
<workItem from="1589845066174" duration="177000" />
<workItem from="1589888090669" duration="27128000" />
<workItem from="1590140903263" duration="211000" />
<workItem from="1590179245978" duration="6655000" />
<workItem from="1590230578314" duration="1895000" />
<workItem from="1590235510565" duration="925000" />
<workItem from="1590340739871" duration="8052000" />
<workItem from="1590359007619" duration="127000" />
<workItem from="1590409526059" duration="4922000" />
<workItem from="1590423569728" duration="2532000" />
<workItem from="1590436739719" duration="6325000" />
<workItem from="1590443664804" duration="2943000" />
<workItem from="1590497613517" duration="6041000" />
<workItem from="1590518246722" duration="12616000" />
<workItem from="1590559069326" duration="13892000" />
<workItem from="1590575699320" duration="792000" />
<workItem from="1590766924835" duration="10060000" />
<workItem from="1590929874289" duration="7728000" />
<workItem from="1590938377522" duration="176000" />
<workItem from="1590944305590" duration="10043000" />
<workItem from="1590961284964" duration="2253000" />
<workItem from="1591008066071" duration="12088000" />
<workItem from="1591035169869" duration="618000" />
<workItem from="1591043444436" duration="1048000" />
<workItem from="1591111427048" duration="1041000" />
<workItem from="1591112695695" duration="1110000" />
<workItem from="1591113830067" duration="8945000" />
<workItem from="1591124808042" duration="2910000" />
</task>
<task id="LOCAL-00001" summary="create Shelf">
<created>1589815443652</created>
@ -306,110 +203,13 @@
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1589822196451</updated>
>>>>>>> upstream/master
</task>
<task id="LOCAL-00004" summary="train.py">
<created>1589918562733</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1589918562733</updated>
</task>
<task id="LOCAL-00005" summary="img to 1d array">
<created>1589952733192</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1589952733192</updated>
</task>
<task id="LOCAL-00006" summary="fun created">
<created>1589952979012</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1589952979012</updated>
</task>
<task id="LOCAL-00007" summary="recognizing but training must be improved">
<created>1589955873104</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1589955873104</updated>
</task>
<task id="LOCAL-00008" summary="zwiekszenie dokladnosci">
<created>1589964526485</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1589964526485</updated>
</task>
<task id="LOCAL-00009" summary="finding barcode">
<created>1589967955430</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1589967955430</updated>
</task>
<task id="LOCAL-00010" summary="po">
<created>1589972251988</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1589972251988</updated>
</task>
<task id="LOCAL-00011" summary="new dataset">
<created>1590359074952</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1590359074952</updated>
</task>
<task id="LOCAL-00012" summary="going to pytorch on conda eve">
<created>1590447313737</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1590447313737</updated>
</task>
<task id="LOCAL-00013" summary="add coder.py">
<created>1590538529471</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1590538529471</updated>
</task>
<task id="LOCAL-00014" summary="detecting digits">
<created>1590846768877</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1590846768877</updated>
</task>
<task id="LOCAL-00015" summary="img is cropped and transformed to torch">
<created>1590938465634</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1590938465634</updated>
</task>
<task id="LOCAL-00016" summary="new tests">
<created>1590963692385</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1590963692385</updated>
</task>
<task id="LOCAL-00017" summary="coder merged">
<created>1591615791865</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1591615791865</updated>
</task>
<option name="localTasksCounter" value="18" />
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" />
<option name="version" value="1" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
@ -417,108 +217,29 @@
<entry key="MAIN">
<value>
<State>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="origin/assigning" />
</list>
</value>
</entry>
</map>
</option>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="create Shelf" />
<MESSAGE value="create addShelf method in Field class" />
<MESSAGE value="changed CreateDataSweets to lowercase" />
<MESSAGE value="train.py" />
<MESSAGE value="img to 1d array" />
<MESSAGE value="fun created" />
<MESSAGE value="recognizing but training must be improved" />
<MESSAGE value="zwiekszenie dokladnosci" />
<MESSAGE value="finding barcode" />
<MESSAGE value="po" />
<MESSAGE value="new dataset" />
<MESSAGE value="going to pytorch on conda eve" />
<MESSAGE value="add coder.py" />
<MESSAGE value="detecting digits" />
<MESSAGE value="img is cropped and transformed to torch" />
<MESSAGE value="new tests" />
<MESSAGE value="coder merged" />
<option name="LAST_COMMIT_MESSAGE" value="coder merged" />
</component>
<component name="WindowStateProjectService">
<state x="525" y="214" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1591117361907">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="525" y="214" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1536.824@0.0.1536.824" timestamp="1591117361907" />
<state x="115" y="162" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1591113556580">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="115" y="162" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1536.824@0.0.1536.824" timestamp="1591113556580" />
<state x="549" y="167" key="FileChooserDialogImpl" timestamp="1590962272315">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1590962272315" />
<state width="724" height="264" key="GridCell.Tab.0.bottom" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.0.center" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.0.left" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.0.right" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.1.bottom" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.1.center" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.1.left" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state width="724" height="264" key="GridCell.Tab.1.right" timestamp="1591028610371">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="724" height="264" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1591028610371" />
<state x="277" y="57" key="SettingsEditor" timestamp="1590443566792">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="277" y="57" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1590443566792" />
<state x="361" y="145" key="Vcs.Push.Dialog.v2" timestamp="1590963699596">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="361" y="145" key="Vcs.Push.Dialog.v2/0.0.1536.824@0.0.1536.824" timestamp="1590963699596" />
<state x="54" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1590930912296">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="54" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1590930912296" />
<option name="LAST_COMMIT_MESSAGE" value="changed CreateDataSweets to lowercase" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<<<<<<< HEAD
<SUITE FILE_PATH="coverage/AL_2020$decision_tree.coverage" NAME="main Coverage Results" MODIFIED="1589815629629" 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/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589729320403" 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="1589823737949" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Assiging" />
>>>>>>> upstream/master
<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/AL_2020$digits_recognizer.coverage" NAME="digits_recognizer Coverage Results" MODIFIED="1591028603228" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/coder" />
<SUITE FILE_PATH="coverage/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589845236495" 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>
</project>

245
.idea/workspace.xml.orig Normal file
View File

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="828778c9-9d97-422f-a727-18ddbd059b85" name="Default Changelist" comment="">
<<<<<<< HEAD
<change afterPath="$PROJECT_DIR$/decision_tree.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Archiwum/frontend/js/main.js" beforeDir="false" afterPath="$PROJECT_DIR$/Archiwum/frontend/js/main.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/field.py" beforeDir="false" afterPath="$PROJECT_DIR$/field.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
=======
<change afterPath="$PROJECT_DIR$/Assiging/datadict.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assiging/feature_hashing.py" beforeDir="false" afterPath="$PROJECT_DIR$/Assiging/feature_hashing.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/data.py" afterDir="false" />
>>>>>>> upstream/master
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="master" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1blUxWbA3VMjMFjk8gUnLGMgAoU" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/decision_tree.py" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\Studia\Projects\AL-2020" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Python.feature_hashing">
<configuration name="board" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/board.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<<<<<<< HEAD
<configuration name="main" type="PythonConfigurationType" factoryName="Python">
=======
<configuration name="feature_hashing" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Assiging" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/Assiging/feature_hashing.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
>>>>>>> upstream/master
<module name="wozek" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<list>
<<<<<<< HEAD
<item itemvalue="Python.main" />
<item itemvalue="Python.board" />
</list>
<recent_temporary>
<list>
=======
<item itemvalue="Python.board" />
<item itemvalue="Python.main" />
<item itemvalue="Python.feature_hashing" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.feature_hashing" />
<item itemvalue="Python.main" />
>>>>>>> upstream/master
<item itemvalue="Python.board" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="828778c9-9d97-422f-a727-18ddbd059b85" name="Default Changelist" comment="" />
<created>1589206421672</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1589206421672</updated>
<workItem from="1589206439279" duration="11691000" />
<workItem from="1589233530634" duration="769000" />
<workItem from="1589543001064" duration="78000" />
<workItem from="1589543305930" duration="10474000" />
<<<<<<< HEAD
<workItem from="1589561555146" duration="3518000" />
<workItem from="1589727068958" duration="5729000" />
<workItem from="1589796372999" duration="4340000" />
=======
<workItem from="1589561555146" duration="3374000" />
<workItem from="1589745328635" duration="27000" />
<workItem from="1589745409339" duration="739000" />
<workItem from="1589752301424" duration="1007000" />
<workItem from="1589753322316" duration="835000" />
<workItem from="1589814601057" duration="4208000" />
</task>
<task id="LOCAL-00001" summary="create Shelf">
<created>1589815443652</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1589815443652</updated>
</task>
<task id="LOCAL-00002" summary="create addShelf method in Field class">
<created>1589816028640</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1589816028640</updated>
</task>
<task id="LOCAL-00003" summary="changed CreateDataSweets to lowercase">
<created>1589822196451</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1589822196451</updated>
>>>>>>> upstream/master
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="create Shelf" />
<MESSAGE value="create addShelf method in Field class" />
<MESSAGE value="changed CreateDataSweets to lowercase" />
<option name="LAST_COMMIT_MESSAGE" value="changed CreateDataSweets to lowercase" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<<<<<<< HEAD
<SUITE FILE_PATH="coverage/AL_2020$decision_tree.coverage" NAME="main Coverage Results" MODIFIED="1589815629629" 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/AL_2020$main.coverage" NAME="main Coverage Results" MODIFIED="1589729320403" 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="1589823737949" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Assiging" />
>>>>>>> upstream/master
<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$" />
</component>
</project>

View File

@ -4,10 +4,10 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (AL-2020)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.7 (AL-2020)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="renderExternalDocumentation" value="true" />
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

File diff suppressed because it is too large Load Diff

165
Raporty/Raport_444420.md Normal file
View File

@ -0,0 +1,165 @@
# Tomasz Kuczyński Raport - mcda
### Opis podprojektu
Podprojekt ma za zadanie wybrać określoną liczbę najlepszych produktów z dostawy.
Wykorzystuj on zmodyfikowaną motodę MCDA - Multiple Criteria Decision Analysis.
#### Uczenie modelu
Zbiór uczenia składa się z zdefiniowania wartości atrybutów:
```javascript
color = {'black': 16, 'gold': 10, 'purple': 5, 'brown': 7, 'blue': 12, 'white': 14, 'red': 13, 'orange': 11}
shape = {'rectangle': 15, 'pack': 19, 'square': 9, 'jar': 7}
size = {'small': 7, 'medium': 16, 'big': 13}
```
oraz ich wyliczenia:
```javascript
def sizeValue(X):
if X.size == 'small':
return X.mass/5
if X.size == 'medium':
return X.mass/10
if X.size == 'big':
return X.mass/20
```
Składa się róznierz z parametrów:
`weights` - waga danego parametru
`q` - współczynik pomyłki (granicy błędu) pomiędzy atrybutami
`p` - maksymalna dopuszczalna różnica pomiędy atrybutami
```javascript
parameters = {
'color': {'weights': 3, 'q': 1, 'p': 5},
'shape': {'weights': 4, 'q': 1, 'p': 6},
'mass': {'weights': 0.5, 'q': 2, 'p': 10},
'size': {'weights': 1, 'q': 1, 'p': 8}
}
```
#### Opis kodu w wspólnym projekcie
W wspólnym projekcie w pliku main.py wywołuje funkcję wybierania 5 produktów z dostawy:
```javascript
produsctsFromSupply = choseProducts(5)
```
próbna dostawa jest zapisana w pliku supply.py:
```javascript
def create_data_products():
allProducts = []
product = Product('black', 'rectangle', 51, 'small')
allProducts.append(product)
product = Product('black', 'rectangle', 51, 'small')
allProducts.append(product)
product = Product('gold', 'pack', 100, 'big')
allProducts.append(product)
...
return allProducts
```
Cały algorytm selekcji produktów znajduje się w pliku mcda.py.
Funkcja `getConcordance(gA, gB, q, p):` ma za zadanie wyliczyć `Concordance` czyli jakość produktu A względem produktu B, za pomocą wartości atrybutów A, B odpowiednio gA, gB oraz parametrów tego atrybutu q, p i zwrócić liczbę z zakresu [0,1].
```javascript
def getConcordance(gA, gB, q, p):
if gB <= gA + q:
return 1
if gB <= gA + p:
return (p - gB + gA) / (p - q)
return 0
```
Funkcja `getAllTypeConcordance(A, B)` ma za zadanie wyliczyć wszystkie typy `Concordance` oraz wyliczyć ich średnią ważoną:
```javascript
def getAllTypeConcordance(A, B):
concordance = 0.0
weight_sum = 0
parameter = parameters['color']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(color[A.color], color[B.color], q, p) * w
weight_sum += w
parameter = parameters['shape']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(shape[A.shape], shape[B.shape], q, p) * w
weight_sum += w
...
concordance /= weight_sum
return concordance
```
Funkcja `getConcordanceAllProducts()` ma za zadanie przy pomocy funkcji `getAllTypeConcordance(A, B)` wyliczyć `Concordance` dla wszystkich produktów i zwrócić wynik w postaci listy:
```javascript
def getConcordanceAllProducts():
C = []
for i in range(len(allProducts)):
c = 0
for j in range(len(allProducts)):
if j==i:
continue
else:
c += getAllTypeConcordance(allProducts[i], allProducts[j])
c /= len(allProducts)-1
C.append(c)
return C
```
Funkcja `choseProducts(number)` ma za zadanie wybrać `number` produktów z dostawy na podstawie listy `Concordance` zwróconej przez funkcję `getConcordanceAllProducts()`.
```javascript
def choseProducts(number):
C = getConcordanceAllProducts()
products = []
prev = -1
if number > len(allProducts):
return allProducts
while number > 0:
max = -1
if prev == -1:
max = 0
for j in range(len(allProducts)):
if prev == -1:
if C[max]<C[j]:
max = j
elif max == -1:
if C[prev]>C[j]:
max = j
elif C[max] < C[j] and C[j] < C[prev]:
max = j
prev = max
for j in range(len(allProducts)):
if C[max] == C[j]:
products.append(allProducts[j])
print(C[j])
number -= 1
if number == 0:
break
print(C)
return products
```
`print(C[j])` oraz `print(C)` służy do sprawdzenia poprawności algorytmu.
### Uruchomienie algorytmu i jego działanie
Film przedstawiający uruchomienie aplikacji:
https://www.youtube.com/watch?v=DmwDlJkjtjs
Parametry pojawiające się w terminalu:
1.Concordance `number` najlepszych produktów (`print(C[j])`).
2.Lista wszystkich Concordance ( `print(C)`).

131
Raporty/raport_444428.md Normal file
View File

@ -0,0 +1,131 @@
# Wojciech Łukasik - drzewa decyzyjne, algorytm CART
### Opis podprojektu
Podprojekt implementuje tworzenie drzewa decyzyjnego w oparciu o algorytm CART
(Classification And Regression Tree), które pomaga Agentowi w rozpoznaniu słodyczy na podstawie
ich cech fizycznych (kolor, kształt, masa, rozmiar).
Wszystkie funkcje oraz klasy wykorzystywane w tym podprojekcie znajdują się w pliku decision_tree.py,
dane uczące znajdują się w pliku data.py w liście learning_data
### Tworzenie drzewa decyzyjnego
Główną funkcją jest
`build_tree(rows)` która jak wskazuje nazwa tworzy drzewo.
Funkcja przyjmuje jako argument listę zawierającą zestaw danych, w tym przypadku będą to słodycze o różnych właściwościach.
```python
def build_tree(rows):
gain, question = find_best_split(rows)
if gain == 0:
return Leaf(rows)
true_rows, false_rows = partition(rows, question)
true_branch = build_tree(true_rows)
false_branch = build_tree(false_rows)
return DecisionNode(question, true_branch, false_branch)
```
Drzewo jest budowane w oparciu o najlepsze możlwe podziały (najbardziej korzystne 'pytanie', które można zadać).
Zajmuje się tym funkcja
`find_best_split(rows)` która dla wszystkich właściwości przekazanego zestawu informacji
wylicza dla nich 'zysk informacji'.
Jeżeli nie otrzymujemy żadnych informacji (gain == 0) to znaczy, że znajdujemy
się w liściu drzewa.
```python
def find_best_split(rows):
best_gain = 0
best_question = None
current_uncertainty = gini(rows)
n_features = len(rows[0]) - 1
for col in range(n_features):
values = set([row[col] for row in rows])
for val in values:
question = Question(col, val)
true_rows, false_rows = partition(rows, question)
if len(true_rows) == 0 or len(false_rows) == 0:
continue
gain = info_gain(true_rows, false_rows, current_uncertainty)
if gain > best_gain:
best_gain, best_question = gain, question
return best_gain, best_question
```
Zysk informacji z danego podziału otrzymujemy obliczając wartość 'Gini Impurity'. Jest to miara tego jak często losowo
wybrany element zbioru byłby źle skategoryzowany, gdyby przypisać mu losową kategorię spośród wszystkich kategorii
znajdujących się w danym zbiorze.
```python
def gini(rows):
counts = class_counts(rows)
impurity = 1
for lbl in counts:
prob_of_lbl = counts[lbl] / float(len(rows))
impurity -= prob_of_lbl ** 2
return impurity
```
`class_counts(rows)` to funkcja, która dla danego zestawu danych zwraca wszystkie unikalne 'kategorie' oraz liczbę ich wystąpień.
Dla przykładu, w zestawie w którym wszystkie elementy podchodzą pod tę samą kategorię wartość Gini Impurity będzie równa zero, natomiast w zbiorze w którym znajdują się dwie kategorie wartość ta wyniesie 0,5. Im więcej różnych kategorii tym bardziej wartość Gini Impurity będzie zbliżała się do 1.
Po znalezieniu najbardziej optymalnego pytania, algorytm dzieli zestaw na elementy, dla których pytanie jest prawdziwe
(true_rows), oraz te dla których jest fałszywe (false_rows). Następnie wykonuje rekurencyjnie procedurę `build_tree` dla obu poddrzew tak długo aż nie dojdzie do liści.
Element o zadanym zestawie cech, zostaje odnaleziony w drzewie dzięki prostej procedurze
`classify(row, node)` 'row' to lista cech elementu, natomiast 'node' na początu jest korzeniem już zbudowanego drzewa.
Element jest odnaleziony dzięki
rekurencyjnym porównaniom atrybutów elementu z pytaniami w kolejnych węzłach drzewa.
```python
def classify(row, node):
if isinstance(node, Leaf):
return node.predicions
if node.question.match(row):
return classify(row, node.true_branch)
else:
return classify(row, node.false_branch)
```
### Zestaw uczący
Zestaw budujący drzewo to lista zawierająca 27 przykładowych słodyczy. Ich atrybuty zapisane są w formacie ['kolor',
'kształt', 'masa', 'wielkość', 'nazwa']. Oczywiście przy wyszukiwaniu elementu w drzewie jego nazwa nie jest potrzebna
ponieważ to jej szukamy. Przykładowe elementy z zestawu uczącego:
```python
['black', 'rectangle', 51, 'small', 'Mars'],
['gold', 'pack', 100, 'big', 'Haribo'],
['purple', 'rectangle', 100, 'big', 'Milka'],
['brown', 'pack', 45, 'small', 'M&M'],
```
### Implementacja w projekcie
Przy rozpoczęciu głównej pętli programu w pliku `main.py` drzewo `my_tree` zostaje zbudowane w oparciu o dane
`data.learning_data`.
Gdy program już działa, po wciśnięciu `spacji` jeden ze słodyczy zostanie losowo wybrany z zestawu `data.learning_data`
oraz umieszczony na polu `board[9][0]`, a jego nazwa zostanie wypisana w konsoli. Następnie Agent przemieszcza się do
punktu `board[9][0]` i rozpoczne procedurę wyszukiwania elementu w zbudowanym drzewie. Na końcu wypisze w
konsoli nazwę produktu.

View File

@ -93,7 +93,6 @@ let winner = 0;
let current = openSet[winner];
```
### Definicja przyjętej heurystyki
Jest to szacowana odległość od sprawdzanego pola do celu. Obliczana jest jako `Manhattan Distance`, ponieważ w naszym modelu Agent nie może poruszać się po skosie.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

9
candy.py Normal file
View File

@ -0,0 +1,9 @@
class Candy:
def __init__(self, producent, type, price):
self.producent = producent
self.type = type
self.price = price

32
data.py
View File

@ -28,6 +28,38 @@ def create_data_sweets():
return allProducts
learning_data = [
# kolor, kształt, waga, rozmiar, nazwa
['black', 'rectangle', 51, 'small', 'Mars'],
['gold', 'pack', 100, 'big', 'Haribo'],
['purple', 'rectangle', 100, 'big', 'Milka'],
['brown', 'pack', 45, 'small', 'M&M'],
['blue', 'rectangle', 50, 'medium', 'Bounty'],
['blue', 'square', 40, 'small', 'Knoppers'],
['blue', 'rectangle', 35, 'small', 'Milky-way'],
['gold', 'rectangle', 40, 'medium', 'Twix'],
['gold', 'rectangle', 50, 'medium', 'Prince-polo'],
['brown', 'rectangle', 55, 'medium', 'Snickers'],
['brown', 'rectangle', 45, 'medium', 'Lion'],
['white', 'rectangle', 40, 'medium', 'Kinder-bueno'],
['red', 'rectangle', 50, 'medium', 'Kit-kat'],
['blue', 'rectangle', 115, 'big', 'Wedel'],
['white', 'rectangle', 15, 'small', 'Krowka'],
['red', 'pack', 70, 'medium', 'Skittles'],
['orange', 'rectangle', 45, 'medium', 'Reeses'],
['blue', 'rectangle', 55, 'medium', 'Oreo'],
['gold', 'rectangle', 120, 'big', 'Ferrero-rocher'],
['white', 'rectangle', 120, 'big', 'Rafaello'],
['white', 'jar', 600, 'big', 'Nutella'],
['white', 'rectangle', 25, 'small', 'Duplo'],
['brown', 'jar', 500, 'big', 'GoOn'],
['brown', 'jar', 470, 'big', 'Active Orzechowe'],
['red', 'jar', 250, 'medium', 'Strawberry Jam'],
['black', 'jar', 250, 'medium', 'Blackberry Jam'],
['orange', 'jar', 250, 'medium', 'Peach Jam'],
]
def create_data_dict():
products_as_dict = []

91
data.py.orig Normal file
View File

@ -0,0 +1,91 @@
from sweets import Sweets
def create_data_sweets():
allProducts = []
sweet = Sweets('Mars', 'czekoladowy', 'baton', 'sredni', 2.49)
allProducts.append(sweet)
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'duzy', 4.99)
allProducts.append(sweet)
sweet = Sweets('Mars', 'czekoladowy', 'czekolada', 'ogromny', 11.26)
allProducts.append(sweet)
sweet = Sweets('M&M', 'czekoladowy', 'czekolada', 'duzy', 3.99)
allProducts.append(sweet)
sweet = Sweets('M&M', 'czekoladowy', 'baton', 'sredni', 2.89)
allProducts.append(sweet)
sweet = Sweets('Nestle', 'bananowy', 'landrynka', 'maly', 0.39)
allProducts.append(sweet)
sweet = Sweets('Nestle', 'truskawkowy', 'landrynka', 'maly', 0.39)
allProducts.append(sweet)
sweet = Sweets('Nestle', 'cola', 'landrynka', 'maly', 0.49)
allProducts.append(sweet)
sweet = Sweets('Wedel', 'czekoladowy', 'baton', 'sredni', 1.99)
allProducts.append(sweet)
sweet = Sweets('Maoam', 'truskawkowy', 'guma', 'maly', 0.25)
allProducts.append(sweet)
<<<<<<< HEAD
return allProducts
learning_data = [
# kolor, kształt, waga, rozmiar, nazwa
['black', 'rectangle', 51, 'small', 'Mars'],
['gold', 'pack', 100, 'big', 'Haribo'],
['purple', 'rectangle', 100, 'big', 'Milka'],
['brown', 'pack', 45, 'small', 'M&M'],
['blue', 'rectangle', 50, 'medium', 'Bounty'],
['blue', 'square', 40, 'small', 'Knoppers'],
['blue', 'rectangle', 35, 'small', 'Milky-way'],
['gold', 'rectangle', 40, 'medium', 'Twix'],
['gold', 'rectangle', 50, 'medium', 'Prince-polo'],
['brown', 'rectangle', 55, 'medium', 'Snickers'],
['brown', 'rectangle', 45, 'medium', 'Lion'],
['white', 'rectangle', 40, 'medium', 'Kinder-bueno'],
['red', 'rectangle', 50, 'medium', 'Kit-kat'],
['blue', 'rectangle', 115, 'big', 'Wedel'],
['white', 'rectangle', 15, 'small', 'Krowka'],
['red', 'pack', 70, 'medium', 'Skittles'],
['orange', 'rectangle', 45, 'medium', 'Reeses'],
['blue', 'rectangle', 55, 'medium', 'Oreo'],
['gold', 'rectangle', 120, 'big', 'Ferrero-rocher'],
['white', 'rectangle', 120, 'big', 'Rafaello'],
['white', 'jar', 600, 'big', 'Nutella'],
['white', 'rectangle', 25, 'small', 'Duplo'],
['brown', 'jar', 500, 'big', 'GoOn'],
['brown', 'jar', 470, 'big', 'Active Orzechowe'],
['red', 'jar', 250, 'medium', 'Strawberry Jam'],
['black', 'jar', 250, 'medium', 'Blackberry Jam'],
['orange', 'jar', 250, 'medium', 'Peach Jam'],
]
=======
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
>>>>>>> upstream/master

184
decision_tree.py Normal file
View File

@ -0,0 +1,184 @@
import data
training_data = data.learning_data
header = ['color', 'shape', 'weight', 'size', 'name']
# funkcja która zwraca listę unikalnych wartości z każdej kolumny
def uniqie_vals(rows, col):
return set([row[col] for row in rows])
# zliczamy liczbę wystąpień danego typu w zestawie danych
def class_counts(rows):
counts = {} # label -> count
for row in rows:
name = row[-1]
if name not in counts:
counts[name] = 0
counts[name] += 1
return counts
# funkcja do sprawdzania czy wartość jest wartością numeryczną
def is_numeric(val):
return isinstance(val, int) or isinstance(val, float)
# klasa do zadawania pytań
class Question:
def __init__(self, column, value):
self.column = column
self.value = value
def match(self, example):
val = example[self.column]
if is_numeric(val):
return val >= self.value
else:
return val == self.value
def __repr__(self):
condition = '=='
if is_numeric(self.value):
condition = '>='
return "Is %s %s %s?" % (header[self.column], condition, str(self.value))
def partition(rows, question):
""" podział zbioru informacji
dla każdego rzędu w zbiorze, sprawdź czy zgadza się z pytaniem, jeśli tak
dodaj do 'true' inaczej dodaj do 'false' """
true_rows, false_rows = [], []
for row in rows:
if question.match(row):
true_rows.append(row)
else:
false_rows.append(row)
return true_rows, false_rows
def gini(rows):
""" Gini impurity is a measure of how often a randomly chosen element from
the set would be incorrectly labeled if it was randomly labeled according to
the distribution of labels in the subset. """
counts = class_counts(rows)
impurity = 1
for lbl in counts:
prob_of_lbl = counts[lbl] / float(len(rows))
impurity -= prob_of_lbl ** 2
return impurity
def info_gain(left, right, current_uncertainty):
p = float(len(left)) / (len(left) + len(right))
return current_uncertainty - p * gini(left) - (1 - p) * gini(right)
def find_best_split(rows):
""" znajdź najlepsze możliwe pytanie do zadania, sprawdzając wszystkie
właściwośći oraz licząc dla nich 'info_gain' """
best_gain = 0
best_question = None
current_uncertainty = gini(rows)
n_features = len(rows[0]) - 1
for col in range(n_features):
values = set([row[col] for row in rows])
for val in values:
question = Question(col, val)
true_rows, false_rows = partition(rows, question)
if len(true_rows) == 0 or len(false_rows) == 0:
continue
gain = info_gain(true_rows, false_rows, current_uncertainty)
if gain > best_gain:
best_gain, best_question = gain, question
return best_gain, best_question
class Leaf:
def __init__(self, rows):
self.predicions = class_counts(rows)
class DecisionNode:
def __init__(self, question, true_branch, false_branch):
self.question = question
self.true_branch = true_branch
self.false_branch = false_branch
def build_tree(rows):
gain, question = find_best_split(rows)
if gain == 0:
return Leaf(rows)
true_rows, false_rows = partition(rows, question)
true_branch = build_tree(true_rows)
false_branch = build_tree(false_rows)
return DecisionNode(question, true_branch, false_branch)
def print_tree(node, spacing=""):
if isinstance(node, Leaf):
print(spacing + "Predict", node.predicions)
else:
print(spacing + str(node.question))
print(spacing + '--> True:')
print_tree(node.true_branch, spacing + " ")
print(spacing + '--> False:')
print_tree(node.false_branch, spacing + " ")
def classify(row, node):
if isinstance(node, Leaf):
return node.predicions
if node.question.match(row):
return classify(row, node.true_branch)
else:
return classify(row, node.false_branch)
def print_leaf(counts):
probs = []
for lbl in counts.keys():
probs.append(lbl)
return probs
# my_tree = build_tree(training_data)
#
# print_tree(my_tree)
#
# testing_data = [
# ['gold', 'rectangle', 50, 'medium', 'Name'],
# ['brown', 'rectangle', 55, 'medium', 'Snickers'],
# ['white', 'rectangle', 120, 'big', 'Name']
# ]
#
# test = ['white', 'rectangle', 120, 'big', 'Name']
#
# # for row in testing_data:
# # print(print_leaf(classify(row, my_tree)))
#
# wynik = print_leaf(classify(test, my_tree))[0]
# print(wynik)

View File

@ -23,6 +23,9 @@ class Field:
self.f = 0
self.previous = None
# Przedmiot, który podnosi agent
self.item = []
# Te rzeczy są potrzebne do wyświetlenia pola
self.image = pygame.image.load('img/Field.png')
self.rect = self.image.get_rect()
@ -30,7 +33,6 @@ class Field:
self.rect.center = (center_x, center_y)
# Metoda do wyświetlania pola na ekranie
def blitme(self):
self.screen.blit(self.image, self.rect)
@ -46,5 +48,5 @@ class Field:
self.neighbors.append(board[self.y + 1][self.x])
def addShelf(self):
shelf = Shelf(len(self.shelves)+1)
shelf = Shelf(len(self.shelves) + 1)
self.shelves.append(shelf)

31
main.py
View File

@ -2,12 +2,14 @@ import pygame
import functions
import sys
import time
import decision_tree
import data
from agent import Agent
from settings import Settings
from board import create_board, draw_board
from random import randint
from random import randint, choice
from mcda import choseProducts
# Inicjalizacja programu i utworzenie obiektu ekrany
def run():
@ -17,10 +19,13 @@ def run():
pygame.display.set_caption("Inteligentny wózek widłowy")
agent = Agent(screen, 50, 50, "Down")
board = create_board(screen)
my_tree = decision_tree.build_tree(data.learning_data)
for row in board:
for field in row:
print(field.cost_of_travel)
produsctsFromSupply = choseProducts(5)
# for row in board:
# for field in row:
# print(field.cost_of_travel)
path = []
next_step = None
@ -41,7 +46,9 @@ def run():
agent.move_forward(board)
print(agent.x, agent.y)
elif event.key == pygame.K_SPACE:
field = board[randint(0, 9)][randint(0, 9)]
board[9][0].item = choice(data.learning_data)
print("Wybrano: " + board[9][0].item[-1])
field = board[9][0]
if not field.is_shelf:
path = functions.a_star(board[agent.y][agent.x], field, board)
path.pop(len(path) - 1)
@ -56,17 +63,19 @@ def run():
next_step = path.pop()
else:
next_step = None
print(next_step, path)
# print(next_step, path)
for row in board:
for field in row:
if not field.is_shelf:
field.image = pygame.image.load('img/Field.png')
for row in board:
for field in row:
print(field.g, field.h, field.f, field.previous)
else:
functions.change_turn(agent, next_step)
print(agent.x, agent.y)
if board[agent.y][agent.x].item:
prediction = decision_tree.print_leaf(decision_tree.classify(board[agent.y][agent.x].item, my_tree))
print("Agent uważa, że przedmiot to: " + prediction[0])
board[agent.y][agent.x].item = []
draw_board(board)
agent.blitme()

99
mcda.py Normal file
View File

@ -0,0 +1,99 @@
from supply import *
allProducts = create_data_products()
color = {'black': 16, 'gold': 10, 'purple': 5, 'brown': 7, 'blue': 12, 'white': 14, 'red': 13, 'orange': 11}
shape = {'rectangle': 15, 'pack': 19, 'square': 9, 'jar': 7}
size = {'small': 7, 'medium': 16, 'big': 13}
def sizeValue(X):
if X.size == 'small':
return X.mass/5
if X.size == 'medium':
return X.mass/10
if X.size == 'big':
return X.mass/20
parameters = {
'color': {'weights': 3, 'q': 1, 'p': 5},
'shape': {'weights': 4, 'q': 1, 'p': 6},
'mass': {'weights': 0.5, 'q': 2, 'p': 10},
'size': {'weights': 1, 'q': 1, 'p': 8}
}
def getConcordance(gA, gB, q, p):
if gB <= gA + q:
return 1
if gB <= gA + p:
return (p - gB + gA) / (p - q)
return 0
def getAllTypeConcordance(A, B):
concordance = 0.0
weight_sum = 0
parameter = parameters['color']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(color[A.color], color[B.color], q, p) * w
weight_sum += w
parameter = parameters['shape']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(shape[A.shape], shape[B.shape], q, p) * w
weight_sum += w
parameter = parameters['mass']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(sizeValue(A), sizeValue(B), q, p) * w
weight_sum += w
parameter = parameters['size']
w, q, p = parameter['weights'], parameter['q'], parameter['p']
concordance += getConcordance(size[A.size], size[B.size], q, p) * w
weight_sum += w
concordance /= weight_sum
return concordance
def getConcordanceAllProducts():
C = []
for i in range(len(allProducts)):
c = 0
for j in range(len(allProducts)):
if j==i:
continue
else:
c += getAllTypeConcordance(allProducts[i], allProducts[j])
c /= len(allProducts)-1
C.append(c)
return C
def choseProducts(number):
C = getConcordanceAllProducts()
products = []
prev = -1
if number > len(allProducts):
return allProducts
while number > 0:
max = -1
if prev == -1:
max = 0
for j in range(len(allProducts)):
if prev == -1:
if C[max]<C[j]:
max = j
elif max == -1:
if C[prev]>C[j]:
max = j
elif C[max] < C[j] and C[j] < C[prev]:
max = j
prev = max
for j in range(len(allProducts)):
if C[max] == C[j]:
products.append(allProducts[j])
print(C[j])
number -= 1
if number == 0:
break
print(C)
return products

7
product.py Normal file
View File

@ -0,0 +1,7 @@
class Product:
def __init__(self, color, shape, mass, size):
self.color = color
self.shape = shape
self.mass = mass
self.size = size

64
supply.py Normal file
View File

@ -0,0 +1,64 @@
from product import Product
def create_data_products():
allProducts = []
product = Product('black', 'rectangle', 51, 'small')
allProducts.append(product)
product = Product('black', 'rectangle', 51, 'small')
allProducts.append(product)
product = Product('gold', 'pack', 100, 'big')
allProducts.append(product)
product = Product('purple', 'rectangle', 100, 'big')
allProducts.append(product)
product = Product('brown', 'pack', 45, 'small')
allProducts.append(product)
product = Product('blue', 'rectangle', 50, 'medium')
allProducts.append(product)
product = Product('blue', 'square', 40, 'small')
allProducts.append(product)
product = Product('blue', 'rectangle', 35, 'small')
allProducts.append(product)
product = Product('gold', 'rectangle', 40, 'medium')
allProducts.append(product)
product = Product('gold', 'rectangle', 50, 'medium')
allProducts.append(product)
product = Product('brown', 'rectangle', 55, 'medium')
allProducts.append(product)
product = Product('brown', 'rectangle', 45, 'medium')
allProducts.append(product)
product = Product('white', 'rectangle', 40, 'medium')
allProducts.append(product)
product = Product('red', 'rectangle', 50, 'medium')
allProducts.append(product)
product = Product('blue', 'rectangle', 115, 'big')
allProducts.append(product)
product = Product('white', 'rectangle', 15, 'small')
allProducts.append(product)
product = Product('red', 'pack', 70, 'medium')
allProducts.append(product)
product = Product('orange', 'rectangle', 45, 'medium')
allProducts.append(product)
product = Product('blue', 'rectangle', 55, 'medium')
allProducts.append(product)
product = Product('gold', 'rectangle', 120, 'big')
allProducts.append(product)
product = Product('white', 'rectangle', 120, 'big')
allProducts.append(product)
product = Product('white', 'jar', 600, 'big')
allProducts.append(product)
product = Product('white', 'rectangle', 25, 'small')
allProducts.append(product)
product = Product('brown', 'jar', 500, 'big')
allProducts.append(product)
product = Product('brown', 'jar', 470, 'big')
allProducts.append(product)
product = Product('red', 'jar', 250, 'medium')
allProducts.append(product)
product = Product('black', 'jar', 250, 'medium')
allProducts.append(product)
product = Product('orange', 'jar', 250, 'medium')
allProducts.append(product)
return allProducts