From 6c3bc36a25caa3c17d288f35425363ecd9d91dba Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 00:36:01 +0200 Subject: [PATCH 01/35] starting to develop a c# wrapper for xgboost --- .../Properties/AssemblyInfo.cs | 36 ++++++++++ windows/xgboost_sharp_wrapper/xgboost.cs | 68 ++++++++++++++++++ .../xgboost_sharp_wrapper.csproj | 71 +++++++++++++++++++ .../xgboost_sharp_wrapper.sln | 38 ++++++++++ 4 files changed, 213 insertions(+) create mode 100644 windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs create mode 100644 windows/xgboost_sharp_wrapper/xgboost.cs create mode 100644 windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj create mode 100644 windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln diff --git a/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs b/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..1baa42aea --- /dev/null +++ b/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Le informazioni generali relative a un assembly sono controllate dal seguente +// set di attributi. Per modificare le informazioni associate a un assembly +// occorre quindi modificare i valori di questi attributi. +[assembly: AssemblyTitle("xgboost_sharp_wrapper")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("xgboost_sharp_wrapper")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili +// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da +// COM, impostare su true l'attributo ComVisible per tale tipo. +[assembly: ComVisible(false)] + +// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi +[assembly: Guid("accc4026-fa8e-41d8-aaa8-1ca69c2b2db5")] + +// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +// +// Numero di versione principale +// Numero di versione secondario +// Numero build +// Revisione +// +// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build +// utilizzando l'asterisco (*) come descritto di seguito: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs new file mode 100644 index 000000000..560fb1412 --- /dev/null +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace xgboost_sharp_wrapper +{ + + + public class xgboost + { + private const string dll_path="..\\x64\\Release\\"; + + [DllImport(dll_path+"xgboost_wrapper.dll", CallingConvention=CallingConvention.Cdecl)] + public static extern IntPtr XGDMatrixCreateFromFile(string fname, int silent); + + public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) + { + return XGDMatrixCreateFromFile(fname, silent); + } + + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern IntPtr XGBoosterCreate(IntPtr[] dmats, System.UInt32 len); + + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern void XGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain); + + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern string XGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, + string[] evnames, System.UInt32 len); + /*! + * \brief make prediction based on dmat + * \param handle handle + * \param dmat data matrix + * \param output_margin whether only output raw margin value + * \param len used to store length of returning result + */ + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern Double[] XGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, System.UInt32 len); + /*! + * \brief load model from existing file + * \param handle handle + * \param fname file name + */ + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern void XGBoosterLoadModel(IntPtr handle, string fname); + /*! + * \brief save model into existing file + * \param handle handle + * \param fname file name + */ + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern void XGBoosterSaveModel(IntPtr handle, string fname); + /*! + * \brief dump model, return array of strings representing model dump + * \param handle handle + * \param fmap name to fmap can be empty string + * \param out_len length of output array + * \return char *data[], representing dump of each model + */ + [DllImport(dll_path + "xgboost_wrapper.dll")] + public static extern string XGBoosterDumpModel(IntPtr handle, string fmap, + System.UInt32 out_len); + + } +} diff --git a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj new file mode 100644 index 000000000..01aafd029 --- /dev/null +++ b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj @@ -0,0 +1,71 @@ + + + + + Debug + AnyCPU + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3} + Library + Properties + xgboost_sharp_wrapper + xgboost_sharp_wrapper + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + ManagedMinimumRules.ruleset + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + ManagedMinimumRules.ruleset + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln new file mode 100644 index 000000000..600c68552 --- /dev/null +++ b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln @@ -0,0 +1,38 @@ + +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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xgboost_sharp_wrapper", "xgboost_sharp_wrapper.csproj", "{2D0E7F78-53DD-4501-8BD9-69E21A5051E3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kaggle_higgs_demo", "..\kaggle_higgs_demo\kaggle_higgs_demo.csproj", "{2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|x64.ActiveCfg = Debug|x64 + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|x64.Build.0 = Debug|x64 + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|Any CPU.Build.0 = Release|Any CPU + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|x64.ActiveCfg = Release|x64 + {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|x64.Build.0 = Release|x64 + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|x64.ActiveCfg = Debug|x64 + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|x64.Build.0 = Debug|x64 + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|Any CPU.Build.0 = Release|Any CPU + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|x64.ActiveCfg = Release|x64 + {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From db46e7a7302993f3a4747a579e6c997e1f66d86d Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 01:01:30 +0200 Subject: [PATCH 02/35] starting to develop a c# wrapper for xgboost: c# implementation of kaggle higgs demo --- windows/xgboost_sharp_wrapper/xgboost.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs index 560fb1412..f8048f793 100644 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -15,14 +15,17 @@ namespace xgboost_sharp_wrapper [DllImport(dll_path+"xgboost_wrapper.dll", CallingConvention=CallingConvention.Cdecl)] public static extern IntPtr XGDMatrixCreateFromFile(string fname, int silent); - - public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) +public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) { return XGDMatrixCreateFromFile(fname, silent); } [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern IntPtr XGBoosterCreate(IntPtr[] dmats, System.UInt32 len); + public IntPtr SharpXGBoosterCreate(IntPtr[] dmats, System.UInt32 len) + { + return XGBoosterCreate(dmats, len); + } [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern void XGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain); From ba2d062f09822e9161915e784acffe8cb8956437 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 01:36:04 +0200 Subject: [PATCH 03/35] sharp higgs demo - training --- windows/xgboost_sharp_wrapper/xgboost.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs index f8048f793..ed9a9fb6d 100644 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -29,6 +29,10 @@ public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern void XGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain); + public void SharpXGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain) + { + XGBoosterUpdateOneIter(handle, iter, dtrain); + } [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern string XGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, From 4a67296e30210f7cddd9241f6419108b5a20b84e Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 01:43:45 +0200 Subject: [PATCH 04/35] program cleanse NEXT TO DO: try to predict after training From 8b26cba148d734fcb0570e1d1baaf3dd615fa549 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 02:03:00 +0200 Subject: [PATCH 05/35] eval training --- windows/xgboost_sharp_wrapper/xgboost.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs index ed9a9fb6d..e1656fae7 100644 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -37,6 +37,11 @@ public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern string XGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, string[] evnames, System.UInt32 len); + public string SharpXGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, + string[] evnames, System.UInt32 len) + { + return XGBoosterEvalOneIter(handle, iter, dmats, evnames, len); + } /*! * \brief make prediction based on dmat * \param handle handle From 2587da5fead7ee6fb1fa0986938966c23a252d8a Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 03:05:40 +0200 Subject: [PATCH 06/35] First example of c# wrapper done (marshalling prediction to submission file) --- windows/xgboost_sharp_wrapper/xgboost.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs index e1656fae7..c1f07044b 100644 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -50,7 +50,18 @@ public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) * \param len used to store length of returning result */ [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern Double[] XGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, System.UInt32 len); + public static extern IntPtr XGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, ref System.UInt32 len); + + public float[] SharpXGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, System.UInt32 len) + { + IntPtr buf = XGBoosterPredict(handle, dmat, output_margin, ref len); + + float[] buffer = new float[len]; + + Marshal.Copy(buf, buffer, 0, buffer.Length); + + return buffer; + } /*! * \brief load model from existing file * \param handle handle From b2083380987f87e147dd9fdda7fd19e829b2101d Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 10:26:41 +0200 Subject: [PATCH 07/35] c# kaggle higgs demo drafted --- windows/xgboost_sharp_wrapper/xgboost.cs | 80 +++++++++++++++--------- 1 file changed, 49 insertions(+), 31 deletions(-) diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs index c1f07044b..ae5f3a205 100644 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ b/windows/xgboost_sharp_wrapper/xgboost.cs @@ -7,19 +7,37 @@ using System.Runtime.InteropServices; namespace xgboost_sharp_wrapper { - - + + public class xgboost { - private const string dll_path="..\\x64\\Release\\"; + private const string dll_path = "..\\x64\\Release\\"; - [DllImport(dll_path+"xgboost_wrapper.dll", CallingConvention=CallingConvention.Cdecl)] + [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr XGDMatrixCreateFromFile(string fname, int silent); -public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) + public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) { return XGDMatrixCreateFromFile(fname, silent); } + + /*! + * \brief set float vector to a content in info + * \param handle a instance of data matrix + * \param field field name, can be label, weight + * \param array pointer to float vector + * \param len length of array + */ + [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void XGDMatrixSetFloatInfo(IntPtr handle, string field, IntPtr array, System.UInt32 len); + + [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void XGBoosterSetParam(IntPtr handle, string name, string value); + public void SharpXGBoosterSetParam(IntPtr handle, string name, string value) + { + XGBoosterSetParam(handle,name,value); + } + [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern IntPtr XGBoosterCreate(IntPtr[] dmats, System.UInt32 len); public IntPtr SharpXGBoosterCreate(IntPtr[] dmats, System.UInt32 len) @@ -42,47 +60,47 @@ public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) { return XGBoosterEvalOneIter(handle, iter, dmats, evnames, len); } - /*! - * \brief make prediction based on dmat - * \param handle handle - * \param dmat data matrix - * \param output_margin whether only output raw margin value - * \param len used to store length of returning result - */ + /*! + * \brief make prediction based on dmat + * \param handle handle + * \param dmat data matrix + * \param output_margin whether only output raw margin value + * \param len used to store length of returning result + */ [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern IntPtr XGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, ref System.UInt32 len); - + public float[] SharpXGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, System.UInt32 len) { IntPtr buf = XGBoosterPredict(handle, dmat, output_margin, ref len); - + float[] buffer = new float[len]; Marshal.Copy(buf, buffer, 0, buffer.Length); return buffer; } - /*! - * \brief load model from existing file - * \param handle handle - * \param fname file name - */ + /*! + * \brief load model from existing file + * \param handle handle + * \param fname file name + */ [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern void XGBoosterLoadModel(IntPtr handle, string fname); - /*! - * \brief save model into existing file - * \param handle handle - * \param fname file name - */ + /*! + * \brief save model into existing file + * \param handle handle + * \param fname file name + */ [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern void XGBoosterSaveModel(IntPtr handle, string fname); - /*! - * \brief dump model, return array of strings representing model dump - * \param handle handle - * \param fmap name to fmap can be empty string - * \param out_len length of output array - * \return char *data[], representing dump of each model - */ + /*! + * \brief dump model, return array of strings representing model dump + * \param handle handle + * \param fmap name to fmap can be empty string + * \param out_len length of output array + * \return char *data[], representing dump of each model + */ [DllImport(dll_path + "xgboost_wrapper.dll")] public static extern string XGBoosterDumpModel(IntPtr handle, string fmap, System.UInt32 out_len); From 473744c5ac4388b2b0bb4cc3a414e02e661fa3ae Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 14:55:45 +0200 Subject: [PATCH 08/35] conversion from csv to libsvm From 77e967f0e6c34ed00e0a20da3987628dbca489eb Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 15:19:12 +0200 Subject: [PATCH 09/35] Fix: Events Dictionary From 6d3eea50562225e811cd2f5f2f5ccfcbed618cba Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sat, 30 Aug 2014 16:14:09 +0200 Subject: [PATCH 10/35] c# Booster class (almost ready to do cv) From 82470ef96b77aef0494087bbeaec6e4a1b5e83d8 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:28:23 +0200 Subject: [PATCH 11/35] Update README.md --- README.md | 52 +++++++--------------------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index ee620d6cd..f11dd74ec 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,8 @@ -xgboost: eXtreme Gradient Boosting -====== -An optimized general purpose gradient boosting (tree) library. +This is a Fork of XGBoost from https://github.com/tqchen/xgboost +In the main repo you already find 2 windows project for the porting of the executable and the python library. +Here you have +1) a c# dll wrapper, meaning the passage unmanaged to managed code +2) the c# Higgs Kaggle demo, instead of the python one -Contributors: https://github.com/tqchen/xgboost/graphs/contributors - -Turorial and Documentation: https://github.com/tqchen/xgboost/wiki - -Questions and Issues: [https://github.com/tqchen/xgboost/issues](https://github.com/tqchen/xgboost/issues?q=is%3Aissue+label%3Aquestion) - -Notes on the Code: [Code Guide](src) - -Features -====== -* Sparse feature format: - - Sparse feature format allows easy handling of missing values, and improve computation efficiency. -* Push the limit on single machine: - - Efficient implementation that optimizes memory and computation. -* Speed: XGBoost is very fast - - IN [demo/higgs/speedtest.py](demo/kaggle-higgs/speedtest.py), kaggle higgs data it is faster(on our machine 20 times faster using 4 threads) than sklearn.ensemble.GradientBoostingClassifier -* Layout of gradient boosting algorithm to support user defined objective -* Python interface, works with numpy and scipy.sparse matrix - -Build -====== -* Simply type make -* If your compiler does not come with OpenMP support, it will fire an warning telling you that the code will compile into single thread mode, and you will get single thread xgboost -* You may get a error: -lgomp is not found - - You can type ```make no_omp=1```, this will get you single thread xgboost - - Alternatively, you can upgrade your compiler to compile multi-thread version -* Possible way to build using Visual Studio (not tested): - - In principle, you can put src/xgboost.cpp and src/io/io.cpp into the project, and build xgboost. - - For python module, you need python/xgboost_wrapper.cpp and src/io/io.cpp to build a dll. - -Version -====== -* This version is named xgboost-unity, the code has been refactored from 0.2x to be cleaner and more flexibility -* This version of xgboost is not compatible with 0.2x, due to huge amount of changes in code structure - - This means the model and buffer file of previous version can not be loaded in xgboost-unity -* For legacy 0.2x code, refer to [Here](https://github.com/tqchen/xgboost/releases/tag/v0.22) -* Change log in [CHANGES.md](CHANGES.md) - -XGBoost in Graphlab Create -====== -* XGBoost is adopted as part of boosted tree toolkit in Graphlab Create (GLC). Graphlab Create is a powerful python toolkit that allows you to data manipulation, graph processing, hyper-parameter search, and visualization of big data in one framework. Try the Graphlab Create in http://graphlab.com/products/create/quick-start-guide.html -* Nice blogpost by Jay Gu using GLC boosted tree to solve kaggle bike sharing challenge: http://blog.graphlab.com/using-gradient-boosted-trees-to-predict-bike-sharing-demand +next steps: +I will upload a c# cv implementation for the demo very soon From a68f6680a04086911341080bec8808e35017118c Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:29:03 +0200 Subject: [PATCH 12/35] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f11dd74ec..ecee80f4a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ This is a Fork of XGBoost from https://github.com/tqchen/xgboost -In the main repo you already find 2 windows project for the porting of the executable and the python library. + +In the main repo you already find 2 windows projects for the porting of the executable and the python library. Here you have 1) a c# dll wrapper, meaning the passage unmanaged to managed code 2) the c# Higgs Kaggle demo, instead of the python one From 0f28ee4a8eba6b3c20df5bddbf6193a13c8fd0c6 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:30:48 +0200 Subject: [PATCH 13/35] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ecee80f4a..614aacdd8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ This is a Fork of XGBoost from https://github.com/tqchen/xgboost In the main repo you already find 2 windows projects for the porting of the executable and the python library. -Here you have -1) a c# dll wrapper, meaning the passage unmanaged to managed code -2) the c# Higgs Kaggle demo, instead of the python one + +Here (https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper) you have: + + 1) a c# dll wrapper, meaning the passage unmanaged to managed code + 2) the c# Higgs Kaggle demo, instead of the python one next steps: -I will upload a c# cv implementation for the demo very soon + I will upload a c# cv implementation for the demo very soon From a7b512a1c896c99464833662b7c94260599fddbc Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:31:16 +0200 Subject: [PATCH 14/35] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 614aacdd8..6b6a3f65e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,10 @@ In the main repo you already find 2 windows projects for the porting of the exec Here (https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper) you have: 1) a c# dll wrapper, meaning the passage unmanaged to managed code + 2) the c# Higgs Kaggle demo, instead of the python one + next steps: + I will upload a c# cv implementation for the demo very soon From e26c072e8339e48f9c4a8f38f9c219e49f15a2d1 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:39:20 +0200 Subject: [PATCH 15/35] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b6a3f65e..98c1b053e 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ This is a Fork of XGBoost from https://github.com/tqchen/xgboost In the main repo you already find 2 windows projects for the porting of the executable and the python library. -Here (https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper) you have: +Here you have: - 1) a c# dll wrapper, meaning the passage unmanaged to managed code + 1) a c# dll wrapper, meaning the passage unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper - 2) the c# Higgs Kaggle demo, instead of the python one + 2) the c# Higgs Kaggle demo, instead of the python one in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo next steps: From e4ad70e21cd8a9a46494150fac3a9e6a48b81adb Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:41:34 +0200 Subject: [PATCH 16/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98c1b053e..4733a3142 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Here you have: 1) a c# dll wrapper, meaning the passage unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper - 2) the c# Higgs Kaggle demo, instead of the python one in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo + 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo next steps: From 41eef462f06dfcb83acb391a46abf13e588442f0 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 15:49:34 +0200 Subject: [PATCH 17/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4733a3142..5810720ea 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ In the main repo you already find 2 windows projects for the porting of the exec Here you have: - 1) a c# dll wrapper, meaning the passage unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper + 1) a c# dll wrapper, meaning the passage from unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo From 71e5b4c413e3452dac88ed8d61941de21fd2a9fc Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 16:13:20 +0200 Subject: [PATCH 18/35] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5810720ea..580c100c1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ Here you have: 1) a c# dll wrapper, meaning the passage from unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo + Start the demo from the root folder like this: + bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv next steps: From 318d57f9d012472019f488f0acddde8e04e1fecf Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 16:26:42 +0200 Subject: [PATCH 19/35] CV 5-fold implemented From 04fc25615c2b90342a1da210a6db6fac4a3b4c1e Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 16:28:49 +0200 Subject: [PATCH 20/35] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 580c100c1..c00dd5a6b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,4 @@ Here you have: Start the demo from the root folder like this: bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv - -next steps: - - I will upload a c# cv implementation for the demo very soon + 3) 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) From 442d17501f10b34b6fab744e218ee1d16a7175f5 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 17:09:52 +0200 Subject: [PATCH 21/35] cv1 + cv2 (inline 5-fold cross validation) From cd0976202b24657a0ba2bd147acfdee91cf57039 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 17:23:58 +0200 Subject: [PATCH 22/35] 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) From f88aa8d137310800c68ec6b805e5f4c250803c96 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 18:00:34 +0200 Subject: [PATCH 23/35] fix: submission format From 21f16eac7b1733dbf10297e3f322250cc07e9f11 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 18:03:12 +0200 Subject: [PATCH 24/35] fix: cv2 From f42b25ec821a8248ab591623a241ee9c91b23457 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Sun, 31 Aug 2014 18:04:28 +0200 Subject: [PATCH 25/35] test my inline cv From 147b7d33fee769856af499caf534e0406c63a3d4 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 00:50:43 +0200 Subject: [PATCH 26/35] NFold Refactoring From f1d6429e9641fc2ddd809ccbc921bb4df6aef001 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 01:10:29 +0200 Subject: [PATCH 27/35] Parametric NFold from cmd args From 2d1430ac01581608ff31e71a401ae5b3ad643aa5 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 01:14:10 +0200 Subject: [PATCH 28/35] set NFold CV from cmd args --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c00dd5a6b..992fd3a71 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Here you have: 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo Start the demo from the root folder like this: - bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv + bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv NFoldCV + NFoldCV: 0 => no cv , 5 = 5-fold-cv, 10 = 10-fold-cv :-) 3) 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) From c60649d28c057ce2f2dab1bbf4f67f559133e4b0 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 01:16:12 +0200 Subject: [PATCH 29/35] README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 992fd3a71..0393fd6b3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Here you have: 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo Start the demo from the root folder like this: bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv NFoldCV + NFoldCV: 0 => no cv , 5 = 5-fold-cv, 10 = 10-fold-cv :-) 3) 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) From dde22976cf522af0d426807a29f16015894b8a2f Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 01:17:29 +0200 Subject: [PATCH 30/35] format README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0393fd6b3..e26a02e25 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ Here you have: 1) a c# dll wrapper, meaning the passage from unmanaged to managed code, in https://github.com/giuliohome/xgboost/tree/master/windows/xgboost_sharp_wrapper 2) the c# Higgs Kaggle demo, instead of the python one (actually you will get a higher score with the c# version, due to some changes I've made) in https://github.com/giuliohome/xgboost/tree/master/windows/kaggle_higgs_demo + Start the demo from the root folder like this: + bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv NFoldCV NFoldCV: 0 => no cv , 5 = 5-fold-cv, 10 = 10-fold-cv :-) From 0be4f0032cac0c99267da0b44ff9f838afaec9b6 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Mon, 1 Sep 2014 01:50:07 +0200 Subject: [PATCH 31/35] new theory: predict from cv + parametric rounds --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e26a02e25..109ac13c5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Here you have: Start the demo from the root folder like this: - bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv NFoldCV + bin\x64\Debug\kaggle_higgs_demo.exe training_path.csv test_path.csv sharp_pred.csv NFoldCV NRound NFoldCV: 0 => no cv , 5 = 5-fold-cv, 10 = 10-fold-cv :-) From 3f11354adbc6de5fc4811e9ec32ffb4b3ea61db8 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Wed, 3 Sep 2014 23:14:31 +0200 Subject: [PATCH 32/35] Parallel execution of CV plus double inputted model --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 109ac13c5..f37db3e8e 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,12 @@ Here you have: NFoldCV: 0 => no cv , 5 = 5-fold-cv, 10 = 10-fold-cv :-) 3) 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) + +In my latest commit I've added + + 4) parallel execution of n-fold cv, on top of dotnet multithreading + + 5) double inputted model training, stopping at a configured ams objective + + + \ No newline at end of file From 73b627d532c9d1f559b545d3024a7d9c648a1c32 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Fri, 5 Sep 2014 13:08:06 +0200 Subject: [PATCH 33/35] Fixing Configuration Type for Win32/Debug Proposed fix to the main repo Changed the windows wrapper type to DynamicLibrary. It was already ok for the Win64/Release. maybe it got lost after latest commit --- .../xgboost_wrapper/xgboost_wrapper.vcxproj | 86 ++++++------------- 1 file changed, 26 insertions(+), 60 deletions(-) diff --git a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj index b167e8d7d..6c73e3cee 100644 --- a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj +++ b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,40 +18,38 @@ x64 + + + + + + - {2E1AF937-28BB-4832-B916-309C9A0F6C4F} - v4.5 - ManagedCProj + {B0E22ADD-7849-4D3A-BDC6-0932C5F11ED5} xgboost_wrapper DynamicLibrary true - v120 - true - Unicode + MultiByte DynamicLibrary true - v120 - true - Unicode + MultiByte DynamicLibrary false - v120 - true - Unicode + true + MultiByte DynamicLibrary false - v120 - true - Unicode + true + MultiByte @@ -69,85 +67,53 @@ - - true - - - true - - - false - - - false - + Level3 Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - NotUsing true - Level3 Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - NotUsing - true true - - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - Use + MaxSpeed + true + true + true true - + true + true Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - NotUsing + MaxSpeed + true + true true true - - + true + true - - - - - - - - - - - - - - - - - From 1d90288655ae1bafdcd0e85e7231483d21dbd31f Mon Sep 17 00:00:00 2001 From: giuliohome Date: Fri, 5 Sep 2014 13:30:02 +0200 Subject: [PATCH 34/35] Fixing Configuration Type for Win32/Debug Proposed fix to the main repo Changed the windows wrapper type to DynamicLibrary. It was already ok for the Win64/Release. maybe it got lost after latest commit --- windows/xgboost_wrapper/xgboost_wrapper.vcxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj index 95a94841d..6c73e3cee 100644 --- a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj +++ b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj @@ -30,17 +30,17 @@ - Application + DynamicLibrary true MultiByte - Application + DynamicLibrary true MultiByte - Application + DynamicLibrary false true MultiByte From 59e1e75857d072b76f53d13e9496d218806c18e4 Mon Sep 17 00:00:00 2001 From: giuliohome Date: Fri, 5 Sep 2014 13:37:18 +0200 Subject: [PATCH 35/35] same version reset changes --- README.md | 52 +++++++++ .../Properties/AssemblyInfo.cs | 36 ------ windows/xgboost_sharp_wrapper/xgboost.cs | 109 ------------------ .../xgboost_sharp_wrapper.csproj | 71 ------------ .../xgboost_sharp_wrapper.sln | 38 ------ 5 files changed, 52 insertions(+), 254 deletions(-) create mode 100644 README.md delete mode 100644 windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs delete mode 100644 windows/xgboost_sharp_wrapper/xgboost.cs delete mode 100644 windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj delete mode 100644 windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln diff --git a/README.md b/README.md new file mode 100644 index 000000000..a2dc4fee1 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +xgboost: eXtreme Gradient Boosting +====== +An optimized general purpose gradient boosting library. The library is parallelized using OpenMP. It implements machine learning algorithm under gradient boosting framework, including generalized linear model and gradient boosted regression tree. + +Contributors: https://github.com/tqchen/xgboost/graphs/contributors + +Turorial and Documentation: https://github.com/tqchen/xgboost/wiki + +Questions and Issues: [https://github.com/tqchen/xgboost/issues](https://github.com/tqchen/xgboost/issues?q=is%3Aissue+label%3Aquestion) + +Examples Code: [Learning to use xgboost by examples](demo) + +Notes on the Code: [Code Guide](src) + +What's New +===== +* See the updated [demo folder](demo) for feature walkthrough +* Thanks to Tong He, the new [R package](R-package) is available + +Features +====== +* Sparse feature format: + - Sparse feature format allows easy handling of missing values, and improve computation efficiency. +* Push the limit on single machine: + - Efficient implementation that optimizes memory and computation. +* Speed: XGBoost is very fast + - IN [demo/higgs/speedtest.py](demo/kaggle-higgs/speedtest.py), kaggle higgs data it is faster(on our machine 20 times faster using 4 threads) than sklearn.ensemble.GradientBoostingClassifier +* Layout of gradient boosting algorithm to support user defined objective +* Python interface, works with numpy and scipy.sparse matrix + +Build +===== +* Simply type make +* If your compiler does not come with OpenMP support, it will fire an warning telling you that the code will compile into single thread mode, and you will get single thread xgboost +* You may get a error: -lgomp is not found + - You can type ```make no_omp=1```, this will get you single thread xgboost + - Alternatively, you can upgrade your compiler to compile multi-thread version +* Windows(VS 2010): see [windows](windows) folder + - In principle, you put all the cpp files in the Makefile to the project, and build + +Version +====== +* This version xgboost-0.3, the code has been refactored from 0.2x to be cleaner and more flexibility +* This version of xgboost is not compatible with 0.2x, due to huge amount of changes in code structure + - This means the model and buffer file of previous version can not be loaded in xgboost-3.0 +* For legacy 0.2x code, refer to [Here](https://github.com/tqchen/xgboost/releases/tag/v0.22) +* Change log in [CHANGES.md](CHANGES.md) + +XGBoost in Graphlab Create +====== +* XGBoost is adopted as part of boosted tree toolkit in Graphlab Create (GLC). Graphlab Create is a powerful python toolkit that allows you to data manipulation, graph processing, hyper-parameter search, and visualization of TeraBytes scale data in one framework. Try the Graphlab Create in http://graphlab.com/products/create/quick-start-guide.html +* Nice blogpost by Jay Gu using GLC boosted tree to solve kaggle bike sharing challenge: http://blog.graphlab.com/using-gradient-boosted-trees-to-predict-bike-sharing-demand diff --git a/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs b/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs deleted file mode 100644 index 1baa42aea..000000000 --- a/windows/xgboost_sharp_wrapper/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Le informazioni generali relative a un assembly sono controllate dal seguente -// set di attributi. Per modificare le informazioni associate a un assembly -// occorre quindi modificare i valori di questi attributi. -[assembly: AssemblyTitle("xgboost_sharp_wrapper")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("xgboost_sharp_wrapper")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili -// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da -// COM, impostare su true l'attributo ComVisible per tale tipo. -[assembly: ComVisible(false)] - -// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi -[assembly: Guid("accc4026-fa8e-41d8-aaa8-1ca69c2b2db5")] - -// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: -// -// Numero di versione principale -// Numero di versione secondario -// Numero build -// Revisione -// -// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build -// utilizzando l'asterisco (*) come descritto di seguito: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/windows/xgboost_sharp_wrapper/xgboost.cs b/windows/xgboost_sharp_wrapper/xgboost.cs deleted file mode 100644 index ae5f3a205..000000000 --- a/windows/xgboost_sharp_wrapper/xgboost.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Runtime.InteropServices; - -namespace xgboost_sharp_wrapper -{ - - - public class xgboost - { - private const string dll_path = "..\\x64\\Release\\"; - - [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr XGDMatrixCreateFromFile(string fname, int silent); - public IntPtr SharpXGDMatrixCreateFromFile(string fname, int silent) - { - return XGDMatrixCreateFromFile(fname, silent); - } - - - /*! - * \brief set float vector to a content in info - * \param handle a instance of data matrix - * \param field field name, can be label, weight - * \param array pointer to float vector - * \param len length of array - */ - [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void XGDMatrixSetFloatInfo(IntPtr handle, string field, IntPtr array, System.UInt32 len); - - [DllImport(dll_path + "xgboost_wrapper.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void XGBoosterSetParam(IntPtr handle, string name, string value); - public void SharpXGBoosterSetParam(IntPtr handle, string name, string value) - { - XGBoosterSetParam(handle,name,value); - } - - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern IntPtr XGBoosterCreate(IntPtr[] dmats, System.UInt32 len); - public IntPtr SharpXGBoosterCreate(IntPtr[] dmats, System.UInt32 len) - { - return XGBoosterCreate(dmats, len); - } - - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern void XGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain); - public void SharpXGBoosterUpdateOneIter(IntPtr handle, int iter, IntPtr dtrain) - { - XGBoosterUpdateOneIter(handle, iter, dtrain); - } - - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern string XGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, - string[] evnames, System.UInt32 len); - public string SharpXGBoosterEvalOneIter(IntPtr handle, int iter, IntPtr[] dmats, - string[] evnames, System.UInt32 len) - { - return XGBoosterEvalOneIter(handle, iter, dmats, evnames, len); - } - /*! - * \brief make prediction based on dmat - * \param handle handle - * \param dmat data matrix - * \param output_margin whether only output raw margin value - * \param len used to store length of returning result - */ - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern IntPtr XGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, ref System.UInt32 len); - - public float[] SharpXGBoosterPredict(IntPtr handle, IntPtr dmat, int output_margin, System.UInt32 len) - { - IntPtr buf = XGBoosterPredict(handle, dmat, output_margin, ref len); - - float[] buffer = new float[len]; - - Marshal.Copy(buf, buffer, 0, buffer.Length); - - return buffer; - } - /*! - * \brief load model from existing file - * \param handle handle - * \param fname file name - */ - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern void XGBoosterLoadModel(IntPtr handle, string fname); - /*! - * \brief save model into existing file - * \param handle handle - * \param fname file name - */ - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern void XGBoosterSaveModel(IntPtr handle, string fname); - /*! - * \brief dump model, return array of strings representing model dump - * \param handle handle - * \param fmap name to fmap can be empty string - * \param out_len length of output array - * \return char *data[], representing dump of each model - */ - [DllImport(dll_path + "xgboost_wrapper.dll")] - public static extern string XGBoosterDumpModel(IntPtr handle, string fmap, - System.UInt32 out_len); - - } -} diff --git a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj deleted file mode 100644 index 01aafd029..000000000 --- a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.csproj +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Debug - AnyCPU - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3} - Library - Properties - xgboost_sharp_wrapper - xgboost_sharp_wrapper - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - ManagedMinimumRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - ManagedMinimumRules.ruleset - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln b/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln deleted file mode 100644 index 600c68552..000000000 --- a/windows/xgboost_sharp_wrapper/xgboost_sharp_wrapper.sln +++ /dev/null @@ -1,38 +0,0 @@ - -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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xgboost_sharp_wrapper", "xgboost_sharp_wrapper.csproj", "{2D0E7F78-53DD-4501-8BD9-69E21A5051E3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kaggle_higgs_demo", "..\kaggle_higgs_demo\kaggle_higgs_demo.csproj", "{2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|x64.ActiveCfg = Debug|x64 - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Debug|x64.Build.0 = Debug|x64 - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|Any CPU.Build.0 = Release|Any CPU - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|x64.ActiveCfg = Release|x64 - {2D0E7F78-53DD-4501-8BD9-69E21A5051E3}.Release|x64.Build.0 = Release|x64 - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|x64.ActiveCfg = Debug|x64 - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Debug|x64.Build.0 = Debug|x64 - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|Any CPU.Build.0 = Release|Any CPU - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|x64.ActiveCfg = Release|x64 - {2EB1B15E-B7CA-494A-B4DC-BF56897A3F2F}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal