Writer - API Reference¶
warprec.data.writer.base_writer.WriterFactory
¶
Factory class for creating Writer instances based on configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
config |
TrainConfiguration | EvalConfiguration | EstimateConfiguration
|
The configuration of the experiment. |
Source code in warprec/data/writer/base_writer.py
get_writer(config)
classmethod
¶
Factory method to get the appropriate Writer instance based on the configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TrainConfiguration | EvalConfiguration | EstimateConfiguration
|
The configuration of the experiment. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Writer |
Writer
|
An instance of a class that extends the Writer abstract class. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the writing method specified in the configuration is unknown. |
Source code in warprec/data/writer/base_writer.py
warprec.data.writer.local_writer.LocalWriter
¶
Bases: Writer
LocalWriter saves the experiment results to the local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_name
|
str
|
The name of the dataset. |
required |
local_path
|
str
|
The root path for saving experiments. |
required |
Source code in warprec/data/writer/local_writer.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
setup_experiment()
¶
Creates all necessary local directories for the experiment.
Source code in warprec/data/writer/local_writer.py
write_recs(model, dataset, k, sep='\t', ext='.tsv', header=True, user_label='user_id', item_label='item_id', rating_label='rating')
¶
Writes recommendations to a local file in a streaming fashion.
Source code in warprec/data/writer/local_writer.py
warprec.data.writer.azureblob_writer.AzureBlobWriter
¶
Bases: Writer
AzureBlobWriter saves the experiment results to Azure Blob Storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_account_name
|
str
|
The storage account name of the Azure Blob Storage. |
required |
container_name
|
str
|
The name of the blob container where results will be stored. |
required |
dataset_name
|
str
|
The name of the dataset. |
required |
blob_experiment_container
|
str
|
The root container for experiments. Defaults to "experiments". |
'experiments'
|
Source code in warprec/data/writer/azureblob_writer.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
setup_experiment()
¶
Ensures the Azure Blob container exists.
Source code in warprec/data/writer/azureblob_writer.py
write_recs(model, dataset, k, sep='\t', ext='.tsv', header=True, user_label='user_id', item_label='item_id', rating_label='rating')
¶
Uploads recommendations to Azure Blob Storage in a streaming fashion.