MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
[Temporal Database] The MyCaffeTemporalDatabase provides an enhanced in-memory temporal database used for quick temporal data retrieval. More...
Public Member Functions | |
MyCaffeTemporalDatabase (Log log, PropertySet prop) | |
The constructor. More... | |
MyCaffeTemporalDatabase (IContainer container) | |
The constructor. More... | |
void | CleanUp (int nDsId=0, bool bForce=false) |
Cleanup all resources used by the dataset specified (or all when no dataset is specified). More... | |
void | Reset () |
Reset the database indexes. More... | |
int | GetTotalSize (int nDsId, Phase phase, int nHistoricalSteps, int nFutureSteps) |
Returns the total number of blocks in the database where one block is a set of (historical and future steps). More... | |
DatasetDescriptor | GetDatasetById (int nDsId) |
Return the dataset descriptor of the dataset with the specified ID. More... | |
DatasetDescriptor | GetDatasetByName (string strDs) |
Return the dataset descriptor of the dataset with the specified dataset name. More... | |
int | GetDatasetID (string strDs) |
Return the dataset ID of the dataset with the specified dataset name. More... | |
double | GetDatasetLoadedPercentById (int nDatasetID, out double dfTraining, out double dfTesting) |
Return the load percentage for dataset ID. More... | |
double | GetDatasetLoadedPercentByName (string strDataset, out double dfTraining, out double dfTesting) |
Return the load percentage for a dataset. More... | |
string | GetDatasetName (int nDsId) |
Returns the dataset name given its ID. More... | |
Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > | GetSelectionMethod () |
Returns the item and value selection method used. More... | |
SourceDescriptor | GetSourceById (int nSrcId) |
Get the source given its ID. More... | |
SourceDescriptor | GetSourceByName (string strSrc) |
Get the source given its name. More... | |
int | GetSourceID (string strSrc) |
Get the source ID given its name. More... | |
string | GetSourceName (int nSrcId) |
Get the source name given its ID. More... | |
bool | ReloadDataset (int nDsId) |
Reload the dataset with the specified dataset ID. More... | |
bool | UnloadDatasetById (int nDsId) |
Unload the dataset specified by the dataset ID. More... | |
bool | UnloadDatasetByName (string strDataset) |
Unload the dataset specified by the dataset name. More... | |
DB_VERSION | GetVersion () |
Returns the version of the database (e.g., TEMPORAL). More... | |
void | SetInitializationProperties (PropertySet prop) |
Set the initialization properties to use when initializing a dataset. More... | |
bool | InitializeWithDsId1 (SettingsCaffe s, int nDataSetID, string strEvtCancel=null, int nPadW=0, int nPadH=0, PropertySet prop=null) |
Initialize the database with the specified dataset ID. More... | |
bool | InitializeWithDs1 (SettingsCaffe s, DatasetDescriptor ds1, string strEvtCancel=null, PropertySet prop=null) |
Initialize the database with the specified dataset descriptor. More... | |
bool | InitializeWithDsName1 (SettingsCaffe s, string strDs, string strEvtCancel=null, PropertySet prop=null) |
Initialize the database with the specified dataset name. More... | |
bool | LoadDatasetByID1 (int nDsId, string strEvtCancel=null) |
Load the dataset specified by the dataset ID. More... | |
bool | LoadDatasetByName1 (string strDs, string strEvtCancel=null) |
Load the dataset specified by the dataset name. More... | |
SimpleTemporalDatumCollection | QueryTemporalItem (int nQueryIdx, int nSrcId, ref int? nItemIdx, ref int? nValueIdx, DB_LABEL_SELECTION_METHOD? itemSelectionOverride=null, DB_ITEM_SELECTION_METHOD? valueSelectionOverride=null, bool bEnableDebug=false, string strDebugPath=null) |
Returns a block of static, observed and known data from the database where one block is a set of (historical and future steps). More... | |
void | SetConnection (ConnectInfo ci) |
Set the database connection to use. More... | |
void | SetSelectionMethod (DB_LABEL_SELECTION_METHOD? item, DB_ITEM_SELECTION_METHOD? value) |
Sets the label and image selection methods. More... | |
Public Member Functions inherited from System.ComponentModel.Component | |
Component () | |
Static Public Member Functions | |
static void | CreateDatabaseTables (ConnectInfo ci, bool bTemporalOnly) |
Create the database tables used by the MyCaffeTemporalDatabase. More... | |
static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > | GetSelectionMethod (SettingsCaffe s) |
Returns the item/value selection methods based on the SettingsCaffe settings. More... | |
static Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > | GetSelectionMethod (ProjectEx p) |
Returns the item/value selection methods based on the ProjectEx settings. More... | |
[Temporal Database] The MyCaffeTemporalDatabase provides an enhanced in-memory temporal database used for quick temporal data retrieval.
The MyCaffeTemporalDatbase manages a set of data sets, where each data sets comprise a pair of data sources: one source for training and another source for testing. Each data source contains a set of temporal data streams.
This organization allows for quick temporal data selection and is used with temporal models such as the Temporal Fusion Transformer (TFT).
Definition at line 29 of file MyCaffeTemporalDatabase.cs.
MyCaffe.db.temporal.MyCaffeTemporalDatabase.MyCaffeTemporalDatabase | ( | Log | log, |
PropertySet | prop | ||
) |
The constructor.
log | The Log for output. |
prop | Specifies the initialization properties. |
Definition at line 53 of file MyCaffeTemporalDatabase.cs.
MyCaffe.db.temporal.MyCaffeTemporalDatabase.MyCaffeTemporalDatabase | ( | IContainer | container | ) |
The constructor.
container | Specifies the container for the component. |
Definition at line 64 of file MyCaffeTemporalDatabase.cs.
void MyCaffe.db.temporal.MyCaffeTemporalDatabase.CleanUp | ( | int | nDsId = 0 , |
bool | bForce = false |
||
) |
Cleanup all resources used by the dataset specified (or all when no dataset is specified).
nDsId | Specifies the dataset to cleanup, or 0 for all datasets. |
bForce | Not used. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 76 of file MyCaffeTemporalDatabase.cs.
|
static |
Create the database tables used by the MyCaffeTemporalDatabase.
ci | Specifies the connection information for the database (recommended value: db = 'DNN', server = '.') |
bTemporalOnly | Specifies to only update the temporal tables. |
Definition at line 92 of file MyCaffeTemporalDatabase.cs.
DatasetDescriptor MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetById | ( | int | nDsId | ) |
Return the dataset descriptor of the dataset with the specified ID.
nDsId | Specifies the ID of the dataset to find. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 164 of file MyCaffeTemporalDatabase.cs.
DatasetDescriptor MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetByName | ( | string | strDs | ) |
Return the dataset descriptor of the dataset with the specified dataset name.
strDs | Specifies the name of the dataset to find. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 178 of file MyCaffeTemporalDatabase.cs.
int MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetID | ( | string | strDs | ) |
Return the dataset ID of the dataset with the specified dataset name.
strDs | Specifies the dataset name. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 195 of file MyCaffeTemporalDatabase.cs.
double MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetLoadedPercentById | ( | int | nDatasetID, |
out double | dfTraining, | ||
out double | dfTesting | ||
) |
Return the load percentage for dataset ID.
nDatasetID | Specifies the dataset ID. |
dfTraining | Specifies the training percent loaded. |
dfTesting | Specifies the testing percent loaded. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 207 of file MyCaffeTemporalDatabase.cs.
double MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetLoadedPercentByName | ( | string | strDataset, |
out double | dfTraining, | ||
out double | dfTesting | ||
) |
Return the load percentage for a dataset.
strDataset | Specifies the dataset name. |
dfTraining | Specifies the training percent loaded. |
dfTesting | Specifies the testing percent loaded. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 227 of file MyCaffeTemporalDatabase.cs.
string MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetDatasetName | ( | int | nDsId | ) |
Returns the dataset name given its ID.
nDsId | Specifies the dataset ID. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 237 of file MyCaffeTemporalDatabase.cs.
Tuple< DB_LABEL_SELECTION_METHOD, DB_ITEM_SELECTION_METHOD > MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetSelectionMethod | ( | ) |
Returns the item and value selection method used.
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 288 of file MyCaffeTemporalDatabase.cs.
|
static |
Returns the item/value selection methods based on the ProjectEx settings.
p | Specifies the project. |
Definition at line 270 of file MyCaffeTemporalDatabase.cs.
|
static |
Returns the item/value selection methods based on the SettingsCaffe settings.
s | Specifies the caffe settings. |
Definition at line 251 of file MyCaffeTemporalDatabase.cs.
SourceDescriptor MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetSourceById | ( | int | nSrcId | ) |
Get the source given its ID.
nSrcId | Specifies the Source ID. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 298 of file MyCaffeTemporalDatabase.cs.
SourceDescriptor MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetSourceByName | ( | string | strSrc | ) |
Get the source given its name.
strSrc | Specifies the Source Name. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 308 of file MyCaffeTemporalDatabase.cs.
int MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetSourceID | ( | string | strSrc | ) |
Get the source ID given its name.
strSrc | Specifies the Source Name. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 318 of file MyCaffeTemporalDatabase.cs.
string MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetSourceName | ( | int | nSrcId | ) |
Get the source name given its ID.
nSrcId | Specifies the Source Id. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 332 of file MyCaffeTemporalDatabase.cs.
int MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetTotalSize | ( | int | nDsId, |
Phase | phase, | ||
int | nHistoricalSteps, | ||
int | nFutureSteps | ||
) |
Returns the total number of blocks in the database where one block is a set of (historical and future steps).
nDsId | Specifies the dataset ID. |
phase | Specifies the phase who's data size is to be returned. |
nHistoricalSteps | Specifies the number of historical steps. |
nFutureSteps | Specifies the number of future steps. |
Implements MyCaffe.basecode.IXTemporalDatabaseBase.
Definition at line 134 of file MyCaffeTemporalDatabase.cs.
DB_VERSION MyCaffe.db.temporal.MyCaffeTemporalDatabase.GetVersion | ( | ) |
Returns the version of the database (e.g., TEMPORAL).
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 390 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.InitializeWithDs1 | ( | SettingsCaffe | s, |
DatasetDescriptor | ds1, | ||
string | strEvtCancel = null , |
||
PropertySet | prop = null |
||
) |
Initialize the database with the specified dataset descriptor.
s | Specifies the initial settings that specify the load method and load limit. |
ds1 | Specifies the dataset descriptor to load. |
strEvtCancel | Optionally, specifies the name of a global cancel event (default = null). |
prop | Optionally specifies the properties for the initialization (default = null). |
You must call SetInitializationProperties before calling the InitializeWithDsId method.
Exception | An exception is thrown on error, e.g, when missing initialization properties. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 472 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.InitializeWithDsId1 | ( | SettingsCaffe | s, |
int | nDataSetID, | ||
string | strEvtCancel = null , |
||
int | nPadW = 0 , |
||
int | nPadH = 0 , |
||
PropertySet | prop = null |
||
) |
Initialize the database with the specified dataset ID.
s | Specifies the initial settings that specify the load method and load limit. |
nDataSetID | Specifies the dataset ID to load. |
strEvtCancel | Optionally, specifies the name of a global cancel event (default = null). |
nPadW | Not Used |
nPadH | Not Used |
prop | Optionally specifies the properties for the initialization (default = null). |
You must call SetInitializationProperties before calling the InitializeWithDsId method.
Exception | An exception is thrown on error, e.g, when missing initialization properties. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 425 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.InitializeWithDsName1 | ( | SettingsCaffe | s, |
string | strDs, | ||
string | strEvtCancel = null , |
||
PropertySet | prop = null |
||
) |
Initialize the database with the specified dataset name.
s | Specifies the initial settings that specify the load method and load limit. |
strDs | Specifies the name of the dataset to load. |
strEvtCancel | Optionally, specifies the name of a global cancel event (default = null). |
prop | Optionally specifies the properties for the initialization (default = null). |
You must call SetInitializationProperties before calling the InitializeWithDsId method.
Exception | An exception is thrown on error, e.g, when missing initialization properties. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 489 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.LoadDatasetByID1 | ( | int | nDsId, |
string | strEvtCancel = null |
||
) |
Load the dataset specified by the dataset ID.
nDsId | Specifies the datset ID of the dataset to load. |
strEvtCancel | Optionally, specifies the name of the global cancel event. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 509 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.LoadDatasetByName1 | ( | string | strDs, |
string | strEvtCancel = null |
||
) |
Load the dataset specified by the dataset name.
strDs | Specifies the name of the dataset to load. |
strEvtCancel | Optionally, specifies the name of the global cancel event. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 523 of file MyCaffeTemporalDatabase.cs.
SimpleTemporalDatumCollection MyCaffe.db.temporal.MyCaffeTemporalDatabase.QueryTemporalItem | ( | int | nQueryIdx, |
int | nSrcId, | ||
ref int? | nItemIdx, | ||
ref int? | nValueIdx, | ||
DB_LABEL_SELECTION_METHOD? | itemSelectionOverride = null , |
||
DB_ITEM_SELECTION_METHOD? | valueSelectionOverride = null , |
||
bool | bEnableDebug = false , |
||
string | strDebugPath = null |
||
) |
Returns a block of static, observed and known data from the database where one block is a set of (historical and future steps).
nQueryIdx | Specifies the index of the query within a batch. |
nSrcId | Specifies the source ID of the data source. |
nItemIdx | Specifies the item index override when not null, returns the item index used. |
nValueIdx | Specifies the value index override when not null, returns the index used with in the item. |
itemSelectionOverride | Optionally, specifies the item selection method used to select the item (e.g., customer, station, stock symbol) |
valueSelectionOverride | Optionally, specifies the value selection method used to select the index within the temporal data of the selected item. |
bEnableDebug | Optionally, specifies to enable debug output (default = false). |
strDebugPath | Optionally, specifies the debug path where debug images are placed when 'EnableDebug' = true. |
Implements MyCaffe.basecode.IXTemporalDatabaseBase.
Definition at line 560 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.ReloadDataset | ( | int | nDsId | ) |
Reload the dataset with the specified dataset ID.
nDsId | Specifies the dataset ID. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 346 of file MyCaffeTemporalDatabase.cs.
void MyCaffe.db.temporal.MyCaffeTemporalDatabase.Reset | ( | ) |
Reset the database indexes.
This method is only used when using sequential selection.
Implements MyCaffe.basecode.IXTemporalDatabaseBase.
Definition at line 118 of file MyCaffeTemporalDatabase.cs.
void MyCaffe.db.temporal.MyCaffeTemporalDatabase.SetConnection | ( | ConnectInfo | ci | ) |
Set the database connection to use.
ci | Specifies the dataase connection information to use. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 574 of file MyCaffeTemporalDatabase.cs.
void MyCaffe.db.temporal.MyCaffeTemporalDatabase.SetInitializationProperties | ( | PropertySet | prop | ) |
Set the initialization properties to use when initializing a dataset.
prop | Specifies the initialization properties (see remarks). |
The initialization properties for the dataset must include the following properties: NormalizeData (bool) - whether or not to use the normalized data or raw data. HistoricalSteps (int) - value > 0 specifiying the number of historical steps to use. FutureSteps (int) - value > 0 specifiying the number of future steps to use. Chunks (int) - Optional, value > 0 specifying the number of chunks to use (default = 1024).
Implements MyCaffe.basecode.IXTemporalDatabaseBase.
Definition at line 406 of file MyCaffeTemporalDatabase.cs.
void MyCaffe.db.temporal.MyCaffeTemporalDatabase.SetSelectionMethod | ( | DB_LABEL_SELECTION_METHOD? | item, |
DB_ITEM_SELECTION_METHOD? | value | ||
) |
Sets the label and image selection methods.
item | Specifies the item selection method or null to ignore. |
value | Specifies the value selection method or null to ignore. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 584 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.UnloadDatasetById | ( | int | nDsId | ) |
Unload the dataset specified by the dataset ID.
nDsId | Specifies the dataset ID. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 357 of file MyCaffeTemporalDatabase.cs.
bool MyCaffe.db.temporal.MyCaffeTemporalDatabase.UnloadDatasetByName | ( | string | strDataset | ) |
Unload the dataset specified by the dataset name.
strDataset | Specifies the dataset name. |
Implements MyCaffe.basecode.IXDatabaseBase.
Definition at line 381 of file MyCaffeTemporalDatabase.cs.