diff --git a/windows/xgboost.sln b/windows/xgboost.sln index 59aa78180..e3ce195d3 100644 --- a/windows/xgboost.sln +++ b/windows/xgboost.sln @@ -1,8 +1,12 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xgboost", "xgboost\xgboost.vcxproj", "{1D6A56A5-5557-4D20-9D50-3DE4C30BE00C}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xgboost_wrapper", "xgboost_wrapper\xgboost_wrapper.vcxproj", "{2E1AF937-28BB-4832-B916-309C9A0F6C4F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -19,6 +23,14 @@ Global {1D6A56A5-5557-4D20-9D50-3DE4C30BE00C}.Release|Win32.Build.0 = Release|Win32 {1D6A56A5-5557-4D20-9D50-3DE4C30BE00C}.Release|x64.ActiveCfg = Release|x64 {1D6A56A5-5557-4D20-9D50-3DE4C30BE00C}.Release|x64.Build.0 = Release|x64 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Debug|Win32.ActiveCfg = Debug|Win32 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Debug|Win32.Build.0 = Debug|Win32 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Debug|x64.ActiveCfg = Debug|x64 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Debug|x64.Build.0 = Debug|x64 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Release|Win32.ActiveCfg = Release|Win32 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Release|Win32.Build.0 = Release|Win32 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Release|x64.ActiveCfg = Release|x64 + {2E1AF937-28BB-4832-B916-309C9A0F6C4F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/windows/xgboost/xgboost.vcxproj b/windows/xgboost/xgboost.vcxproj index 8b88dbf2e..fac91075c 100644 --- a/windows/xgboost/xgboost.vcxproj +++ b/windows/xgboost/xgboost.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -27,23 +27,27 @@ Application true MultiByte + v120 Application true MultiByte + v120 Application false true MultiByte + v120 Application false true MultiByte + v120 diff --git a/windows/xgboost/xgboost_wrapper/xgboost_wrapper.vcxproj b/windows/xgboost/xgboost_wrapper/xgboost_wrapper.vcxproj new file mode 100644 index 000000000..b167e8d7d --- /dev/null +++ b/windows/xgboost/xgboost_wrapper/xgboost_wrapper.vcxproj @@ -0,0 +1,154 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2E1AF937-28BB-4832-B916-309C9A0F6C4F} + v4.5 + ManagedCProj + xgboost_wrapper + + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + + + true + + + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + true + + + true + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + Use + + + true + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wrapper/xgboost.py b/wrapper/xgboost.py index 013b84b15..01eccfbea 100644 --- a/wrapper/xgboost.py +++ b/wrapper/xgboost.py @@ -9,7 +9,10 @@ import numpy.ctypeslib import scipy.sparse as scp # set this line correctly -XGBOOST_PATH = os.path.dirname(__file__)+'/libxgboostwrapper.so' +if os.name == 'nt': + XGBOOST_PATH = os.path.dirname(__file__)+'/../windows/x64/Release/xgboost_wrapper.dll' +else: + XGBOOST_PATH = os.path.dirname(__file__)+'/../libxgboostwrapper.so' # load in xgboost library xglib = ctypes.cdll.LoadLibrary(XGBOOST_PATH) @@ -231,7 +234,7 @@ class Booster: trees = self.get_dump(fmap) fmap = {} for tree in trees: - print tree + print (tree) for l in tree.split('\n'): arr = l.split('[') if len(arr) == 1: @@ -263,7 +266,7 @@ def train(params, dtrain, num_boost_round = 10, evals = [], obj=None, feval=None for i in range(num_boost_round): bst.update( dtrain, i ) if len(evals) != 0: - sys.stderr.write(evaluate(bst, evals, i, feval)+'\n') + sys.stderr.write(evaluate(bst, evals, i, feval).decode()+'\n') else: # try customized objective function for i in range(num_boost_round):