Skip to content

Instantly share code, notes, and snippets.

#
#-------------------------------------------------------------#
# 创建者:https://v2rayse.com
# 创建时间:2023-03-19 14:40:07
# 模版:v2rayse默认模版
# 节点数量:1
#-------------------------------------------------------------#
#
port: 7890
socks-port: 7891
@marquisthunder
marquisthunder / lightgbm_rfe.py
Created March 10, 2023 05:25 — forked from c-bata/lightgbm_rfe.py
Recursive Feature Elimination for LightGBM. This class accepts missing values and Optuna LightGBM tuner.
import numpy as np
import pandas as pd
#import lightgbm as lgb
from optuna.integration import lightgbm as lgb
from sklearn.model_selection import train_test_split
from sklearn.utils import check_X_y, safe_sqr
from sklearn.feature_selection.base import SelectorMixin
from lightgbm import Booster
@marquisthunder
marquisthunder / ali.repo
Created September 8, 2019 10:19
ali dragonwell jdk
[plus]
name=AliYun-2.1903 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/alinux/2.1903/plus/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN
@marquisthunder
marquisthunder / drbd.conf
Created February 8, 2019 13:45
[drbd] drbd
//syncer {
// rate 512000k; # bytes/second
// c-plan-ahead 20; # 1/10 seconds, default
// c-delay-target 15; # 1/10 seconds
// c-fill-target 0s; # bytes
// c-max-rate 921600k; # bytes/second
// c-min-rate 81920k; # bytes/second
// al-extents 6433;
//}
@marquisthunder
marquisthunder / torch.py
Created December 21, 2018 01:32
[torch] cuda test
import torch
torch.cuda.current_device()
torch.cuda.device(0)
torch.cuda.device_count()
torch.cuda.get_device_name(0)
@marquisthunder
marquisthunder / unstack.py
Created August 6, 2018 04:38
[split stack] #pandas
s.url.str.split(',', expand=True).stack().reset_index(level=1, drop=True)
@marquisthunder
marquisthunder / featuresession.py
Created April 18, 2018 05:50
[featuresession]
import requests
from concurrent.futures import ThreadPoolExecutor
from threading import local
class FuturesSession(requests.Session):
def __init__(self, max_workers=2, session_factory=requests.Session, *args, **kwargs):
super().__init__(*args, **kwargs)
self.session_factory = session_factory
self.session_args = args
self.session_kwargs = kwargs
@marquisthunder
marquisthunder / rnd_neightbor.py
Created April 16, 2018 05:59
[graph_tool] rand_neightbor
import graph_tool
from graph_tool.spectral import adjacency
import numpy as np
g = graph_tool.Graph()
g.add_vertex(100)
edges = np.random.randint(0, 100, (500,2))
g.add_edge_list(edges)
mat = adjacency(g).tolil()
@marquisthunder
marquisthunder / s3fs.sh
Created November 30, 2017 08:14
[s3fs]
s3fs -d marvin:/s3fs `pwd` -o passwd_file=/home/creditx/.aws/passwd -o url=https://s3.cn-north-1.amazonaws.com.cn -o use_path_request_style -o dbglevel=info -f -o curldbg
def pmml_validation(pmml):
"""
Use openscoring to test pmml on validation data and Save the probability result.
"""
headers = {'Content-type': 'text/xml'}
data = bytes(pmml, encoding='utf-8')
rt = requests.put('{}/{}'.format(validate_url, uuid.uuid4()), headers=headers, data=data)
return rt.status_code == 200 or rt.status_code == 201