KSquare Utilities
KKMLVariables.cpp
Go to the documentation of this file.
1 #include "FirstIncludes.h"
2 #include <stdlib.h>
3 #include <memory>
4 #include "MemoryDebug.h"
5 using namespace std;
6 
7 
8 #include "KKBaseTypes.h"
9 #include "OSservices.h"
10 using namespace KKB;
11 
12 
13 #include "KKMLVariables.h"
14 using namespace KKMLL;
15 
16 
17 
19 {
20 }
21 
22 
23 
25 {
26 }
27 
28 
29 
30 KKStr KKMLVariables::machineLearningHomeDir;
31 
32 
33 
34 const KKStr& KKMLVariables::MachineLearningHomeDir ()
35 {
36  if (machineLearningHomeDir.Empty ())
37  {
38  #if defined(OS_WINDOWS)
39  machineLearningHomeDir = "C:\\KKMLL";
40  #else
41  machineLearningHomeDir = "/KKMLL";
42  #endif
43 
44  KKStrPtr homeDir = osGetEnvVariable ("KKMLModelDir");
45  if (homeDir == NULL)
46  homeDir = osGetEnvVariable ("KKMLL");
47  if (homeDir == NULL)
48  homeDir = osGetEnvVariable ("MachineLearningDir");
49 
50  if (homeDir)
51  machineLearningHomeDir = *homeDir;
52 
53  delete homeDir;
54  homeDir = NULL;
55  }
56  return machineLearningHomeDir;
57 } /* MachineLearningHomeDir */
58 
59 
60 
61 void KKMLVariables::SetMachineLearninigHomeDir (const KKStr& _machineLearningHomeDir)
62 {
63  machineLearningHomeDir = _machineLearningHomeDir;
64 }
65 
66 
67 
69 {
70  return osAddSlash (MachineLearningHomeDir ()) + "Temp";
71 }
72 
73 
74 
76 {
77  return osAddSlash (MachineLearningHomeDir ()) + "TrainingLibraries";
78 }
79 
80 
81 
83 {
84  return osAddSlash (MachineLearningHomeDir ()) + "TrainingModels";
85 }
static KKStr TrainingModelsDir()
static KKStr TempDir()
KKStr & operator=(const char *src)
Definition: KKStr.cpp:1442
KKStr operator+(const char *right) const
Definition: KKStr.cpp:3986
static void SetMachineLearninigHomeDir(const KKStr &_machineLearningHomeDir)
KKB::KKStr osAddSlash(const KKStr &fileSpec)
KKTHread * KKTHreadPtr
bool Empty() const
Definition: KKStr.h:241
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
KKStrPtr osGetEnvVariable(const KKStr &_varName)
Definition: OSservices.cpp:897
#define OS_WINDOWS
Definition: FirstIncludes.h:11
KKStr & operator=(const KKStr &src)
Definition: KKStr.cpp:1390
void EncodeProblem(const struct svm_paramater &param, struct svm_problem &prob_in, struct svm_problem &prob_out)
static KKStr TrainingLibrariesDir()