Skip to content

Instantly share code, notes, and snippets.

@Roffild
Roffild / xgboost.mqh
Created September 15, 2022 11:11
XGBoost for MQL
View xgboost.mqh
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@Roffild
Roffild / test_autopytorch_metrics.py
Last active February 24, 2021 10:23
Metrics from XGBoost for PyTorch
View test_autopytorch_metrics.py
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
View CUDAPrefetcher.py
from torch.utils.data.dataloader import _SingleProcessDataLoaderIter
class CUDAPrefetcher(_SingleProcessDataLoaderIter):
def __init__(self, loader, device=None, priority=0):
if not torch.cuda.is_available():
raise Exception("Only CUDA")
super(CUDAPrefetcher, self).__init__(loader)
self.device = device
self.stream = torch.cuda.Stream(device=device, priority=priority)
self.last = None
@Roffild
Roffild / multiprocessing_example.py
Created May 22, 2019 00:41
Use multiprocessing in PythonDLL
View multiprocessing_example.py
import multiprocessing
import sys
__file__ = r'path_to\multiprocessing_example.py'
sys.argv = [__file__]
python_exe = r'path_to\python.exe'
def getresult(outp):
@Roffild
Roffild / ModifForest.mqh
Created March 26, 2019 23:47
Modification of a random forest with predictive significance calculations.
View ModifForest.mqh
class CDForestUtils : public CDForest
{
protected:
static void DFProcessInternal(CDecisionForest &df,const int offs,
double &x[],double &y[],ulong &stats[])
{
//--- create variables
int k=0;
int idx=0;
//--- Set pointer to the root