-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
276 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from arekit.common.experiment.input.providers.columns.base import BaseColumnsProvider | ||
from arekit.common.experiment.input.providers.opinions import OpinionProvider | ||
from arekit.common.experiment.input.providers.rows.base import BaseRowProvider | ||
from arekit.common.experiment.input.storages.base import BaseRowsStorage | ||
|
||
|
||
class BaseInputRepository(object): | ||
|
||
def __init__(self, columns_provider, rows_provider, storage): | ||
assert(isinstance(columns_provider, BaseColumnsProvider)) | ||
assert(isinstance(rows_provider, BaseRowProvider)) | ||
assert(isinstance(storage, BaseRowsStorage)) | ||
|
||
self._columns_provider = columns_provider | ||
self._rows_provider = rows_provider | ||
self._storage = storage | ||
|
||
# Do setup operations. | ||
self._setup_columns_provider() | ||
self._setup_rows_provider() | ||
self._setup_storage() | ||
|
||
# region protected methods | ||
|
||
def _setup_columns_provider(self): | ||
pass | ||
|
||
def _setup_rows_provider(self): | ||
self._rows_provider.set_storage(self._storage) | ||
|
||
def _setup_storage(self): | ||
self._storage.set_columns_provider(self._columns_provider) | ||
|
||
# endregion | ||
|
||
def populate(self, opinion_provider, target, desc=""): | ||
assert(isinstance(opinion_provider, OpinionProvider)) | ||
assert(isinstance(self._storage, BaseRowsStorage)) | ||
|
||
self._storage.init_empty() | ||
|
||
with self._storage as storage: | ||
self._rows_provider.format(opinion_provider, desc) | ||
return storage.save(target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from arekit.common.experiment.input.repositories.base import BaseInputRepository | ||
|
||
|
||
class BaseInputOpinionsRepository(BaseInputRepository): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from arekit.common.experiment.input.providers.rows.samples import BaseSampleRowProvider | ||
from arekit.common.experiment.input.repositories.base import BaseInputRepository | ||
|
||
|
||
class BaseInputSamplesRepository(BaseInputRepository): | ||
|
||
def _setup_rows_provider(self): | ||
""" Setup store labels. | ||
""" | ||
assert(isinstance(self._rows_provider, BaseSampleRowProvider)) | ||
self._rows_provider.set_store_labels(self._columns_provider.StoreLabels) | ||
|
||
def _setup_columns_provider(self): | ||
""" Setup text column names. | ||
""" | ||
text_column_names = list(self._rows_provider.TextProvider.iter_columns()) | ||
self._columns_provider.set_text_column_names(text_column_names) | ||
|
||
def _setup_storage(self): | ||
""" Setup output labels uint | ||
""" | ||
super(BaseInputSamplesRepository, self)._setup_storage() | ||
self._storage.set_output_labels_uint( | ||
labels_uint=self._rows_provider.LabelProvider.OutputLabelsUint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.